Search
lxdream.org :: lxdream/src/sh4/x86op.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/x86op.h
changeset 539:75f3e594d4a7
prev527:14c9489f647e
next547:d6e00ffc4adc
author nkeynes
date Wed Nov 21 11:40:15 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add support for the darwin ABI
file annotate diff log raw
1.1 --- a/src/sh4/x86op.h Sun Nov 18 11:12:44 2007 +0000
1.2 +++ b/src/sh4/x86op.h Wed Nov 21 11:40:15 2007 +0000
1.3 @@ -55,9 +55,31 @@
1.4 #define OP64(x) *((uint64_t *)xlat_output) = (x); xlat_output+=8
1.5 #if SH4_TRANSLATOR == TARGET_X86_64
1.6 #define OPPTR(x) OP64((uint64_t)(x))
1.7 +#define STACK_ALIGN 16
1.8 +#define POP_r32(r1) OP(0x58 + r1); sh4_x86.stack_posn -= 8;
1.9 +#define PUSH_r32(r1) OP(0x50 + r1); sh4_x86.stack_posn += 8;
1.10 +#define PUSH_imm32(imm) OP(0x68); OP32(imm); sh4_x86.stack_posn += 4;
1.11 +#define PUSH_imm64(imm) REXW(); OP(0x68); OP64(imm); sh4_x86.stack_posn += 8;
1.12 #else
1.13 #define OPPTR(x) OP32((uint32_t)(x))
1.14 +#ifdef APPLE_BUILD
1.15 +#define STACK_ALIGN 16
1.16 +#define POP_r32(r1) OP(0x58 + r1); sh4_x86.stack_posn -= 4;
1.17 +#define PUSH_r32(r1) OP(0x50 + r1); sh4_x86.stack_posn += 4;
1.18 +#define PUSH_imm32(imm) OP(0x68); OP32(imm); sh4_x86.stack_posn += 4;
1.19 +#else
1.20 +#define POP_r32(r1) OP(0x58 + r1)
1.21 +#define PUSH_r32(r1) OP(0x50 + r1)
1.22 +#define PUSH_imm32(imm) OP(0x68); OP32(imm)
1.23 #endif
1.24 +#endif
1.25 +
1.26 +#ifdef STACK_ALIGN
1.27 +#else
1.28 +#define POP_r32(r1) OP(0x58 + r1)
1.29 +#define PUSH_r32(r1) OP(0x50 + r1)
1.30 +#endif
1.31 +
1.32
1.33 /* Offset of a reg relative to the sh4r structure */
1.34 #define REG_OFFSET(reg) (((char *)&sh4r.reg) - ((char *)&sh4r))
1.35 @@ -140,9 +162,6 @@
1.36 #define OR_imm8_r8(imm,r1) OP(0x80); MODRM_rm32_r32(r1,1); OP(imm)
1.37 #define OR_imm32_r32(imm,r1) OP(0x81); MODRM_rm32_r32(r1,1); OP32(imm)
1.38 #define OR_sh4r_r32(disp,r1) OP(0x0B); MODRM_r32_sh4r(r1,disp)
1.39 -#define POP_r32(r1) OP(0x58 + r1)
1.40 -#define PUSH_r32(r1) OP(0x50 + r1)
1.41 -#define PUSH_imm32(imm) OP(0x68); OP32(imm)
1.42 #define RCL1_r32(r1) OP(0xD1); MODRM_rm32_r32(r1,2)
1.43 #define RCR1_r32(r1) OP(0xD1); MODRM_rm32_r32(r1,3)
1.44 #define RET() OP(0xC3)
1.45 @@ -161,6 +180,7 @@
1.46 #define STC() OP(0xF9)
1.47 #define SUB_r32_r32(r1,r2) OP(0x2B); MODRM_rm32_r32(r1,r2)
1.48 #define SUB_sh4r_r32(disp,r1) OP(0x2B); MODRM_r32_sh4r(r1, disp)
1.49 +#define SUB_imm8s_r32(imm,r1) ADD_imm8s_r32(-(imm),r1)
1.50 #define TEST_r8_r8(r1,r2) OP(0x84); MODRM_r32_rm32(r1,r2)
1.51 #define TEST_r32_r32(r1,r2) OP(0x85); MODRM_rm32_r32(r1,r2)
1.52 #define TEST_imm8_r8(imm8,r1) OP(0xF6); MODRM_rm32_r32(r1,0); OP(imm8)
.