diff options
| author | JustSomePwner <crotchyalt@gmail.com> | 2018-08-30 14:01:54 +0200 |
|---|---|---|
| committer | JustSomePwner <crotchyalt@gmail.com> | 2018-08-30 14:01:54 +0200 |
| commit | 7ccb819f867493f8ec202ea3b39c94c198c64584 (patch) | |
| tree | 94622e61af0ff359e3d6689cf274d74f60b2492a /loader/x86.h | |
| parent | 564d979b79e8a5aaa5014eba0ecd36c61575934f (diff) | |
first
Diffstat (limited to 'loader/x86.h')
| -rw-r--r-- | loader/x86.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/loader/x86.h b/loader/x86.h new file mode 100644 index 0000000..5208225 --- /dev/null +++ b/loader/x86.h @@ -0,0 +1,47 @@ +#pragma once
+#include <inttypes.h>
+
+namespace x86
+{
+ enum class reg : size_t {
+ eax = 0,
+ ecx,
+ edx,
+ ebx,
+ esp,
+ ebp,
+ esi,
+ edi,
+
+ /*
+ x64:
+ r8,
+ r9,
+ r10,
+ r11,
+ r12,
+ r13,
+ r14,
+ r15,*/
+ };
+
+ enum instruction : uint8_t {
+ retn_imm16 = 0xc2,
+ retn = 0xc3,
+ fs = 0x64,
+ //its big nigga season
+ call = 0xff
+ };
+
+ __forceinline static uint32_t encode_mov_imm32( x86::reg dreg ) {
+ return ( 0xb8 + ( size_t( dreg ) ) );
+ }
+
+ __forceinline static uint32_t encode_push_reg( x86::reg dreg ) {
+ return ( 0x50 | ( ( size_t( dreg ) ) & 7 ) );
+ }
+
+ __forceinline static uint32_t encode_pop_reg( x86::reg dreg ) {
+ return ( 0x58 | ( ( size_t( dreg ) ) & 7 ) );
+ }
+};
\ No newline at end of file |
