From bb3ce6cdea12ff00b998c5a1c6dbf2c83dba77c2 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 5 Oct 2020 10:16:46 -0700 Subject: 6956 --- subx_opcodes | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/subx_opcodes b/subx_opcodes index 6706a695..75a42e3e 100644 --- a/subx_opcodes +++ b/subx_opcodes @@ -51,16 +51,16 @@ Opcodes currently supported by SubX: 5f: pop top of stack to EDI (pop) 68: push imm32 to stack (push) 69: multiply rm32 by imm32 and store result in r32 - 72: jump disp8 bytes away if lesser (unsigned), if CF is set (jcc/jb/jnae) - 73: jump disp8 bytes away if greater or equal (unsigned), if CF is unset (jcc/jae/jnb) + 72: jump disp8 bytes away if lesser (addr, float), if CF is set (jcc/jb/jnae) + 73: jump disp8 bytes away if greater or equal (addr, float), if CF is unset (jcc/jae/jnb) 74: jump disp8 bytes away if equal, if ZF is set (jcc/jz/je) 75: jump disp8 bytes away if not equal, if ZF is not set (jcc/jnz/jne) - 76: jump disp8 bytes away if lesser or equal (unsigned), if ZF is set or CF is set (jcc/jbe/jna) - 77: jump disp8 bytes away if greater (unsigned), if ZF is unset and CF is unset (jcc/ja/jnbe) - 7c: jump disp8 bytes away if lesser (signed), if SF != OF (jcc/jl/jnge) - 7d: jump disp8 bytes away if greater or equal (signed), if SF == OF (jcc/jge/jnl) - 7e: jump disp8 bytes away if lesser or equal (signed), if ZF is set or SF != OF (jcc/jle/jng) - 7f: jump disp8 bytes away if greater (signed), if ZF is unset and SF == OF (jcc/jg/jnle) + 76: jump disp8 bytes away if lesser or equal (addr, float), if ZF is set or CF is set (jcc/jbe/jna) + 77: jump disp8 bytes away if greater (addr, float), if ZF is unset and CF is unset (jcc/ja/jnbe) + 7c: jump disp8 bytes away if lesser, if SF != OF (jcc/jl/jnge) + 7d: jump disp8 bytes away if greater or equal, if SF == OF (jcc/jge/jnl) + 7e: jump disp8 bytes away if lesser or equal, if ZF is set or SF != OF (jcc/jle/jng) + 7f: jump disp8 bytes away if greater, if ZF is unset and SF == OF (jcc/jg/jnle) 81: combine rm32 with imm32 based on subop (add/sub/and/or/xor/cmp) 87: swap the contents of r32 and rm32 (xchg) 88: copy r8 to r8/m8-at-r32 @@ -90,16 +90,17 @@ Opcodes currently supported by SubX: f4: halt (hlt) f7: negate/multiply/divide rm32 (with EAX and EDX if necessary) depending on subop (neg/mul/idiv) ff: increment/decrement/jump/push/call rm32 based on subop (inc/dec/jmp/push/call) - 0f 82: jump disp32 bytes away if lesser (unsigned), if CF is set (jcc/jb/jnae) - 0f 83: jump disp32 bytes away if greater or equal (unsigned), if CF is unset (jcc/jae/jnb) + 0f 2f: compare: set SF if x32 < xm32 (comiss) + 0f 82: jump disp32 bytes away if lesser (addr, float), if CF is set (jcc/jb/jnae) + 0f 83: jump disp32 bytes away if greater or equal (addr, float), if CF is unset (jcc/jae/jnb) 0f 84: jump disp32 bytes away if equal, if ZF is set (jcc/jz/je) 0f 85: jump disp32 bytes away if not equal, if ZF is not set (jcc/jnz/jne) - 0f 86: jump disp32 bytes away if lesser or equal (unsigned), if ZF is set or CF is set (jcc/jbe/jna) - 0f 87: jump disp32 bytes away if greater (unsigned), if ZF is unset and CF is unset (jcc/ja/jnbe) - 0f 8c: jump disp32 bytes away if lesser (signed), if SF != OF (jcc/jl/jnge) - 0f 8d: jump disp32 bytes away if greater or equal (signed), if SF == OF (jcc/jge/jnl) - 0f 8e: jump disp32 bytes away if lesser or equal (signed), if ZF is set or SF != OF (jcc/jle/jng) - 0f 8f: jump disp32 bytes away if greater (signed), if ZF is unset and SF == OF (jcc/jg/jnle) + 0f 86: jump disp32 bytes away if lesser or equal (addr, float), if ZF is set or CF is set (jcc/jbe/jna) + 0f 87: jump disp32 bytes away if greater (addr, float), if ZF is unset and CF is unset (jcc/ja/jnbe) + 0f 8c: jump disp32 bytes away if lesser, if SF != OF (jcc/jl/jnge) + 0f 8d: jump disp32 bytes away if greater or equal, if SF == OF (jcc/jge/jnl) + 0f 8e: jump disp32 bytes away if lesser or equal, if ZF is set or SF != OF (jcc/jle/jng) + 0f 8f: jump disp32 bytes away if greater, if ZF is unset and SF == OF (jcc/jg/jnle) 0f 92: set r8/m8-at-rm32 to 1 if lesser (unsigned), if CF is set, 0 otherwise (setcc/setb/setnae) 0f 93: set r8/m8-at-rm32 to 1 if greater or equal (unsigned), if CF is unset, 0 otherwise (setcc/setae/setnb) 0f 94: set r8/m8-at-rm32 to 1 if equal, if ZF is set, 0 otherwise (setcc/setz/sete) @@ -111,6 +112,19 @@ Opcodes currently supported by SubX: 0f 9e: set r8/m8-at-rm32 to 1 if lesser or equal (signed), if ZF is set or SF != OF, 0 otherwise (setcc/setle/setng) 0f 9f: set r8/m8-at-rm32 to 1 if greater (signed), if ZF is unset and SF == OF, 0 otherwise (setcc/setg/setnle) 0f af: multiply rm32 into r32 (imul) + f3 0f 10: copy xm32 to x32 (movss) + f3 0f 11: copy x32 to xm32 (movss) + f3 0f 2a: convert integer to floating-point (cvtsi2ss) + f3 0f 2d: convert floating-point to int (cvtss2si) + f3 0f 51: square root of float (sqrtss) + f3 0f 52: inverse square root of float (rsqrtss) + f3 0f 53: reciprocal of float (rcpss) + f3 0f 58: add floats (addss) + f3 0f 59: multiply floats (mulss) + f3 0f 5c: subtract floats (subss) + f3 0f 5d: minimum of two floats (minss) + f3 0f 5e: divide floats (divss) + f3 0f 5f: maximum of two floats (maxss) Run `bootstrap help instructions` for details on words like 'r32' and 'disp8'. For complete details on these instructions, consult the IA-32 manual (volume 2). There's various versions of it online, such as https://c9x.me/x86. -- cgit 1.4.1-2-gfad0