mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
use the TCG code generator
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3944 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
c896fe29d6
commit
57fec1fee9
35 changed files with 1098 additions and 2364 deletions
|
@ -181,8 +181,9 @@ void __hidden cpu_loop_exit(void);
|
|||
|
||||
void OPPROTO op_movl_eflags_T0(void);
|
||||
void OPPROTO op_movl_T0_eflags(void);
|
||||
void helper_divl_EAX_T0(void);
|
||||
void helper_idivl_EAX_T0(void);
|
||||
|
||||
#include "helper.h"
|
||||
|
||||
void helper_mulq_EAX_T0(void);
|
||||
void helper_imulq_EAX_T0(void);
|
||||
void helper_imulq_T0_T1(void);
|
||||
|
|
|
@ -1608,13 +1608,13 @@ int32_t idiv32(int64_t *q_ptr, int64_t num, int32_t den)
|
|||
}
|
||||
#endif
|
||||
|
||||
void helper_divl_EAX_T0(void)
|
||||
void helper_divl_EAX_T0(target_ulong t0)
|
||||
{
|
||||
unsigned int den, r;
|
||||
uint64_t num, q;
|
||||
|
||||
num = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32);
|
||||
den = T0;
|
||||
den = t0;
|
||||
if (den == 0) {
|
||||
raise_exception(EXCP00_DIVZ);
|
||||
}
|
||||
|
@ -1630,13 +1630,13 @@ void helper_divl_EAX_T0(void)
|
|||
EDX = (uint32_t)r;
|
||||
}
|
||||
|
||||
void helper_idivl_EAX_T0(void)
|
||||
void helper_idivl_EAX_T0(target_ulong t0)
|
||||
{
|
||||
int den, r;
|
||||
int64_t num, q;
|
||||
|
||||
num = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32);
|
||||
den = T0;
|
||||
den = t0;
|
||||
if (den == 0) {
|
||||
raise_exception(EXCP00_DIVZ);
|
||||
}
|
||||
|
|
4
target-i386/helper.h
Normal file
4
target-i386/helper.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#define TCG_HELPER_PROTO
|
||||
|
||||
void TCG_HELPER_PROTO helper_divl_EAX_T0(target_ulong t0);
|
||||
void TCG_HELPER_PROTO helper_idivl_EAX_T0(target_ulong t0);
|
270
target-i386/op.c
270
target-i386/op.c
|
@ -172,31 +172,6 @@ void OPPROTO op_testl_T0_T1_cc(void)
|
|||
|
||||
/* operations without flags */
|
||||
|
||||
void OPPROTO op_addl_T0_T1(void)
|
||||
{
|
||||
T0 += T1;
|
||||
}
|
||||
|
||||
void OPPROTO op_orl_T0_T1(void)
|
||||
{
|
||||
T0 |= T1;
|
||||
}
|
||||
|
||||
void OPPROTO op_andl_T0_T1(void)
|
||||
{
|
||||
T0 &= T1;
|
||||
}
|
||||
|
||||
void OPPROTO op_subl_T0_T1(void)
|
||||
{
|
||||
T0 -= T1;
|
||||
}
|
||||
|
||||
void OPPROTO op_xorl_T0_T1(void)
|
||||
{
|
||||
T0 ^= T1;
|
||||
}
|
||||
|
||||
void OPPROTO op_negl_T0(void)
|
||||
{
|
||||
T0 = -T0;
|
||||
|
@ -217,18 +192,6 @@ void OPPROTO op_notl_T0(void)
|
|||
T0 = ~T0;
|
||||
}
|
||||
|
||||
void OPPROTO op_bswapl_T0(void)
|
||||
{
|
||||
T0 = bswap32(T0);
|
||||
}
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
void OPPROTO op_bswapq_T0(void)
|
||||
{
|
||||
helper_bswapq_T0();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* multiply/divide */
|
||||
|
||||
/* XXX: add eflags optimizations */
|
||||
|
@ -399,16 +362,6 @@ void OPPROTO op_idivw_AX_T0(void)
|
|||
EDX = (EDX & ~0xffff) | r;
|
||||
}
|
||||
|
||||
void OPPROTO op_divl_EAX_T0(void)
|
||||
{
|
||||
helper_divl_EAX_T0();
|
||||
}
|
||||
|
||||
void OPPROTO op_idivl_EAX_T0(void)
|
||||
{
|
||||
helper_idivl_EAX_T0();
|
||||
}
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
void OPPROTO op_divq_EAX_T0(void)
|
||||
{
|
||||
|
@ -424,46 +377,6 @@ void OPPROTO op_idivq_EAX_T0(void)
|
|||
/* constant load & misc op */
|
||||
|
||||
/* XXX: consistent names */
|
||||
void OPPROTO op_movl_T0_imu(void)
|
||||
{
|
||||
T0 = (uint32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_T0_im(void)
|
||||
{
|
||||
T0 = (int32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_addl_T0_im(void)
|
||||
{
|
||||
T0 += PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_andl_T0_ffff(void)
|
||||
{
|
||||
T0 = T0 & 0xffff;
|
||||
}
|
||||
|
||||
void OPPROTO op_andl_T0_im(void)
|
||||
{
|
||||
T0 = T0 & PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_T0_T1(void)
|
||||
{
|
||||
T0 = T1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_T1_imu(void)
|
||||
{
|
||||
T1 = (uint32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_T1_im(void)
|
||||
{
|
||||
T1 = (int32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_addl_T1_im(void)
|
||||
{
|
||||
T1 += PARAM1;
|
||||
|
@ -474,26 +387,6 @@ void OPPROTO op_movl_T1_A0(void)
|
|||
T1 = A0;
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_A0_im(void)
|
||||
{
|
||||
A0 = (uint32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_addl_A0_im(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + PARAM1);
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_A0_seg(void)
|
||||
{
|
||||
A0 = (uint32_t)*(target_ulong *)((char *)env + PARAM1);
|
||||
}
|
||||
|
||||
void OPPROTO op_addl_A0_seg(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + *(target_ulong *)((char *)env + PARAM1));
|
||||
}
|
||||
|
||||
void OPPROTO op_addl_A0_AL(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + (EAX & 0xff));
|
||||
|
@ -523,46 +416,6 @@ typedef union UREG64 {
|
|||
|
||||
#ifdef TARGET_X86_64
|
||||
|
||||
void OPPROTO op_movq_T0_im64(void)
|
||||
{
|
||||
T0 = PARAMQ1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movq_T1_im64(void)
|
||||
{
|
||||
T1 = PARAMQ1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movq_A0_im(void)
|
||||
{
|
||||
A0 = (int32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movq_A0_im64(void)
|
||||
{
|
||||
A0 = PARAMQ1;
|
||||
}
|
||||
|
||||
void OPPROTO op_addq_A0_im(void)
|
||||
{
|
||||
A0 = (A0 + (int32_t)PARAM1);
|
||||
}
|
||||
|
||||
void OPPROTO op_addq_A0_im64(void)
|
||||
{
|
||||
A0 = (A0 + PARAMQ1);
|
||||
}
|
||||
|
||||
void OPPROTO op_movq_A0_seg(void)
|
||||
{
|
||||
A0 = *(target_ulong *)((char *)env + PARAM1);
|
||||
}
|
||||
|
||||
void OPPROTO op_addq_A0_seg(void)
|
||||
{
|
||||
A0 += *(target_ulong *)((char *)env + PARAM1);
|
||||
}
|
||||
|
||||
void OPPROTO op_addq_A0_AL(void)
|
||||
{
|
||||
A0 = (A0 + (EAX & 0xff));
|
||||
|
@ -570,11 +423,6 @@ void OPPROTO op_addq_A0_AL(void)
|
|||
|
||||
#endif
|
||||
|
||||
void OPPROTO op_andl_A0_ffff(void)
|
||||
{
|
||||
A0 = A0 & 0xffff;
|
||||
}
|
||||
|
||||
/* memory access */
|
||||
|
||||
#define MEMSUFFIX _raw
|
||||
|
@ -588,30 +436,6 @@ void OPPROTO op_andl_A0_ffff(void)
|
|||
#include "ops_mem.h"
|
||||
#endif
|
||||
|
||||
/* indirect jump */
|
||||
|
||||
void OPPROTO op_jmp_T0(void)
|
||||
{
|
||||
EIP = T0;
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_eip_im(void)
|
||||
{
|
||||
EIP = (uint32_t)PARAM1;
|
||||
}
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
void OPPROTO op_movq_eip_im(void)
|
||||
{
|
||||
EIP = (int32_t)PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_movq_eip_im64(void)
|
||||
{
|
||||
EIP = PARAMQ1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void OPPROTO op_hlt(void)
|
||||
{
|
||||
helper_hlt();
|
||||
|
@ -735,16 +559,6 @@ void OPPROTO op_single_step(void)
|
|||
helper_single_step();
|
||||
}
|
||||
|
||||
void OPPROTO op_movl_T0_0(void)
|
||||
{
|
||||
T0 = 0;
|
||||
}
|
||||
|
||||
void OPPROTO op_exit_tb(void)
|
||||
{
|
||||
EXIT_TB();
|
||||
}
|
||||
|
||||
/* multiple size ops */
|
||||
|
||||
#define ldul ldl
|
||||
|
@ -879,75 +693,6 @@ void OPPROTO op_decq_ECX(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* push/pop utils */
|
||||
|
||||
void op_addl_A0_SS(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + env->segs[R_SS].base);
|
||||
}
|
||||
|
||||
void op_subl_A0_2(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 - 2);
|
||||
}
|
||||
|
||||
void op_subl_A0_4(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 - 4);
|
||||
}
|
||||
|
||||
void op_addl_ESP_4(void)
|
||||
{
|
||||
ESP = (uint32_t)(ESP + 4);
|
||||
}
|
||||
|
||||
void op_addl_ESP_2(void)
|
||||
{
|
||||
ESP = (uint32_t)(ESP + 2);
|
||||
}
|
||||
|
||||
void op_addw_ESP_4(void)
|
||||
{
|
||||
ESP = (ESP & ~0xffff) | ((ESP + 4) & 0xffff);
|
||||
}
|
||||
|
||||
void op_addw_ESP_2(void)
|
||||
{
|
||||
ESP = (ESP & ~0xffff) | ((ESP + 2) & 0xffff);
|
||||
}
|
||||
|
||||
void op_addl_ESP_im(void)
|
||||
{
|
||||
ESP = (uint32_t)(ESP + PARAM1);
|
||||
}
|
||||
|
||||
void op_addw_ESP_im(void)
|
||||
{
|
||||
ESP = (ESP & ~0xffff) | ((ESP + PARAM1) & 0xffff);
|
||||
}
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
void op_subq_A0_2(void)
|
||||
{
|
||||
A0 -= 2;
|
||||
}
|
||||
|
||||
void op_subq_A0_8(void)
|
||||
{
|
||||
A0 -= 8;
|
||||
}
|
||||
|
||||
void op_addq_ESP_8(void)
|
||||
{
|
||||
ESP += 8;
|
||||
}
|
||||
|
||||
void op_addq_ESP_im(void)
|
||||
{
|
||||
ESP += PARAM1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void OPPROTO op_rdtsc(void)
|
||||
{
|
||||
helper_rdtsc();
|
||||
|
@ -1362,16 +1107,6 @@ void OPPROTO op_clts(void)
|
|||
|
||||
/* flags handling */
|
||||
|
||||
void OPPROTO op_goto_tb0(void)
|
||||
{
|
||||
GOTO_TB(op_goto_tb0, PARAM1, 0);
|
||||
}
|
||||
|
||||
void OPPROTO op_goto_tb1(void)
|
||||
{
|
||||
GOTO_TB(op_goto_tb1, PARAM1, 1);
|
||||
}
|
||||
|
||||
void OPPROTO op_jmp_label(void)
|
||||
{
|
||||
GOTO_LABEL_PARAM(1);
|
||||
|
@ -1451,11 +1186,6 @@ void OPPROTO op_xor_T0_1(void)
|
|||
T0 ^= 1;
|
||||
}
|
||||
|
||||
void OPPROTO op_set_cc_op(void)
|
||||
{
|
||||
CC_OP = PARAM1;
|
||||
}
|
||||
|
||||
void OPPROTO op_mov_T0_cc(void)
|
||||
{
|
||||
T0 = cc_table[CC_OP].compute_all();
|
||||
|
|
|
@ -18,110 +18,6 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
void OPPROTO glue(op_movl_A0,REGNAME)(void)
|
||||
{
|
||||
A0 = (uint32_t)REG;
|
||||
}
|
||||
|
||||
void OPPROTO glue(op_addl_A0,REGNAME)(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + REG);
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_addl_A0,REGNAME),_s1)(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + (REG << 1));
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_addl_A0,REGNAME),_s2)(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + (REG << 2));
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_addl_A0,REGNAME),_s3)(void)
|
||||
{
|
||||
A0 = (uint32_t)(A0 + (REG << 3));
|
||||
}
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
void OPPROTO glue(op_movq_A0,REGNAME)(void)
|
||||
{
|
||||
A0 = REG;
|
||||
}
|
||||
|
||||
void OPPROTO glue(op_addq_A0,REGNAME)(void)
|
||||
{
|
||||
A0 = (A0 + REG);
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_addq_A0,REGNAME),_s1)(void)
|
||||
{
|
||||
A0 = (A0 + (REG << 1));
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_addq_A0,REGNAME),_s2)(void)
|
||||
{
|
||||
A0 = (A0 + (REG << 2));
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_addq_A0,REGNAME),_s3)(void)
|
||||
{
|
||||
A0 = (A0 + (REG << 3));
|
||||
}
|
||||
#endif
|
||||
|
||||
void OPPROTO glue(op_movl_T0,REGNAME)(void)
|
||||
{
|
||||
T0 = REG;
|
||||
}
|
||||
|
||||
void OPPROTO glue(op_movl_T1,REGNAME)(void)
|
||||
{
|
||||
T1 = REG;
|
||||
}
|
||||
|
||||
void OPPROTO glue(op_movh_T0,REGNAME)(void)
|
||||
{
|
||||
T0 = REG >> 8;
|
||||
}
|
||||
|
||||
void OPPROTO glue(op_movh_T1,REGNAME)(void)
|
||||
{
|
||||
T1 = REG >> 8;
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_movl,REGNAME),_T0)(void)
|
||||
{
|
||||
REG = (uint32_t)T0;
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_movl,REGNAME),_T1)(void)
|
||||
{
|
||||
REG = (uint32_t)T1;
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_movl,REGNAME),_A0)(void)
|
||||
{
|
||||
REG = (uint32_t)A0;
|
||||
}
|
||||
|
||||
#ifdef TARGET_X86_64
|
||||
void OPPROTO glue(glue(op_movq,REGNAME),_T0)(void)
|
||||
{
|
||||
REG = T0;
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_movq,REGNAME),_T1)(void)
|
||||
{
|
||||
REG = T1;
|
||||
}
|
||||
|
||||
void OPPROTO glue(glue(op_movq,REGNAME),_A0)(void)
|
||||
{
|
||||
REG = A0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* mov T1 to REG if T0 is true */
|
||||
void OPPROTO glue(glue(op_cmovw,REGNAME),_T1_T0)(void)
|
||||
{
|
||||
|
@ -132,8 +28,15 @@ void OPPROTO glue(glue(op_cmovw,REGNAME),_T1_T0)(void)
|
|||
|
||||
void OPPROTO glue(glue(op_cmovl,REGNAME),_T1_T0)(void)
|
||||
{
|
||||
#ifdef TARGET_X86_64
|
||||
if (T0)
|
||||
REG = (uint32_t)T1;
|
||||
else
|
||||
REG = (uint32_t)REG;
|
||||
#else
|
||||
if (T0)
|
||||
REG = (uint32_t)T1;
|
||||
#endif
|
||||
FORCE_RET();
|
||||
}
|
||||
|
||||
|
@ -145,46 +48,3 @@ void OPPROTO glue(glue(op_cmovq,REGNAME),_T1_T0)(void)
|
|||
FORCE_RET();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NOTE: T0 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movw,REGNAME),_T0)(void)
|
||||
{
|
||||
REG = (REG & ~0xffff) | (T0 & 0xffff);
|
||||
}
|
||||
|
||||
/* NOTE: T0 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movw,REGNAME),_T1)(void)
|
||||
{
|
||||
REG = (REG & ~0xffff) | (T1 & 0xffff);
|
||||
}
|
||||
|
||||
/* NOTE: A0 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movw,REGNAME),_A0)(void)
|
||||
{
|
||||
REG = (REG & ~0xffff) | (A0 & 0xffff);
|
||||
}
|
||||
|
||||
/* NOTE: T0 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movb,REGNAME),_T0)(void)
|
||||
{
|
||||
REG = (REG & ~0xff) | (T0 & 0xff);
|
||||
}
|
||||
|
||||
/* NOTE: T0 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movh,REGNAME),_T0)(void)
|
||||
{
|
||||
REG = (REG & ~0xff00) | ((T0 & 0xff) << 8);
|
||||
}
|
||||
|
||||
/* NOTE: T1 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movb,REGNAME),_T1)(void)
|
||||
{
|
||||
REG = (REG & ~0xff) | (T1 & 0xff);
|
||||
}
|
||||
|
||||
/* NOTE: T1 high order bits are ignored */
|
||||
void OPPROTO glue(glue(op_movh,REGNAME),_T1)(void)
|
||||
{
|
||||
REG = (REG & ~0xff00) | ((T1 & 0xff) << 8);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue