diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-24 23:31:14 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | d9f652919961a2947452ad3c4af4659f3d2fb330 (patch) | |
tree | 2db541db311a9b5a83d3f2c9b199f6d5c3341555 /executor/x86_64/asm.h | |
parent | 40652d7dbf701eda83fa8323b42a6b5bf0ca6bdd (diff) |
Add if/else/elseif/while, including the final assembly
Diffstat (limited to 'executor/x86_64/asm.h')
-rw-r--r-- | executor/x86_64/asm.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/executor/x86_64/asm.h b/executor/x86_64/asm.h index ace1ecf..ac519e9 100644 --- a/executor/x86_64/asm.h +++ b/executor/x86_64/asm.h @@ -89,6 +89,30 @@ CHECK_RESULT int asm_callr(Asm *self, Reg64 reg); CHECK_RESULT int asm_call_rel32(Asm *self, i32 relative); void asm_override_call_rel32(Asm *self, u32 asm_index, i32 new_relative); +CHECK_RESULT int asm_cmp_rm(Asm *self, Reg64 reg1, AsmPtr *reg2); +/* + Sets the 8 bit memory operand to 1 if the last cmp was equals, otherwise set it to 0. + Note: this instruction doesn't work with AH (RSP), CH (RBP), DH (RSI) and BH (RDI). + TODO: When ST, MM AND XMM registers are implemented, also check for them as they are also invalid +*/ +CHECK_RESULT int asm_sete_m(Asm *self, AsmPtr *dst); +CHECK_RESULT int asm_sete_r(Asm *self, Reg64 dst); +/* + In x86 assembly, the @relative position starts from the next instruction. + This offset shouldn't be calculated by the caller and is instead managed + by this asm library itself. +*/ +CHECK_RESULT int asm_jz(Asm *self, i32 relative); +/* Override conditional jump target */ +void asm_override_jcc_rel32(Asm *self, u32 asm_index, i32 new_relative); +/* + In x86 assembly, the @relative position starts from the next instruction. + This offset shouldn't be calculated by the caller and is instead managed + by this asm library itself. +*/ +CHECK_RESULT int asm_jmp(Asm *self, i32 relative); +void asm_override_jmp_rel32(Asm *self, u32 asm_index, i32 new_relative); + |