Search
lxdream.org :: lxdream/src/sh4/x86op.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/x86op.h
changeset 386:6fb10951326a
prev380:2e8166bf6832
next388:13bae2fb0373
author nkeynes
date Sun Sep 16 07:03:23 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Implement MAC.W, MAC.L and DIV1
Correct SHAD/SHLD
Fix privilege and slot illegal checks on LDC/STC opcodes
Fix various other small bugs
file annotate diff log raw
1.1 --- a/src/sh4/x86op.h Wed Sep 12 11:31:16 2007 +0000
1.2 +++ b/src/sh4/x86op.h Sun Sep 16 07:03:23 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: x86op.h,v 1.7 2007-09-12 11:31:16 nkeynes Exp $
1.6 + * $Id: x86op.h,v 1.8 2007-09-16 07:03:23 nkeynes Exp $
1.7 *
1.8 * Definitions of x86 opcodes for use by the translator.
1.9 *
1.10 @@ -92,10 +92,14 @@
1.11
1.12 /* Major opcodes */
1.13 #define ADD_sh4r_r32(disp,r1) OP(0x03); MODRM_r32_sh4r(r1,disp)
1.14 +#define ADD_r32_sh4r(r1,disp) OP(0x01); MODRM_r32_sh4r(r1,disp)
1.15 #define ADD_r32_r32(r1,r2) OP(0x03); MODRM_rm32_r32(r1,r2)
1.16 #define ADD_imm8s_r32(imm,r1) OP(0x83); MODRM_rm32_r32(r1, 0); OP(imm)
1.17 +#define ADD_imm8s_sh4r(imm,disp) OP(0x83); MODRM_r32_sh4r(0,disp); OP(imm)
1.18 #define ADD_imm32_r32(imm32,r1) OP(0x81); MODRM_rm32_r32(r1,0); OP32(imm32)
1.19 #define ADC_r32_r32(r1,r2) OP(0x13); MODRM_rm32_r32(r1,r2)
1.20 +#define ADC_sh4r_r32(disp,r1) OP(0x13); MODRM_r32_sh4r(r1,disp)
1.21 +#define ADC_r32_sh4r(r1,disp) OP(0x11); MODRM_r32_sh4r(r1,disp)
1.22 #define AND_r32_r32(r1,r2) OP(0x23); MODRM_rm32_r32(r1,r2)
1.23 #define AND_imm8_r8(imm8, r1) OP(0x80); MODRM_rm32_r32(r1,4); OP(imm8)
1.24 #define AND_imm8s_r32(imm8,r1) OP(0x83); MODRM_rm32_r32(r1,4); OP(imm8)
1.25 @@ -153,6 +157,8 @@
1.26 #define TEST_imm8_r8(imm8,r1) OP(0xF6); MODRM_rm32_r32(r1,0); OP(imm8)
1.27 #define TEST_imm32_r32(imm,r1) OP(0xF7); MODRM_rm32_r32(r1,0); OP32(imm)
1.28 #define XCHG_r8_r8(r1,r2) OP(0x86); MODRM_rm32_r32(r1,r2)
1.29 +#define XOR_r8_r8(r1,r2) OP(0x32); MODRM_rm32_r32(r1,r2)
1.30 +#define XOR_imm8s_r32(imm,r1) OP(0x83); MODRM_rm32_r32(r1,6); OP(imm)
1.31 #define XOR_r32_r32(r1,r2) OP(0x33); MODRM_rm32_r32(r1,r2)
1.32 #define XOR_sh4r_r32(disp,r1) OP(0x33); MODRM_r32_sh4r(r1,disp)
1.33 #define XOR_imm32_r32(imm,r1) OP(0x81); MODRM_rm32_r32(r1,6); OP32(imm)
1.34 @@ -188,8 +194,12 @@
1.35 #define JNGE_rel8(rel,label) OP(0x7C); OP(rel); MARK_JMP(rel,label)
1.36 #define JNC_rel8(rel,label) OP(0x73); OP(rel); MARK_JMP(rel,label)
1.37 #define JNO_rel8(rel,label) OP(0x71); OP(rel); MARK_JMP(rel,label)
1.38 +#define JNS_rel8(rel,label) OP(0x79); OP(rel); MARK_JMP(rel,label)
1.39 +#define JS_rel8(rel,label) OP(0x78); OP(rel); MARK_JMP(rel,label)
1.40 +
1.41
1.42 /* 32-bit long forms w/ backpatching to an exit routine */
1.43 +#define JMP_exit(rel) OP(0xE9); sh4_x86_add_backpatch(xlat_output); OP32(rel)
1.44 #define JE_exit(rel) OP(0x0F); OP(0x84); sh4_x86_add_backpatch(xlat_output); OP32(rel)
1.45 #define JA_exit(rel) OP(0x0F); OP(0x87); sh4_x86_add_backpatch(xlat_output); OP32(rel)
1.46 #define JAE_exit(rel) OP(0x0F); OP(0x83); sh4_x86_add_backpatch(xlat_output); OP32(rel)
1.47 @@ -240,8 +250,9 @@
1.48 #define SETGE_t() SETGE_sh4r(R_T)
1.49 #define SETC_t() SETC_sh4r(R_T)
1.50 #define SETO_t() SETO_sh4r(R_T)
1.51 +#define SETNE_t() SETNE_sh4r(R_T)
1.52
1.53 -#define SETC_r32(r1) OP(0x0F); OP(0x92); MODRM_rm32_r32(r1, 0)
1.54 +#define SETC_r8(r1) OP(0x0F); OP(0x92); MODRM_rm32_r32(r1, 0)
1.55
1.56 /* Pseudo-op Load carry from T: CMP [EBP+t], #01 ; CMC */
1.57 #define LDC_t() OP(0x83); MODRM_r32_sh4r(7,R_T); OP(0x01); CMC()
.