diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-12 09:48:55 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | ea97370f973374f863e4296c2bb872be8b5235a3 (patch) | |
tree | bcf74846c250dd5b1f84049622ed2766605365e7 /include/asm | |
parent | 4ca3b74621c3608de42a91730a71892d9d7c27b5 (diff) |
Before interpreter. Cleanup build script. Begin writing code analyzer tool to find common mistakes
Diffstat (limited to 'include/asm')
-rw-r--r-- | include/asm/x86_64.h | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/include/asm/x86_64.h b/include/asm/x86_64.h deleted file mode 100644 index 92de96b..0000000 --- a/include/asm/x86_64.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef AMAL_ASM_X86_64_H -#define AMAL_ASM_X86_64_H - -#include "../std/misc.h" -#include "../std/types.h" - -typedef struct { - void *code; - u8 *code_it; - usize size; -} Asm; - -typedef enum { - EAX, - ECX, - EDX, - EBX, - ESP, - EBP, - ESI, - EDI -} Reg32; - -typedef enum { - RAX, - RCX, - RDX, - RBX, - RSP, - RBP, - RSI, - RDI -} Reg64; - -typedef struct { - Reg64 base; - Reg64 index; - i32 disp; - u8 scale; -} AsmPtr; - -void asm_ptr_init(AsmPtr *self, Reg64 base); -void asm_ptr_init_index(AsmPtr *self, Reg64 base, Reg64 index); -void asm_ptr_init_disp(AsmPtr *self, Reg64 base, i32 disp); -void asm_ptr_init_index_disp(AsmPtr *self, Reg64 base, Reg64 index, i32 disp); - -CHECK_RESULT int asm_init(Asm *self); -void asm_deinit(Asm *self); - -CHECK_RESULT int asm_execute(Asm *self); - -CHECK_RESULT int asm_nop(Asm *self); - - - - - - - - - -CHECK_RESULT int asm_mov_mi(Asm *self, AsmPtr *dst, i32 immediate); -CHECK_RESULT int asm_mov_mr(Asm *self, AsmPtr *dst, Reg64 src); -CHECK_RESULT int asm_mov_rm(Asm *self, Reg64 dst, AsmPtr *src); -CHECK_RESULT int asm_mov_ri(Asm *self, Reg64 dst, i64 immediate); -CHECK_RESULT int asm_mov_rr(Asm *self, Reg64 dst, Reg64 src); - -CHECK_RESULT int asm_add_rr(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_sub_rr(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_imul_rr(Asm *self, Reg64 dst, Reg64 src); - -CHECK_RESULT int asm_pushr(Asm *self, Reg64 reg); -CHECK_RESULT int asm_popr(Asm *self, Reg64 reg); - - - - - - - - - - - - - - -CHECK_RESULT int asm_mov_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_add_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_sub_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_and_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_or_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_xor_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_cmp_rm32(Asm *self, Reg32 dst, Reg32 src); -CHECK_RESULT int asm_add_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_or_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_adc_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_sbb_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_and_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_sub_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_xor_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_cmp_rm32_imm(Asm *self, Reg32 reg, i32 immediate); -CHECK_RESULT int asm_rol_rm32_imm(Asm *self, Reg32 reg, i8 immediate); -CHECK_RESULT int asm_ror_rm32_imm(Asm *self, Reg32 reg, i8 immediate); -CHECK_RESULT int asm_rcl_rm32_imm(Asm *self, Reg32 reg, i8 immediate); -CHECK_RESULT int asm_rcr_rm32_imm(Asm *self, Reg32 reg, i8 immediate); -CHECK_RESULT int asm_shl_rm32_imm(Asm *self, Reg32 reg, i8 immediate); -CHECK_RESULT int asm_shr_rm32_imm(Asm *self, Reg32 reg, i8 immediate); -CHECK_RESULT int asm_sar_rm32_imm(Asm *self, Reg32 reg, i8 immediate); - -CHECK_RESULT int asm_mov_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_add_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_sub_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_and_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_or_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_xor_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_cmp_rm64(Asm *self, Reg64 dst, Reg64 src); -CHECK_RESULT int asm_add_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_or_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_adc_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_sbb_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_and_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_sub_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_xor_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_cmp_rm64_imm(Asm *self, Reg64 reg, i32 immediate); -CHECK_RESULT int asm_rol_rm64_imm(Asm *self, Reg64 reg, i8 immediate); -CHECK_RESULT int asm_ror_rm64_imm(Asm *self, Reg64 reg, i8 immediate); -CHECK_RESULT int asm_rcl_rm64_imm(Asm *self, Reg64 reg, i8 immediate); -CHECK_RESULT int asm_rcr_rm64_imm(Asm *self, Reg64 reg, i8 immediate); -CHECK_RESULT int asm_shl_rm64_imm(Asm *self, Reg64 reg, i8 immediate); -CHECK_RESULT int asm_shr_rm64_imm(Asm *self, Reg64 reg, i8 immediate); -CHECK_RESULT int asm_sar_rm64_imm(Asm *self, Reg64 reg, i8 immediate); - -CHECK_RESULT int asm_ret(Asm *self, u16 bytes); - -#endif |