Search
lxdream.org :: lxdream/src/sh4/x86op.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/x86op.h
changeset 527:14c9489f647e
prev394:7eb172bfeefe
next539:75f3e594d4a7
author nkeynes
date Sun Nov 18 11:12:44 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change x86-64 translator work-in-progress
file annotate diff log raw
1.1 --- a/src/sh4/x86op.h Wed Sep 19 09:15:18 2007 +0000
1.2 +++ b/src/sh4/x86op.h Sun Nov 18 11:12:44 2007 +0000
1.3 @@ -52,6 +52,12 @@
1.4
1.5 #define OP(x) *xlat_output++ = (x)
1.6 #define OP32(x) *((uint32_t *)xlat_output) = (x); xlat_output+=4
1.7 +#define OP64(x) *((uint64_t *)xlat_output) = (x); xlat_output+=8
1.8 +#if SH4_TRANSLATOR == TARGET_X86_64
1.9 +#define OPPTR(x) OP64((uint64_t)(x))
1.10 +#else
1.11 +#define OPPTR(x) OP32((uint32_t)(x))
1.12 +#endif
1.13
1.14 /* Offset of a reg relative to the sh4r structure */
1.15 #define REG_OFFSET(reg) (((char *)&sh4r.reg) - ((char *)&sh4r))
1.16 @@ -90,6 +96,8 @@
1.17
1.18 #define MODRM_r32_sh4r(r1,disp) if(disp>127){ MODRM_r32_ebp32(r1,disp);}else{ MODRM_r32_ebp8(r1,(unsigned char)disp); }
1.19
1.20 +#define REXW() OP(0x48)
1.21 +
1.22 /* Major opcodes */
1.23 #define ADD_sh4r_r32(disp,r1) OP(0x03); MODRM_r32_sh4r(r1,disp)
1.24 #define ADD_r32_sh4r(r1,disp) OP(0x01); MODRM_r32_sh4r(r1,disp)
1.25 @@ -118,7 +126,7 @@
1.26 #define JMP_rel8(rel, label) OP(0xEB); OP(rel); MARK_JMP(rel,label)
1.27 #define MOV_r32_r32(r1,r2) OP(0x89); MODRM_r32_rm32(r1,r2)
1.28 #define MOV_r32_sh4r(r1,disp) OP(0x89); MODRM_r32_sh4r(r1,disp)
1.29 -#define MOV_moff32_EAX(off) OP(0xA1); OP32(off)
1.30 +#define MOV_moff32_EAX(off) OP(0xA1); OPPTR(off)
1.31 #define MOV_sh4r_r32(disp, r1) OP(0x8B); MODRM_r32_sh4r(r1,disp)
1.32 #define MOV_r32ind_r32(r1,r2) OP(0x8B); OP(0 + (r2<<3) + r1 )
1.33 #define MOVSX_r8_r32(r1,r2) OP(0x0F); OP(0xBE); MODRM_rm32_r32(r1,r2)
.