diff options
| author | UNIDY2002 <[email protected]> | 2022-06-02 10:23:39 +0800 |
|---|---|---|
| committer | UNIDY2002 <[email protected]> | 2022-06-02 10:28:37 +0800 |
| commit | 387d435ff5c91b59cc7498de0dd0ea6c43ae43c0 (patch) | |
| tree | 92f46c56d7e7d39dca4155b384230663a3eea634 | |
| parent | 88a3b9a29c031dbd86fe23b73e2c69e8a8f7162b (diff) | |
Fix incorrect implementation of pushing UIRRV
| -rw-r--r-- | target/i386/cpu.h | 1 | ||||
| -rw-r--r-- | target/i386/tcg/seg_helper.c | 9 | ||||
| -rw-r--r-- | target/i386/tcg/sysemu/misc_helper.c | 7 |
3 files changed, 6 insertions, 11 deletions
diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 4d31510580..95cc3eb1b2 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1604,6 +1604,7 @@ typedef struct CPUArchState { // 寄存器??? #endif // 改 ??? uint64_t uintr_rr; + uint64_t uintr_rrv; uint64_t uintr_handler; uint64_t uintr_stackadjust; uint64_t uintr_misc; diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index 990b041b2d..ff2b741259 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -877,7 +877,7 @@ void helper_rrnzero(CPUX86State *env){ // 改 PUSHQ(esp, temprsp); PUSHQ(esp, env->eflags); // PUSHQ(esp, cpu_compute_eflags(env)); PUSHQ(esp, env->eip); - PUSHQ(esp, env->uintr_rr & 0x3f); // // 64-bit push; upper 58 bits pushed as 0 + PUSHQ(esp, env->uintr_rrv); // 64-bit push; upper 58 bits pushed as 0 env->uintr_rr = 0; // clear rr env->regs[R_ESP] = esp; env->eflags &= ~(TF_MASK | RF_MASK); @@ -941,10 +941,10 @@ static void do_interrupt64(CPUX86State *env, int intno, int is_int, } //查看当前的权级 cpl = env->hflags & HF_CPL_MASK; - qemu_log("-|-| perv: %d \n", cpl); + // qemu_log("-|-| perv: %d \n", cpl); if(cpl != 3){ helper_clear_eoi(env); - qemu_log("not in user mode return\n"); + qemu_log("perv: %d not in user mode return\n", cpl); return; } int prot; @@ -955,7 +955,8 @@ static void do_interrupt64(CPUX86State *env, int intno, int is_int, upid.nc.status &= (~1); // clear on if(upid.puir != 0){ env->uintr_rr = upid.puir; - upid.puir = 0; // clear puir + env->uintr_rrv = 63 - __builtin_clzll(env->uintr_rr); + upid.puir -= (1 << env->uintr_rrv); // clear puir cpu_physical_memory_rw(upid_phyaddress, &upid, 16, true); // write back send = true; } diff --git a/target/i386/tcg/sysemu/misc_helper.c b/target/i386/tcg/sysemu/misc_helper.c index 93bfe2a69c..6042f96143 100644 --- a/target/i386/tcg/sysemu/misc_helper.c +++ b/target/i386/tcg/sysemu/misc_helper.c @@ -335,7 +335,6 @@ error: raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC()); } -static int rdcount = 0; void helper_rdmsr(CPUX86State *env) { X86CPU *x86_cpu = env_archcpu(env); @@ -412,12 +411,6 @@ void helper_rdmsr(CPUX86State *env) break; case MSR_IA32_UINTR_MISC: val = env->uintr_misc; - rdcount ++; - // qemu_log("qemu:rdmsr misc 0x%016lx eip: 0x%016lx\n",val,env->eip); - if(rdcount > 300){ - qemu_log("too many rdmisc exit\n"); - exit(2); - } break; case MSR_IA32_UINTR_PD: val = env->uintr_pd; |
