Skip to content

Commit a78d0ea

Browse files
liguangblueswirl
liguang
authored andcommitted
target-i386/helper: remove EIP macro
Signed-off-by: liguang <[email protected]> Reviewed-by: Andreas Färber <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Blue Swirl <[email protected]>
1 parent cf75c59 commit a78d0ea

File tree

5 files changed

+23
-25
lines changed

5 files changed

+23
-25
lines changed

target-i386/cpu.h

-2
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,6 @@ static inline int cpu_mmu_index (CPUX86State *env)
11011101
? MMU_KSMAP_IDX : MMU_KERNEL_IDX;
11021102
}
11031103

1104-
#undef EIP
1105-
#define EIP (env->eip)
11061104
#define DF (env->df)
11071105

11081106
#define CC_DST (env->cc_dst)

target-i386/excp_helper.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int check_exception(CPUX86State *env, int intno, int *error_code)
8787
/*
8888
* Signal an interruption. It is executed in the main CPU loop.
8989
* is_int is TRUE if coming from the int instruction. next_eip is the
90-
* EIP value AFTER the interrupt instruction. It is only relevant if
90+
* env->eip value AFTER the interrupt instruction. It is only relevant if
9191
* is_int is TRUE.
9292
*/
9393
static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno,

target-i386/misc_helper.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ void helper_hlt(CPUX86State *env, int next_eip_addend)
569569
X86CPU *cpu = x86_env_get_cpu(env);
570570

571571
cpu_svm_check_intercept_param(env, SVM_EXIT_HLT, 0);
572-
EIP += next_eip_addend;
572+
env->eip += next_eip_addend;
573573

574574
do_hlt(cpu);
575575
}
@@ -592,7 +592,7 @@ void helper_mwait(CPUX86State *env, int next_eip_addend)
592592
raise_exception(env, EXCP0D_GPF);
593593
}
594594
cpu_svm_check_intercept_param(env, SVM_EXIT_MWAIT, 0);
595-
EIP += next_eip_addend;
595+
env->eip += next_eip_addend;
596596

597597
cpu = x86_env_get_cpu(env);
598598
cs = CPU(cpu);

target-i386/seg_helper.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static void switch_tss(CPUX86State *env, int tss_selector,
457457
tss_load_seg(env, R_GS, new_segs[R_GS]);
458458
}
459459

460-
/* check that EIP is in the CS segment limits */
460+
/* check that env->eip is in the CS segment limits */
461461
if (new_eip > env->segs[R_CS].limit) {
462462
/* XXX: different exception if CALL? */
463463
raise_exception_err(env, EXCP0D_GPF, 0);
@@ -1122,7 +1122,7 @@ static void do_interrupt_user(CPUX86State *env, int intno, int is_int,
11221122
exiting the emulation with the suitable exception and error
11231123
code */
11241124
if (is_int) {
1125-
EIP = next_eip;
1125+
env->eip = next_eip;
11261126
}
11271127
}
11281128

@@ -1157,7 +1157,7 @@ static void handle_even_inj(CPUX86State *env, int intno, int is_int,
11571157

11581158
/*
11591159
* Begin execution of an interruption. is_int is TRUE if coming from
1160-
* the int instruction. next_eip is the EIP value AFTER the interrupt
1160+
* the int instruction. next_eip is the env->eip value AFTER the interrupt
11611161
* instruction. It is only relevant if is_int is TRUE.
11621162
*/
11631163
static void do_interrupt_all(CPUX86State *env, int intno, int is_int,
@@ -1171,8 +1171,8 @@ static void do_interrupt_all(CPUX86State *env, int intno, int is_int,
11711171
" pc=" TARGET_FMT_lx " SP=%04x:" TARGET_FMT_lx,
11721172
count, intno, error_code, is_int,
11731173
env->hflags & HF_CPL_MASK,
1174-
env->segs[R_CS].selector, EIP,
1175-
(int)env->segs[R_CS].base + EIP,
1174+
env->segs[R_CS].selector, env->eip,
1175+
(int)env->segs[R_CS].base + env->eip,
11761176
env->segs[R_SS].selector, env->regs[R_ESP]);
11771177
if (intno == 0x0e) {
11781178
qemu_log(" CR2=" TARGET_FMT_lx, env->cr[2]);
@@ -1584,7 +1584,7 @@ void helper_ljmp_protected(CPUX86State *env, int new_cs, target_ulong new_eip,
15841584
}
15851585
cpu_x86_load_seg_cache(env, R_CS, (new_cs & 0xfffc) | cpl,
15861586
get_seg_base(e1, e2), limit, e2);
1587-
EIP = new_eip;
1587+
env->eip = new_eip;
15881588
} else {
15891589
/* jump to call or task gate */
15901590
dpl = (e2 >> DESC_DPL_SHIFT) & 3;
@@ -1637,7 +1637,7 @@ void helper_ljmp_protected(CPUX86State *env, int new_cs, target_ulong new_eip,
16371637
}
16381638
cpu_x86_load_seg_cache(env, R_CS, (gate_cs & 0xfffc) | cpl,
16391639
get_seg_base(e1, e2), limit, e2);
1640-
EIP = new_eip;
1640+
env->eip = new_eip;
16411641
break;
16421642
default:
16431643
raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc);
@@ -1731,7 +1731,7 @@ void helper_lcall_protected(CPUX86State *env, int new_cs, target_ulong new_eip,
17311731
cpu_x86_load_seg_cache(env, R_CS, (new_cs & 0xfffc) | cpl,
17321732
get_seg_base(e1, e2),
17331733
get_seg_limit(e1, e2), e2);
1734-
EIP = new_eip;
1734+
env->eip = new_eip;
17351735
} else
17361736
#endif
17371737
{
@@ -1754,7 +1754,7 @@ void helper_lcall_protected(CPUX86State *env, int new_cs, target_ulong new_eip,
17541754
SET_ESP(sp, sp_mask);
17551755
cpu_x86_load_seg_cache(env, R_CS, (new_cs & 0xfffc) | cpl,
17561756
get_seg_base(e1, e2), limit, e2);
1757-
EIP = new_eip;
1757+
env->eip = new_eip;
17581758
}
17591759
} else {
17601760
/* check gate type */
@@ -1895,7 +1895,7 @@ void helper_lcall_protected(CPUX86State *env, int new_cs, target_ulong new_eip,
18951895
e2);
18961896
cpu_x86_set_cpl(env, dpl);
18971897
SET_ESP(sp, sp_mask);
1898-
EIP = offset;
1898+
env->eip = offset;
18991899
}
19001900
}
19011901

@@ -2251,7 +2251,7 @@ void helper_sysenter(CPUX86State *env)
22512251
DESC_S_MASK |
22522252
DESC_W_MASK | DESC_A_MASK);
22532253
env->regs[R_ESP] = env->sysenter_esp;
2254-
EIP = env->sysenter_eip;
2254+
env->eip = env->sysenter_eip;
22552255
}
22562256

22572257
void helper_sysexit(CPUX86State *env, int dflag)
@@ -2291,7 +2291,7 @@ void helper_sysexit(CPUX86State *env, int dflag)
22912291
DESC_W_MASK | DESC_A_MASK);
22922292
}
22932293
env->regs[R_ESP] = env->regs[R_ECX];
2294-
EIP = env->regs[R_EDX];
2294+
env->eip = env->regs[R_EDX];
22952295
}
22962296

22972297
target_ulong helper_lsl(CPUX86State *env, target_ulong selector1)

target-i386/svm_helper.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
170170
&env->segs[R_DS]);
171171

172172
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rip),
173-
EIP + next_eip_addend);
173+
env->eip + next_eip_addend);
174174
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rsp), env->regs[R_ESP]);
175175
stq_phys(env->vm_hsave + offsetof(struct vmcb, save.rax), env->regs[R_EAX]);
176176

@@ -248,8 +248,8 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
248248
svm_load_seg_cache(env, env->vm_vmcb + offsetof(struct vmcb, save.ds),
249249
R_DS);
250250

251-
EIP = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rip));
252-
env->eip = EIP;
251+
env->eip = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rip));
252+
env->eip = env->eip;
253253
env->regs[R_ESP] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rsp));
254254
env->regs[R_EAX] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.rax));
255255
env->dr[7] = ldq_phys(env->vm_vmcb + offsetof(struct vmcb, save.dr7));
@@ -302,7 +302,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
302302
env->exception_index = EXCP02_NMI;
303303
env->error_code = event_inj_err;
304304
env->exception_is_int = 0;
305-
env->exception_next_eip = EIP;
305+
env->exception_next_eip = env->eip;
306306
qemu_log_mask(CPU_LOG_TB_IN_ASM, "NMI");
307307
cpu_loop_exit(env);
308308
break;
@@ -318,7 +318,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
318318
env->exception_index = vector;
319319
env->error_code = event_inj_err;
320320
env->exception_is_int = 1;
321-
env->exception_next_eip = EIP;
321+
env->exception_next_eip = env->eip;
322322
qemu_log_mask(CPU_LOG_TB_IN_ASM, "SOFT");
323323
cpu_loop_exit(env);
324324
break;
@@ -539,7 +539,7 @@ void helper_svm_check_io(CPUX86State *env, uint32_t port, uint32_t param,
539539
uint16_t mask = (1 << ((param >> 4) & 7)) - 1;
540540

541541
if (lduw_phys(addr + port / 8) & (mask << (port & 7))) {
542-
/* next EIP */
542+
/* next env->eip */
543543
stq_phys(env->vm_vmcb + offsetof(struct vmcb, control.exit_info_2),
544544
env->eip + next_eip_addend);
545545
helper_vmexit(env, SVM_EXIT_IOIO, param | (port << 16));
@@ -558,7 +558,7 @@ void helper_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1)
558558
exit_code, exit_info_1,
559559
ldq_phys(env->vm_vmcb + offsetof(struct vmcb,
560560
control.exit_info_2)),
561-
EIP);
561+
env->eip);
562562

563563
if (env->hflags & HF_INHIBIT_IRQ_MASK) {
564564
stl_phys(env->vm_vmcb + offsetof(struct vmcb, control.int_state),
@@ -657,7 +657,7 @@ void helper_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1)
657657
svm_load_seg_cache(env, env->vm_hsave + offsetof(struct vmcb, save.ds),
658658
R_DS);
659659

660-
EIP = ldq_phys(env->vm_hsave + offsetof(struct vmcb, save.rip));
660+
env->eip = ldq_phys(env->vm_hsave + offsetof(struct vmcb, save.rip));
661661
env->regs[R_ESP] = ldq_phys(env->vm_hsave + offsetof(struct vmcb, save.rsp));
662662
env->regs[R_EAX] = ldq_phys(env->vm_hsave + offsetof(struct vmcb, save.rax));
663663

0 commit comments

Comments
 (0)