diff options
Diffstat (limited to 'asm')
-rw-r--r-- | asm/intel64/all_ops.h | 3 | ||||
-rw-r--r-- | asm/intel64/nop.cpp | 11 | ||||
-rw-r--r-- | asm/intel64/nop.h | 13 | ||||
-rw-r--r-- | asm/intel64/ret.cpp | 12 | ||||
-rw-r--r-- | asm/intel64/ret.h | 12 | ||||
-rw-r--r-- | asm/intel64/trivials.cpp | 19 | ||||
-rw-r--r-- | asm/intel64/trivials.h | 24 |
7 files changed, 44 insertions, 50 deletions
diff --git a/asm/intel64/all_ops.h b/asm/intel64/all_ops.h index 82f518f..c41734c 100644 --- a/asm/intel64/all_ops.h +++ b/asm/intel64/all_ops.h @@ -10,7 +10,6 @@ #include "jmp.h" #include "mov.h" #include "mul.h" -#include "nop.h" -#include "ret.h" #include "sub.h" +#include "trivials.h" #include "xor.h" diff --git a/asm/intel64/nop.cpp b/asm/intel64/nop.cpp deleted file mode 100644 index 2d99278..0000000 --- a/asm/intel64/nop.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "nop.h" - -#include <asm/assembler.h> - -namespace { - -bool registered { registerOp("nop", [](Asm::Args& args) -> std::shared_ptr<Op>{ - return std::make_shared<Op_nop>(); - }) }; - -} diff --git a/asm/intel64/nop.h b/asm/intel64/nop.h deleted file mode 100644 index 233b2ef..0000000 --- a/asm/intel64/nop.h +++ /dev/null @@ -1,13 +0,0 @@ -// No Operation - -#pragma once - -#include <asm/chunk.h> - -class Op_nop: public OpSimple -{ -public: - Op_nop() : OpSimple({ 0x90 }) {} - -}; - diff --git a/asm/intel64/ret.cpp b/asm/intel64/ret.cpp deleted file mode 100644 index c42ad8a..0000000 --- a/asm/intel64/ret.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "ret.h" - -#include <asm/assembler.h> - -namespace { - -bool registered { registerOp("ret", [](Asm::Args& args) -> std::shared_ptr<Op>{ - return std::make_shared<Op_ret>(); - }) }; - -} - diff --git a/asm/intel64/ret.h b/asm/intel64/ret.h deleted file mode 100644 index 7e7f68c..0000000 --- a/asm/intel64/ret.h +++ /dev/null @@ -1,12 +0,0 @@ -// Return from procedure - -#pragma once - -#include <asm/chunk.h> - -class Op_ret: public OpSimple -{ -public: - Op_ret() : OpSimple({ 0xC3 }) {} // near return; TODO: far return is 0xCB -}; - diff --git a/asm/intel64/trivials.cpp b/asm/intel64/trivials.cpp new file mode 100644 index 0000000..dd89ecd --- /dev/null +++ b/asm/intel64/trivials.cpp @@ -0,0 +1,19 @@ +#include "trivials.h" + +#include <asm/assembler.h> + +namespace { + +bool registered { + registerOp("nop", [](Asm::Args& args) -> std::shared_ptr<Op>{ + return std::make_shared<Op_nop>(); + }) && + registerOp("ret", [](Asm::Args& args) -> std::shared_ptr<Op>{ + return std::make_shared<Op_ret>(); + }) && + registerOp("syscall", [](Asm::Args& args) -> std::shared_ptr<Op>{ + return std::make_shared<Op_syscall>(); + }) +}; + +} diff --git a/asm/intel64/trivials.h b/asm/intel64/trivials.h new file mode 100644 index 0000000..72ea3f8 --- /dev/null +++ b/asm/intel64/trivials.h @@ -0,0 +1,24 @@ +// Trivial Operations, without arguments + +#pragma once + +#include <asm/chunk.h> + +// No Operation +class Op_nop: public OpSimple +{ +public: Op_nop() : OpSimple({ 0x90 }) {} +}; + +// Return from procedure +class Op_ret: public OpSimple +{ +public: Op_ret() : OpSimple({ 0xC3 }) {} // near return; TODO: far return is 0xCB +}; + +// Syscall +class Op_syscall: public OpSimple +{ +public: Op_syscall() : OpSimple({ 0x0F, 0x05 }) {} +}; + |