Skip to content

Commit

Permalink
third_party: ngen: add movi src check
Browse files Browse the repository at this point in the history
  • Loading branch information
kealan-barbieri committed Jan 23, 2025
1 parent 0cdbbe9 commit f3ceb3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions third_party/ngen/ngen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,9 @@ BinaryCodeGenerator<hw>::opX(Opcode op, DataType defaultType, const InstructionM

typename EncodingTag12Dispatch<hw>::tag tag;
Instruction12 i{};
#ifdef NGEN_SAFE
if (!src0.isIndirect()) throw invalid_address_mode_exception();
#endif

InstructionModifier emod = mod | defaultModifier;
if (forceWE)
Expand Down
4 changes: 4 additions & 0 deletions third_party/ngen/ngen_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ class invalid_address_modifier_exception : public std::runtime_error {
public:
invalid_address_modifier_exception() : std::runtime_error("Invalid address offset") {}
};
class invalid_address_mode_exception : public std::runtime_error {
public:
invalid_address_mode_exception() : std::runtime_error("Invalid address mode") {}
};
#endif

// Graphics core generations.
Expand Down

0 comments on commit f3ceb3d

Please sign in to comment.