diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-01-03 23:50:08 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-01-03 23:50:08 +0000 |
commit | 14ce26e755135e80f3726d42a5a887723d615291 (patch) | |
tree | 6d8f3631c3489af3d64182a016e64e55179ab53a /target-i386/ops_template_mem.h | |
parent | c46878786af930f8f06695371ee80ffa8acf98ef (diff) |
x86_64 target support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1197 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/ops_template_mem.h')
-rw-r--r-- | target-i386/ops_template_mem.h | 114 |
1 files changed, 70 insertions, 44 deletions
diff --git a/target-i386/ops_template_mem.h b/target-i386/ops_template_mem.h index ea73c96caa..00454e6d05 100644 --- a/target-i386/ops_template_mem.h +++ b/target-i386/ops_template_mem.h @@ -28,6 +28,8 @@ #define MEM_SUFFIX w_raw #elif DATA_BITS == 32 #define MEM_SUFFIX l_raw +#elif DATA_BITS == 64 +#define MEM_SUFFIX q_raw #endif #elif MEM_WRITE == 1 @@ -38,6 +40,8 @@ #define MEM_SUFFIX w_kernel #elif DATA_BITS == 32 #define MEM_SUFFIX l_kernel +#elif DATA_BITS == 64 +#define MEM_SUFFIX q_kernel #endif #elif MEM_WRITE == 2 @@ -48,6 +52,8 @@ #define MEM_SUFFIX w_user #elif DATA_BITS == 32 #define MEM_SUFFIX l_user +#elif DATA_BITS == 64 +#define MEM_SUFFIX q_user #endif #else @@ -64,14 +70,16 @@ void OPPROTO glue(glue(op_rol, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, src; + int count; + target_long src; + count = T1 & SHIFT_MASK; if (count) { src = T0; T0 &= DATA_MASK; T0 = (T0 << count) | (T0 >> (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #else /* gcc 3.2 workaround. This is really a bug in gcc. */ asm volatile("" : : "r" (T0)); @@ -86,14 +94,16 @@ void OPPROTO glue(glue(op_rol, MEM_SUFFIX), _T0_T1_cc)(void) void OPPROTO glue(glue(op_ror, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, src; + int count; + target_long src; + count = T1 & SHIFT_MASK; if (count) { src = T0; T0 &= DATA_MASK; T0 = (T0 >> count) | (T0 << (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #else /* gcc 3.2 workaround. This is really a bug in gcc. */ asm volatile("" : : "r" (T0)); @@ -114,7 +124,7 @@ void OPPROTO glue(glue(op_rol, MEM_SUFFIX), _T0_T1)(void) T0 &= DATA_MASK; T0 = (T0 << count) | (T0 >> (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif } FORCE_RET(); @@ -128,7 +138,7 @@ void OPPROTO glue(glue(op_ror, MEM_SUFFIX), _T0_T1)(void) T0 &= DATA_MASK; T0 = (T0 >> count) | (T0 << (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif } FORCE_RET(); @@ -136,10 +146,11 @@ void OPPROTO glue(glue(op_ror, MEM_SUFFIX), _T0_T1)(void) void OPPROTO glue(glue(op_rcl, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, res, eflags; - unsigned int src; + int count, eflags; + target_ulong src; + target_long res; - count = T1 & 0x1f; + count = T1 & SHIFT1_MASK; #if DATA_BITS == 16 count = rclw_table[count]; #elif DATA_BITS == 8 @@ -154,7 +165,7 @@ void OPPROTO glue(glue(op_rcl, MEM_SUFFIX), _T0_T1_cc)(void) res |= T0 >> (DATA_BITS + 1 - count); T0 = res; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = (eflags & ~(CC_C | CC_O)) | (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | @@ -166,10 +177,11 @@ void OPPROTO glue(glue(op_rcl, MEM_SUFFIX), _T0_T1_cc)(void) void OPPROTO glue(glue(op_rcr, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, res, eflags; - unsigned int src; + int count, eflags; + target_ulong src; + target_long res; - count = T1 & 0x1f; + count = T1 & SHIFT1_MASK; #if DATA_BITS == 16 count = rclw_table[count]; #elif DATA_BITS == 8 @@ -184,7 +196,7 @@ void OPPROTO glue(glue(op_rcr, MEM_SUFFIX), _T0_T1_cc)(void) res |= T0 << (DATA_BITS + 1 - count); T0 = res; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = (eflags & ~(CC_C | CC_O)) | (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | @@ -196,13 +208,15 @@ void OPPROTO glue(glue(op_rcr, MEM_SUFFIX), _T0_T1_cc)(void) void OPPROTO glue(glue(op_shl, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, src; - count = T1 & 0x1f; + int count; + target_long src; + + count = T1 & SHIFT1_MASK; if (count) { src = (DATA_TYPE)T0 << (count - 1); T0 = T0 << count; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = src; CC_DST = T0; @@ -213,14 +227,16 @@ void OPPROTO glue(glue(op_shl, MEM_SUFFIX), _T0_T1_cc)(void) void OPPROTO glue(glue(op_shr, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, src; - count = T1 & 0x1f; + int count; + target_long src; + + count = T1 & SHIFT1_MASK; if (count) { T0 &= DATA_MASK; src = T0 >> (count - 1); T0 = T0 >> count; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = src; CC_DST = T0; @@ -231,14 +247,16 @@ void OPPROTO glue(glue(op_shr, MEM_SUFFIX), _T0_T1_cc)(void) void OPPROTO glue(glue(op_sar, MEM_SUFFIX), _T0_T1_cc)(void) { - int count, src; - count = T1 & 0x1f; + int count; + target_long src; + + count = T1 & SHIFT1_MASK; if (count) { src = (DATA_STYPE)T0; T0 = src >> count; src = src >> (count - 1); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = src; CC_DST = T0; @@ -262,7 +280,7 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_im_cc)(void) res |= T1 << (count - 16); T0 = res >> 16; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -282,7 +300,7 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_ECX_cc)(void) res |= T1 << (count - 16); T0 = res >> 16; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -304,7 +322,7 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_im_cc)(void) res |= T1 << (32 - count); T0 = res; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -325,7 +343,7 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_ECX_cc)(void) res |= T1 << (32 - count); T0 = res; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -335,17 +353,19 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_ECX_cc)(void) } #endif -#if DATA_BITS == 32 +#if DATA_BITS >= 32 void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_im_cc)(void) { - int count, tmp; + int count; + target_long tmp; + count = PARAM1; T0 &= DATA_MASK; T1 &= DATA_MASK; tmp = T0 << (count - 1); T0 = (T0 << count) | (T1 >> (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -353,15 +373,17 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_im_cc)(void) void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_ECX_cc)(void) { - int count, tmp; - count = ECX & 0x1f; + int count; + target_long tmp; + + count = ECX & SHIFT1_MASK; if (count) { T0 &= DATA_MASK; T1 &= DATA_MASK; tmp = T0 << (count - 1); T0 = (T0 << count) | (T1 >> (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -372,14 +394,16 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_ECX_cc)(void) void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_im_cc)(void) { - int count, tmp; + int count; + target_long tmp; + count = PARAM1; T0 &= DATA_MASK; T1 &= DATA_MASK; tmp = T0 >> (count - 1); T0 = (T0 >> count) | (T1 << (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -388,15 +412,17 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_im_cc)(void) void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_ECX_cc)(void) { - int count, tmp; - count = ECX & 0x1f; + int count; + target_long tmp; + + count = ECX & SHIFT1_MASK; if (count) { T0 &= DATA_MASK; T1 &= DATA_MASK; tmp = T0 >> (count - 1); T0 = (T0 >> count) | (T1 << (DATA_BITS - count)); #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = tmp; CC_DST = T0; @@ -414,11 +440,11 @@ void OPPROTO glue(glue(op_adc, MEM_SUFFIX), _T0_T1_cc)(void) cf = cc_table[CC_OP].compute_c(); T0 = T0 + T1 + cf; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = T1; CC_DST = T0; - CC_OP = CC_OP_ADDB + SHIFT + cf * 3; + CC_OP = CC_OP_ADDB + SHIFT + cf * 4; } void OPPROTO glue(glue(op_sbb, MEM_SUFFIX), _T0_T1_cc)(void) @@ -427,23 +453,23 @@ void OPPROTO glue(glue(op_sbb, MEM_SUFFIX), _T0_T1_cc)(void) cf = cc_table[CC_OP].compute_c(); T0 = T0 - T1 - cf; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif CC_SRC = T1; CC_DST = T0; - CC_OP = CC_OP_SUBB + SHIFT + cf * 3; + CC_OP = CC_OP_SUBB + SHIFT + cf * 4; } void OPPROTO glue(glue(op_cmpxchg, MEM_SUFFIX), _T0_T1_EAX_cc)(void) { - unsigned int src, dst; + target_ulong src, dst; src = T0; dst = EAX - T0; if ((DATA_TYPE)dst == 0) { T0 = T1; #ifdef MEM_WRITE - glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); + glue(st, MEM_SUFFIX)(A0, T0); #endif } else { EAX = (EAX & ~DATA_MASK) | (T0 & DATA_MASK); |