Changeset 105094 in vbox
- Timestamp:
- Jul 2, 2024 9:33:52 AM (10 months ago)
- svn:sync-xref-src-repo-rev:
- 163715
- Location:
- trunk/src/VBox
- Files:
-
- 11 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r105072 r105094 3254 3254 3255 3255 /* 3256 * Hack alert! Convert incoming debug events to slient on Intel.3257 * See bs3-cpu-weird-1.3258 */3259 if ( !(fFlags & IEM_XCPT_FLAGS_T_SOFT_INT)3260 || !(pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK_NONSILENT)3261 || !IEM_IS_GUEST_CPU_INTEL(pVCpu))3262 { /* ignore */ }3263 else3264 {3265 Log(("iemRaiseXcptOrIntInProtMode: Converting pending %#x debug events to a silent one (intel hack)\n",3266 u8Vector, pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK));3267 pVCpu->cpum.GstCtx.eflags.uBoth = (pVCpu->cpum.GstCtx.eflags.uBoth & ~CPUMCTX_DBG_HIT_DRX_MASK)3268 | CPUMCTX_DBG_HIT_DRX_SILENT;3269 }3270 3271 /*3272 3256 * Read the IDT entry. 3273 3257 */ … … 3769 3753 { 3770 3754 IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_XCPT_MASK); 3771 3772 /*3773 * Hack alert! Convert incoming debug events to slient on Intel.3774 * See bs3-cpu-weird-1.3775 */3776 if ( !(fFlags & IEM_XCPT_FLAGS_T_SOFT_INT)3777 || !(pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK_NONSILENT)3778 || !IEM_IS_GUEST_CPU_INTEL(pVCpu))3779 { /* ignore */ }3780 else3781 {3782 Log(("iemRaiseXcptOrIntInLongMode: Converting pending %#x debug events to a silent one (intel hack)\n",3783 u8Vector, pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK));3784 pVCpu->cpum.GstCtx.eflags.uBoth = (pVCpu->cpum.GstCtx.eflags.uBoth & ~CPUMCTX_DBG_HIT_DRX_MASK)3785 | CPUMCTX_DBG_HIT_DRX_SILENT;3786 }3787 3755 3788 3756 /* … … 4323 4291 if (fFlags & IEM_XCPT_FLAGS_CR2) 4324 4292 EMHistoryAddExit(pVCpu, EMEXIT_MAKE_FT(EMEXIT_F_KIND_XCPT, u8Vector | EMEXIT_F_XCPT_CR2), uCr2, uTimestamp); 4293 } 4294 4295 /* 4296 * Hack alert! Convert incoming debug events to slient on Intel. 4297 * See the dbg+inhibit+ringxfer test in bs3-cpu-weird-1. 4298 */ 4299 if ( !(fFlags & IEM_XCPT_FLAGS_T_SOFT_INT) 4300 || !(pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK_NONSILENT) 4301 || !IEM_IS_GUEST_CPU_INTEL(pVCpu)) 4302 { /* ignore */ } 4303 else 4304 { 4305 Log(("iemRaiseXcptOrIntInLongMode: Converting pending %#x debug events to a silent one (intel hack)\n", 4306 u8Vector, pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK)); 4307 pVCpu->cpum.GstCtx.eflags.uBoth = (pVCpu->cpum.GstCtx.eflags.uBoth & ~CPUMCTX_DBG_HIT_DRX_MASK) 4308 | CPUMCTX_DBG_HIT_DRX_SILENT; 4325 4309 } 4326 4310 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp
r105072 r105094 3992 3992 IEM_CIMPL_DEF_0(iemCImpl_syscall) 3993 3993 { 3994 /** @todo hack, LOADALL should be decoded as such on a 286. */ 3995 if (RT_UNLIKELY(pVCpu->iem.s.uTargetCpu == IEMTARGETCPU_286)) 3996 return iemCImpl_loadall286(pVCpu, cbInstr); 3994 3997 3995 3998 3996 /* … … 4013 4011 return iemRaiseGeneralProtectionFault0(pVCpu); 4014 4012 } 4015 if (IEM_IS_GUEST_CPU_INTEL(pVCpu) && !CPUMIsGuestInLongModeEx(IEM_GET_CTX(pVCpu))) 4016 { 4017 Log(("syscall: Only available in long mode on intel -> #UD\n")); 4013 if ( IEM_IS_GUEST_CPU_INTEL(pVCpu) 4014 && !IEM_IS_64BIT_CODE(pVCpu)) //&& !CPUMIsGuestInLongModeEx(IEM_GET_CTX(pVCpu))) 4015 { 4016 Log(("syscall: Only available in 64-bit mode on intel -> #UD\n")); 4018 4017 return iemRaiseUndefinedOpcode(pVCpu); 4019 4018 } … … 4032 4031 } 4033 4032 4034 /* Long mode and legacy mode differs. */ 4033 /* 4034 * Hack alert! Convert incoming debug events to slient on Intel. 4035 * See the dbg+inhibit+ringxfer test in bs3-cpu-weird-1. 4036 */ 4037 if ( !(pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK_NONSILENT) 4038 || !IEM_IS_GUEST_CPU_INTEL(pVCpu)) 4039 { /* ignore */ } 4040 else 4041 { 4042 Log(("iemCImpl_syscall: Converting pending debug events to a silent one (intel hack)\n", 4043 pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_DBG_HIT_DRX_MASK)); 4044 pVCpu->cpum.GstCtx.eflags.uBoth = (pVCpu->cpum.GstCtx.eflags.uBoth & ~CPUMCTX_DBG_HIT_DRX_MASK) 4045 | CPUMCTX_DBG_HIT_DRX_SILENT; 4046 } 4047 4048 /* 4049 * Long mode and legacy mode differs. 4050 */ 4035 4051 if (CPUMIsGuestInLongModeEx(IEM_GET_CTX(pVCpu))) 4036 4052 { … … 4096 4112 IEM_FLUSH_PREFETCH_HEAVY(pVCpu, cbInstr); 4097 4113 4098 /** @todo single step */ 4099 return VINF_SUCCESS; 4114 /* 4115 * Handle debug events. 4116 * If TF isn't masked, we're supposed to raise a single step #DB. 4117 */ 4118 return iemRegFinishClearingRF(pVCpu, VINF_SUCCESS); 4100 4119 } 4101 4120 -
trunk/src/VBox/VMM/VMMAll/IEMAllInstTwoByte0f.cpp.h
r104521 r105094 1857 1857 FNIEMOP_DEF(iemOp_syscall) 1858 1858 { 1859 IEMOP_MNEMONIC(syscall, "syscall"); /** @todo 286 LOADALL */ 1860 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 1861 /** @todo r=aeichner Clobbers cr0 only if this is a 286 LOADALL instruction. */ 1862 IEM_MC_DEFER_TO_CIMPL_0_RET(IEM_CIMPL_F_BRANCH_INDIRECT | IEM_CIMPL_F_BRANCH_FAR | IEM_CIMPL_F_BRANCH_STACK_FAR 1863 | IEM_CIMPL_F_MODE | IEM_CIMPL_F_RFLAGS | IEM_CIMPL_F_END_TB, 1864 RT_BIT_64(kIemNativeGstReg_Cr0), iemCImpl_syscall); 1859 if (RT_LIKELY(pVCpu->iem.s.uTargetCpu != IEMTARGETCPU_286)) 1860 { 1861 IEMOP_MNEMONIC(syscall, "syscall"); 1862 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 1863 IEM_MC_DEFER_TO_CIMPL_0_RET(IEM_CIMPL_F_BRANCH_INDIRECT | IEM_CIMPL_F_BRANCH_FAR | IEM_CIMPL_F_BRANCH_STACK_FAR 1864 | IEM_CIMPL_F_MODE | IEM_CIMPL_F_RFLAGS | IEM_CIMPL_F_END_TB, 0, iemCImpl_syscall); 1865 } 1866 else 1867 { 1868 IEMOP_MNEMONIC(loadall286, "loadall286"); 1869 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 1870 IEM_MC_DEFER_TO_CIMPL_0_RET(IEM_CIMPL_F_BRANCH_INDIRECT | IEM_CIMPL_F_BRANCH_FAR | IEM_CIMPL_F_BRANCH_STACK_FAR 1871 | IEM_CIMPL_F_MODE | IEM_CIMPL_F_RFLAGS | IEM_CIMPL_F_END_TB, 1872 RT_BIT_64(kIemNativeGstReg_Cr0), iemCImpl_loadall286); 1873 } 1865 1874 } 1866 1875 -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-weird-1-template.mac
r102789 r105094 55 55 56 56 57 %if TMPL_BITS != 64 58 57 59 ; 58 60 ; Inhibited int 80h. 59 61 ; 60 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedInt80, BS3_PBC_NEAR 61 ; Load SS from stack. This instruction causes fusing. 62 %if TMPL_BITS != 64 62 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedPopSsInt80, BS3_PBC_NEAR 63 ; Load SS from stack. This instruction causes fusing. 63 64 pop ss 65 ; The ring transition instruction. 66 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedPopSsInt80_int80), , 0 67 int 80h 68 ; We shouldn't get here! 69 .ud2_again: 70 ud2 71 jmp .ud2_again 72 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedPopSsInt80 73 74 ; 75 ; Inhibited int 3. 76 ; 77 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedPopSsInt3, BS3_PBC_NEAR 78 ; Load SS from stack. This instruction causes fusing. 79 pop ss 80 ; The ring transition instruction. 81 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedPopSsInt3_int3), , 0 82 int 3 83 ; We shouldn't get here! 84 .ud2_again: 85 ud2 86 jmp .ud2_again 87 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedPopSsInt3_int3) == 2) 88 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedPopSsInt3 89 90 91 ; 92 ; Inhibited int3. 93 ; 94 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedPopSsBp, BS3_PBC_NEAR 95 ; Load SS from stack. This instruction causes fusing. 96 pop ss 97 ; The ring transition instruction. 98 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedPopSsBp_int3), , 0 99 int3 100 ; We shouldn't get here! 101 .ud2_again: 102 ud2 103 jmp .ud2_again 104 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedPopSsBp_int3) == 1) 105 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedPopSsBp 106 107 %endif ; TMPL_BITS != 64 108 109 110 ; 111 ; Inhibited int 80h. 112 ; 113 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedMovSsInt80, BS3_PBC_NEAR 114 ; Load SS from stack. This instruction causes fusing. 115 mov ss, [xBP] 116 ; The ring transition instruction. 117 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsInt80_int80), , 0 118 int 80h 119 ; We shouldn't get here! 120 .ud2_again: 121 ud2 122 jmp .ud2_again 123 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedMovSsInt80 124 125 ; 126 ; Inhibited int 3. 127 ; 128 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedMovSsInt3, BS3_PBC_NEAR 129 ; Load SS from stack. This instruction causes fusing. 130 mov ss, [xBP] 131 ; The ring transition instruction. 132 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsInt3_int3), , 0 133 int 3 134 ; We shouldn't get here! 135 .ud2_again: 136 ud2 137 jmp .ud2_again 138 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsInt3_int3) == 2) 139 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedMovSsInt3 140 141 142 ; 143 ; Inhibited int3. 144 ; 145 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedMovSsBp, BS3_PBC_NEAR 146 ; Load SS from stack. This instruction causes fusing. 147 mov ss, [xBP] 148 ; The ring transition instruction. 149 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsBp_int3), , 0 150 int3 151 ; We shouldn't get here! 152 .ud2_again: 153 ud2 154 jmp .ud2_again 155 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsBp_int3) == 1) 156 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedMovSsBp 157 158 159 ; 160 ; Inhibited syscall. 161 ; 162 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedMovSsSyscall, BS3_PBC_NEAR 163 ; Load SS from stack. This instruction causes fusing. 164 %if 1 165 mov ss, [xBP] 64 166 %else 65 mov ss, [rsp] 167 pushf 168 or word [xBP - xCB], X86_EFL_TF 169 popf 66 170 %endif 67 171 ; The ring transition instruction. 68 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedInt80_int80), , 0 69 int 80h 70 ; We shouldn't get here! 71 .ud2_again: 72 ud2 73 jmp .ud2_again 74 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedInt80 75 76 ; 77 ; Inhibited int 3. 78 ; 79 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedInt3, BS3_PBC_NEAR 80 ; Load SS from stack. This instruction causes fusing. 81 %if TMPL_BITS != 64 82 pop ss 83 %else 84 mov ss, [rsp] 85 %endif 86 ; The ring transition instruction. 87 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedInt3_int3), , 0 88 int 3 89 ; We shouldn't get here! 90 .ud2_again: 91 ud2 92 jmp .ud2_again 93 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedInt3_int3) == 2) 94 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedInt3 95 96 97 ; 98 ; Inhibited int3. 99 ; 100 BS3_PROC_BEGIN_CMN bs3CpuWeird1_InhibitedBp, BS3_PBC_NEAR 101 ; Load SS from stack. This instruction causes fusing. 102 %if TMPL_BITS != 64 103 pop ss 104 %else 105 mov ss, [rsp] 106 %endif 107 ; The ring transition instruction. 108 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedBp_int3), , 0 109 int3 110 ; We shouldn't get here! 111 .ud2_again: 112 ud2 113 jmp .ud2_again 114 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedBp_int3) == 1) 115 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedBp 172 BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsSyscall_syscall), , 0 173 syscall 174 ; We shouldn't get here! 175 .ud2_again: 176 ud2 177 jmp .ud2_again 178 AssertCompile(.ud2_again - BS3_CMN_NM(bs3CpuWeird1_InhibitedMovSsSyscall_syscall) == 2) 179 BS3_PROC_END_CMN bs3CpuWeird1_InhibitedMovSsSyscall 116 180 117 181 -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-weird-1-x0.c
r105072 r105094 57 57 } while (0) 58 58 59 #define BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(a_Name, a_Label) \ 60 extern FNBS3FAR a_Name##_c16, a_Name##_##a_Label##_c16; \ 61 extern FNBS3FAR a_Name##_c32, a_Name##_##a_Label##_c32; \ 62 extern FNBS3FAR a_Name##_c64, a_Name##_##a_Label##_c64 63 59 64 60 65 /********************************************************************************************************************************* 61 66 * External Symbols * 62 67 *********************************************************************************************************************************/ 63 extern FNBS3FAR bs3CpuWeird1_InhibitedInt80_c16; 64 extern FNBS3FAR bs3CpuWeird1_InhibitedInt80_c32; 65 extern FNBS3FAR bs3CpuWeird1_InhibitedInt80_c64; 66 extern FNBS3FAR bs3CpuWeird1_InhibitedInt80_int80_c16; 67 extern FNBS3FAR bs3CpuWeird1_InhibitedInt80_int80_c32; 68 extern FNBS3FAR bs3CpuWeird1_InhibitedInt80_int80_c64; 69 70 extern FNBS3FAR bs3CpuWeird1_InhibitedInt3_c16; 71 extern FNBS3FAR bs3CpuWeird1_InhibitedInt3_c32; 72 extern FNBS3FAR bs3CpuWeird1_InhibitedInt3_c64; 73 extern FNBS3FAR bs3CpuWeird1_InhibitedInt3_int3_c16; 74 extern FNBS3FAR bs3CpuWeird1_InhibitedInt3_int3_c32; 75 extern FNBS3FAR bs3CpuWeird1_InhibitedInt3_int3_c64; 76 77 extern FNBS3FAR bs3CpuWeird1_InhibitedBp_c16; 78 extern FNBS3FAR bs3CpuWeird1_InhibitedBp_c32; 79 extern FNBS3FAR bs3CpuWeird1_InhibitedBp_c64; 80 extern FNBS3FAR bs3CpuWeird1_InhibitedBp_int3_c16; 81 extern FNBS3FAR bs3CpuWeird1_InhibitedBp_int3_c32; 82 extern FNBS3FAR bs3CpuWeird1_InhibitedBp_int3_c64; 68 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedMovSsInt80, int80); 69 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedPopSsInt80, int80); 70 71 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedMovSsInt3, int3); 72 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedPopSsInt3, int3); 73 74 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedMovSsBp, int3); 75 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedPopSsBp, int3); 76 77 BS3_CPU_WEIRD_1_EXTERN_ASM_FN_VARS(bs3CpuWeird1_InhibitedMovSsSyscall, syscall); 83 78 84 79 … … 150 145 uDr6, pTrapCtx->uHandlerCs, pTrapCtx->uHandlerSs, pTrapCtx->uHandlerRsp, 151 146 pTrapCtx->fHandlerRfl, pTrapCtx->cbIretFrame); 152 #if 0147 #if 1 153 148 Bs3TestPrintf("Halting in CompareIntCtx: bXcpt=%#x\n", bXcpt); 154 149 ASMHalt(); … … 174 169 175 170 171 static void bs3RegCtxScramble(PBS3REGCTX pCtx, uint8_t bTestMode) 172 { 173 if (BS3_MODE_IS_64BIT_SYS(bTestMode)) 174 { 175 pCtx->r8.au32[0] ^= UINT32_C(0x2f460cb9); 176 pCtx->r8.au32[1] ^= UINT32_C(0x2dc346ff); 177 pCtx->r9.au32[0] ^= UINT32_C(0x9c50d12e); 178 pCtx->r9.au32[1] ^= UINT32_C(0x60be8859); 179 pCtx->r10.au32[0] ^= UINT32_C(0xa45fbe73); 180 pCtx->r10.au32[1] ^= UINT32_C(0x094140bf); 181 pCtx->r11.au32[0] ^= UINT32_C(0x8200148b); 182 pCtx->r11.au32[1] ^= UINT32_C(0x95dfc457); 183 pCtx->r12.au32[0] ^= UINT32_C(0xabc885f6); 184 pCtx->r12.au32[1] ^= UINT32_C(0xb9af126a); 185 pCtx->r13.au32[0] ^= UINT32_C(0xa2c4435c); 186 pCtx->r13.au32[1] ^= UINT32_C(0x1692b52e); 187 pCtx->r14.au32[0] ^= UINT32_C(0x85a56477); 188 pCtx->r14.au32[1] ^= UINT32_C(0x31a44a04); 189 pCtx->r15.au32[0] ^= UINT32_C(0x8d5b3072); 190 pCtx->r15.au32[1] ^= UINT32_C(0xc2ffce37); 191 } 192 } 193 194 195 typedef enum { 196 DbgInhibitRingXferType_SoftInt, 197 DbgInhibitRingXferType_Syscall 198 } DBGINHIBITRINGXFERTYPE; 199 176 200 static int bs3CpuWeird1_DbgInhibitRingXfer_Worker(uint8_t bTestMode, uint8_t bIntGate, uint8_t cbRingInstr, int8_t cbSpAdjust, 177 FPFNBS3FAR pfnTestCode, FPFNBS3FAR pfnTestLabel )201 FPFNBS3FAR pfnTestCode, FPFNBS3FAR pfnTestLabel, DBGINHIBITRINGXFERTYPE enmType) 178 202 { 203 BS3REGCTX Ctx; 179 204 BS3TRAPFRAME TrapCtx; 180 BS3TRAPFRAME TrapExpect ;181 BS3 REGCTX Ctx;205 BS3TRAPFRAME TrapExpectXfer; /* Expected registers after transfer (no #DB). */ 206 BS3TRAPFRAME TrapExpectXferDb; /* Expected registers after transfer followed by some #DB. */ 182 207 uint8_t bSavedDpl; 183 208 uint8_t const offTestLabel = BS3_FP_OFF(pfnTestLabel) - BS3_FP_OFF(pfnTestCode); 184 //uint8_t const cbIretFrameSame = BS3_MODE_IS_RM_SYS(bTestMode) ? 6185 // : BS3_MODE_IS_16BIT_SYS(bTestMode) ? 12186 // : BS3_MODE_IS_64BIT_SYS(bTestMode) ? 40 : 12;187 uint8_t cbIretFrameInt;188 uint8_t cbIretFrameIntDb;189 209 uint8_t const cbIretFrameSame = BS3_MODE_IS_16BIT_SYS(bTestMode) ? 6 190 210 : BS3_MODE_IS_32BIT_SYS(bTestMode) ? 12 : 40; 211 uint8_t const cbIretFrameRing = BS3_MODE_IS_16BIT_SYS(bTestMode) ? 10 212 : BS3_MODE_IS_32BIT_SYS(bTestMode) ? 20 : 40; 191 213 uint8_t const cbSpAdjSame = BS3_MODE_IS_64BIT_SYS(bTestMode) ? 48 : cbIretFrameSame; 192 uint8_t bVmeMethod = 0; 193 uint64_t uHandlerRspInt; 194 uint64_t uHandlerRspIntDb; 214 bool const fAlwaysUd = enmType == DbgInhibitRingXferType_Syscall && bTestMode != BS3_MODE_LM64; 215 uint8_t bVmeMethod = 0; 216 uint8_t cbIretFrameDb; /* #DB before xfer */ 217 uint64_t uHandlerRspDb; /* #DB before xfer */ 195 218 BS3_XPTR_AUTO(uint32_t, StackXptr); 219 220 if (fAlwaysUd) 221 bIntGate = X86_XCPT_UD; 196 222 197 223 /* make sure they're allocated */ 198 224 Bs3MemZero(&Ctx, sizeof(Ctx)); 199 225 Bs3MemZero(&TrapCtx, sizeof(TrapCtx)); 200 Bs3MemZero(&TrapExpect, sizeof(TrapExpect)); 226 Bs3MemZero(&TrapExpectXfer, sizeof(TrapExpectXfer)); 227 Bs3MemZero(&TrapExpectXferDb, sizeof(TrapExpectXferDb)); 201 228 202 229 /* … … 206 233 207 234 Bs3RegCtxSaveEx(&Ctx, bTestMode, 1024); 235 bs3RegCtxScramble(&Ctx, bTestMode); 208 236 Bs3RegCtxSetRipCsFromLnkPtr(&Ctx, pfnTestCode); 209 237 if (BS3_MODE_IS_16BIT_SYS(bTestMode)) … … 225 253 226 254 /* V8086: Set IOPL to 3. */ 227 if (BS3_MODE_IS_V86(bTestMode) )255 if (BS3_MODE_IS_V86(bTestMode) && enmType != DbgInhibitRingXferType_Syscall) 228 256 { 229 257 Ctx.rflags.u32 |= X86_EFL_IOPL; … … 243 271 } 244 272 273 /* Make BP = SP since 16-bit can't use SP for addressing. */ 274 Ctx.rbp = Ctx.rsp; 275 245 276 /* 246 277 * Test #0: Test run. Calc expected delayed #DB from it. … … 252 283 } 253 284 *BS3_XPTR_GET(uint32_t, StackXptr) = Ctx.ss; 254 Bs3TrapSetJmpAndRestore(&Ctx, &TrapExpect); 255 if (TrapExpect.bXcpt != bIntGate) 256 { 257 258 Bs3TestFailedF("%u: bXcpt is %#x, expected %#x!\n", g_usBs3TestStep, TrapExpect.bXcpt, bIntGate); 259 Bs3TrapPrintFrame(&TrapExpect); 285 Bs3TrapSetJmpAndRestore(&Ctx, &TrapExpectXfer); 286 if (TrapExpectXfer.bXcpt != bIntGate) 287 { 288 Bs3TestFailedF("%u: bXcpt is %#x, expected %#x!\n", g_usBs3TestStep, TrapExpectXfer.bXcpt, bIntGate); 289 Bs3TrapPrintFrame(&TrapExpectXfer); 260 290 return 1; 261 291 } 262 263 cbIretFrameInt = TrapExpect.cbIretFrame; 264 cbIretFrameIntDb = cbIretFrameInt + cbIretFrameSame; 265 uHandlerRspInt = TrapExpect.uHandlerRsp; 266 uHandlerRspIntDb = uHandlerRspInt - cbSpAdjSame; 267 268 TrapExpect.Ctx.bCpl = 0; 269 TrapExpect.Ctx.cs = TrapExpect.uHandlerCs; 270 TrapExpect.Ctx.ss = TrapExpect.uHandlerSs; 271 TrapExpect.Ctx.rsp.u64 = TrapExpect.uHandlerRsp; 272 TrapExpect.Ctx.rflags.u64 = TrapExpect.fHandlerRfl; 273 if (BS3_MODE_IS_V86(bTestMode)) 274 { 275 if (bVmeMethod >= 5) 292 Bs3MemCpy(&TrapExpectXferDb, &TrapExpectXfer, sizeof(TrapExpectXferDb)); 293 294 if (!fAlwaysUd) 295 { 296 TrapExpectXferDb.Ctx.bCpl = 0; 297 TrapExpectXferDb.Ctx.cs = TrapExpectXfer.uHandlerCs; 298 TrapExpectXferDb.Ctx.ss = TrapExpectXfer.uHandlerSs; 299 TrapExpectXferDb.Ctx.rsp.u64 = TrapExpectXfer.uHandlerRsp; 300 TrapExpectXferDb.Ctx.rflags.u64 = TrapExpectXfer.fHandlerRfl; 301 302 if (enmType != DbgInhibitRingXferType_Syscall) 276 303 { 277 TrapExpect.Ctx.rflags.u32 |= X86_EFL_VM; 278 TrapExpect.Ctx.bCpl = 3; 279 TrapExpect.Ctx.rip.u64 = bs3CpuWeird1_GetTrapHandlerEIP(bIntGate, bTestMode, true); 280 cbIretFrameIntDb = 36; 281 if (BS3_MODE_IS_16BIT_SYS(bTestMode)) 282 uHandlerRspIntDb = Bs3Tss16.sp0 - cbIretFrameIntDb; 283 else 284 uHandlerRspIntDb = Bs3Tss32.esp0 - cbIretFrameIntDb; 304 TrapExpectXferDb.cbIretFrame = TrapExpectXfer.cbIretFrame + cbIretFrameSame; 305 TrapExpectXferDb.uHandlerRsp = TrapExpectXfer.uHandlerRsp - cbSpAdjSame; 285 306 } 286 307 else 287 308 { 288 TrapExpect .Ctx.ds = 0;289 TrapExpect .Ctx.es = 0;290 TrapExpect .Ctx.fs = 0;291 TrapExpect .Ctx.gs = 0;309 TrapExpectXfer.cbIretFrame = 0xff; 310 TrapExpectXferDb.cbIretFrame = cbIretFrameSame; 311 TrapExpectXfer.uHandlerRsp = Ctx.rsp.u - cbSpAdjust; 312 TrapExpectXferDb.uHandlerRsp = (TrapExpectXfer.uHandlerRsp & ~(uint64_t)15) - cbIretFrameSame; 292 313 } 293 } 314 if (BS3_MODE_IS_V86(bTestMode)) 315 { 316 if (bVmeMethod >= 5) 317 { 318 TrapExpectXferDb.Ctx.rflags.u32 |= X86_EFL_VM; 319 TrapExpectXferDb.Ctx.bCpl = 3; 320 TrapExpectXferDb.Ctx.rip.u64 = bs3CpuWeird1_GetTrapHandlerEIP(bIntGate, bTestMode, true); 321 TrapExpectXferDb.cbIretFrame = 36; 322 if (BS3_MODE_IS_16BIT_SYS(bTestMode)) 323 TrapExpectXferDb.uHandlerRsp = Bs3Tss16.sp0 - TrapExpectXferDb.cbIretFrame; 324 else 325 TrapExpectXferDb.uHandlerRsp = Bs3Tss32.esp0 - TrapExpectXferDb.cbIretFrame; 326 } 327 else 328 { 329 TrapExpectXferDb.Ctx.ds = 0; 330 TrapExpectXferDb.Ctx.es = 0; 331 TrapExpectXferDb.Ctx.fs = 0; 332 TrapExpectXferDb.Ctx.gs = 0; 333 } 334 } 335 } 336 337 if (enmType != DbgInhibitRingXferType_Syscall) 338 { 339 cbIretFrameDb = TrapExpectXfer.cbIretFrame; 340 uHandlerRspDb = TrapExpectXfer.uHandlerRsp; 341 } 342 else 343 { 344 cbIretFrameDb = cbIretFrameRing; 345 uHandlerRspDb = BS3_ADDR_STACK_R0 - cbIretFrameRing; 346 } 347 294 348 295 349 /* … … 303 357 } 304 358 *BS3_XPTR_GET(uint32_t, StackXptr) = Ctx.ss; 305 Ctx.rflags.u32 |= X86_EFL_TF;359 // Ctx.rflags.u32 |= X86_EFL_TF; 306 360 307 361 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 308 362 if ( !BS3_MODE_IS_V86(bTestMode) 309 || bVmeMethod < 5)310 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, & Ctx, bIntGate, offTestLabel + cbRingInstr, cbSpAdjust,311 X86_DR6_INIT_VAL, cbIretFrameInt, uHandlerRspInt);363 || bVmeMethod < 5) 364 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, bIntGate, 0, 0, X86_DR6_INIT_VAL, 365 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 312 366 else 313 367 { 314 TrapExpect.Ctx.rflags.u32 |= X86_EFL_TF; 315 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpect.Ctx, X86_XCPT_DB, offTestLabel, -2, 316 X86_DR6_INIT_VAL | X86_DR6_BS, cbIretFrameIntDb, uHandlerRspIntDb); 317 TrapExpect.Ctx.rflags.u32 &= ~X86_EFL_TF; 368 TrapExpectXferDb.Ctx.rflags.u32 |= X86_EFL_TF; 369 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXferDb.Ctx, X86_XCPT_DB, offTestLabel, -2, 370 X86_DR6_INIT_VAL | X86_DR6_BS, 371 TrapExpectXferDb.cbIretFrame, TrapExpectXferDb.uHandlerRsp); 372 TrapExpectXferDb.Ctx.rflags.u32 &= ~X86_EFL_TF; 318 373 } 319 374 … … 337 392 if (g_enmCpuVendor == BS3CPUVENDOR_AMD || g_enmCpuVendor == BS3CPUVENDOR_HYGON) 338 393 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &Ctx, X86_XCPT_DB, offTestLabel, cbSpAdjust, 339 X86_DR6_INIT_VAL | X86_DR6_B0, cbIretFrameInt, uHandlerRspInt);394 X86_DR6_INIT_VAL | X86_DR6_B0, TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 340 395 else 341 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, & Ctx, bIntGate, offTestLabel + cbRingInstr, cbSpAdjust,342 X86_DR6_INIT_VAL, cbIretFrameInt, uHandlerRspInt);396 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, bIntGate, 0, 0, X86_DR6_INIT_VAL, 397 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 343 398 344 399 /* … … 354 409 if (g_enmCpuVendor == BS3CPUVENDOR_AMD || g_enmCpuVendor == BS3CPUVENDOR_HYGON) 355 410 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &Ctx, X86_XCPT_DB, offTestLabel, cbSpAdjust, 356 X86_DR6_INIT_VAL | X86_DR6_B0, cbIretFrameInt, uHandlerRspInt);411 X86_DR6_INIT_VAL | X86_DR6_B0, TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 357 412 else 358 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, & Ctx, bIntGate, offTestLabel + cbRingInstr, cbSpAdjust,359 X86_DR6_INIT_VAL, cbIretFrameInt, uHandlerRspInt);413 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, bIntGate, 0, 0, X86_DR6_INIT_VAL, 414 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 360 415 361 416 /* 362 417 * Test #4: Execution breakpoint on pop ss / mov ss. Hits. 418 * 363 419 * Note! In real mode AMD-V updates the stack pointer, or something else is busted. Totally weird! 420 * 421 * Update: see Test #6 update. 364 422 */ 365 423 g_usBs3TestStep++; … … 370 428 371 429 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 372 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &Ctx, X86_XCPT_DB, 0, 0, X86_DR6_INIT_VAL | X86_DR6_B0, 373 cbIretFrameInt, 374 uHandlerRspInt - (BS3_MODE_IS_RM_SYS(bTestMode) ? 2 : 0) ); 430 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &Ctx, X86_XCPT_DB, 0, 0, X86_DR6_INIT_VAL | X86_DR6_B0, cbIretFrameDb, 431 uHandlerRspDb - (BS3_MODE_IS_RM_SYS(bTestMode) ? cbSpAdjust : 0) ); 375 432 376 433 /* … … 384 441 385 442 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 386 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &Ctx, X86_XCPT_DB, 0, 0, X86_DR6_INIT_VAL | X86_DR6_B0, 387 cbIretFrameInt,388 uHandlerRspInt - (BS3_MODE_IS_RM_SYS(bTestMode) ? 2 : 0));443 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &Ctx, X86_XCPT_DB, 0, 0, X86_DR6_INIT_VAL | X86_DR6_B0, cbIretFrameDb, 444 uHandlerRspDb - (BS3_MODE_IS_RM_SYS(bTestMode) ? cbSpAdjust : 0) ); 445 Bs3RegSetDr7(0); 389 446 390 447 /* … … 406 463 407 464 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 408 TrapExpect.Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme 465 Bs3RegSetDr7(0); 466 TrapExpectXferDb.Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme 409 467 Bs3RegSetDr7(0); 410 468 uDr6Expect = X86_DR6_INIT_VAL | X86_DR6_B0; 411 if (g_enmCpuVendor == BS3CPUVENDOR_INTEL && bTestMode != BS3_MODE_RM)469 if (g_enmCpuVendor == BS3CPUVENDOR_INTEL && (bTestMode != BS3_MODE_RM || cbSpAdjust == 0)) 412 470 uDr6Expect = X86_DR6_INIT_VAL; 413 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpect.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 414 cbIretFrameSame, uHandlerRspIntDb); 471 if (!fAlwaysUd) 472 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXferDb.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 473 cbIretFrameSame, TrapExpectXferDb.uHandlerRsp); 474 else 475 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, X86_XCPT_UD, 0, 0, uDr6Expect, 476 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 415 477 416 478 /* … … 424 486 425 487 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 426 TrapExpect .Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme488 TrapExpectXferDb.Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme 427 489 Bs3RegSetDr7(0); 428 490 uDr6Expect = X86_DR6_INIT_VAL | X86_DR6_B0; 429 if (g_enmCpuVendor == BS3CPUVENDOR_INTEL && bTestMode != BS3_MODE_RM)491 if (g_enmCpuVendor == BS3CPUVENDOR_INTEL && (bTestMode != BS3_MODE_RM || cbSpAdjust == 0)) 430 492 uDr6Expect = X86_DR6_INIT_VAL; 431 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpect.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 432 cbIretFrameSame, uHandlerRspIntDb); 493 if (!fAlwaysUd) 494 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXferDb.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 495 cbIretFrameSame, TrapExpectXferDb.uHandlerRsp); 496 else 497 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, X86_XCPT_UD, 0, 0, uDr6Expect, 498 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 433 499 434 500 if (!BS3_MODE_IS_RM_OR_V86(bTestMode)) … … 447 513 448 514 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 449 TrapExpect .Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme515 TrapExpectXferDb.Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme 450 516 Bs3RegSetDr7(0); 451 517 uDr6Expect = g_enmCpuVendor == BS3CPUVENDOR_INTEL ? X86_DR6_INIT_VAL : X86_DR6_INIT_VAL | X86_DR6_B1; 452 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpect.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 453 cbIretFrameSame, uHandlerRspIntDb); 518 if (!fAlwaysUd) 519 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXferDb.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 520 cbIretFrameSame, TrapExpectXferDb.uHandlerRsp); 521 else 522 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, X86_XCPT_UD, 0, 0, uDr6Expect, 523 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 454 524 455 525 /* … … 465 535 466 536 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 467 TrapExpect .Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme537 TrapExpectXferDb.Ctx.rip = TrapCtx.Ctx.rip; /// @todo fixme 468 538 Bs3RegSetDr7(0); 469 539 uDr6Expect = g_enmCpuVendor == BS3CPUVENDOR_INTEL ? X86_DR6_INIT_VAL : X86_DR6_INIT_VAL | X86_DR6_B1; 470 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpect.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 471 cbIretFrameSame, uHandlerRspIntDb); 540 if (!fAlwaysUd) 541 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXferDb.Ctx, X86_XCPT_DB, 0, 0, uDr6Expect, 542 cbIretFrameSame, TrapExpectXferDb.uHandlerRsp); 543 else 544 bs3CpuWeird1_CompareDbgInhibitRingXfer(&TrapCtx, &TrapExpectXfer.Ctx, X86_XCPT_UD, 0, 0, uDr6Expect, 545 TrapExpectXfer.cbIretFrame, TrapExpectXfer.uHandlerRsp); 472 546 } 473 547 … … 508 582 /** @todo test all V8086 software INT delivery modes (currently only 4 and 1). */ 509 583 584 #define ASM_FN_ARGS(a_Name, a_Label, a_ModeSuff, a_Type) \ 585 bs3CpuWeird1_##a_Name##_##a_ModeSuff, bs3CpuWeird1_##a_Name##_##a_Label##_##a_ModeSuff, DbgInhibitRingXferType_##a_Type 586 510 587 /* Note! Both ICEBP and BOUND has be checked cursorily and found not to be affected. */ 511 588 if (BS3_MODE_IS_16BIT_CODE(bMode)) 512 589 { 513 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 2, bs3CpuWeird1_InhibitedInt80_c16, bs3CpuWeird1_InhibitedInt80_int80_c16); 590 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 2, ASM_FN_ARGS(InhibitedPopSsInt80, int80, c16, SoftInt)); 591 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 0, ASM_FN_ARGS(InhibitedMovSsInt80, int80, c16, SoftInt)); 514 592 if (!BS3_MODE_IS_V86(bMode) || !g_fVME) 515 593 { 516 594 /** @todo explain why these GURU */ 517 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 2, bs3CpuWeird1_InhibitedInt3_c16, bs3CpuWeird1_InhibitedInt3_int3_c16); 518 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 2, bs3CpuWeird1_InhibitedBp_c16, bs3CpuWeird1_InhibitedBp_int3_c16); 595 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 2, ASM_FN_ARGS(InhibitedPopSsInt3, int3, c16, SoftInt)); 596 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 0, ASM_FN_ARGS(InhibitedMovSsInt3, int3, c16, SoftInt)); 597 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 2, ASM_FN_ARGS(InhibitedPopSsBp, int3, c16, SoftInt)); 598 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 0, ASM_FN_ARGS(InhibitedMovSsBp, int3, c16, SoftInt)); 519 599 } 520 600 } 521 601 else if (BS3_MODE_IS_32BIT_CODE(bMode)) 522 602 { 523 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 4, bs3CpuWeird1_InhibitedInt80_c32, bs3CpuWeird1_InhibitedInt80_int80_c32); 524 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 4, bs3CpuWeird1_InhibitedInt3_c32, bs3CpuWeird1_InhibitedInt3_int3_c32); 525 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 4, bs3CpuWeird1_InhibitedBp_c32, bs3CpuWeird1_InhibitedBp_int3_c32); 603 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 4, ASM_FN_ARGS(InhibitedPopSsInt80, int80, c32, SoftInt)); 604 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 0, ASM_FN_ARGS(InhibitedMovSsInt80, int80, c32, SoftInt)); 605 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 4, ASM_FN_ARGS(InhibitedPopSsInt3, int3, c32, SoftInt)); 606 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 0, ASM_FN_ARGS(InhibitedMovSsInt3, int3, c32, SoftInt)); 607 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 4, ASM_FN_ARGS(InhibitedPopSsBp, int3, c32, SoftInt)); 608 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 0, ASM_FN_ARGS(InhibitedMovSsBp, int3, c32, SoftInt)); 526 609 } 527 610 else 528 611 { 529 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 0, bs3CpuWeird1_InhibitedInt80_c64, bs3CpuWeird1_InhibitedInt80_int80_c64); 530 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 0, bs3CpuWeird1_InhibitedInt3_c64, bs3CpuWeird1_InhibitedInt3_int3_c64); 531 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 0, bs3CpuWeird1_InhibitedBp_c64, bs3CpuWeird1_InhibitedBp_int3_c64); 612 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x80, 2, 0, ASM_FN_ARGS(InhibitedMovSsInt80, int80, c64, SoftInt)); 613 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 2, 0, ASM_FN_ARGS(InhibitedMovSsInt3, int3, c64, SoftInt)); 614 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0x03, 1, 0, ASM_FN_ARGS(InhibitedMovSsBp, int3, c64, SoftInt)); 615 } 616 617 /* On intel, syscall only works in long mode. */ 618 /** @todo test this on AMD and extend it to non-64-bit modes */ 619 if (BS3_MODE_IS_64BIT_SYS(bMode)) 620 { 621 uint64_t const fSavedEfer = ASMRdMsr(MSR_K6_EFER); 622 ASMWrMsr(MSR_K8_SF_MASK, X86_EFL_TF); 623 ASMWrMsr(MSR_K8_LSTAR, g_pfnBs3Syscall64GenericFlat); 624 ASMWrMsr(MSR_K8_CSTAR, g_pfnBs3Syscall64GenericCompatibilityFlat); 625 ASMWrMsr(MSR_K6_STAR, (uint64_t)BS3_SEL_R0_CS64 << MSR_K6_STAR_SYSCALL_CS_SS_SHIFT); 626 ASMWrMsr(MSR_K6_EFER, fSavedEfer | MSR_K6_EFER_SCE); 627 628 if (BS3_MODE_IS_16BIT_CODE(bMode)) 629 { 630 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0xfe, 2, 0, ASM_FN_ARGS(InhibitedMovSsSyscall, syscall, c16, Syscall)); 631 } 632 else if (BS3_MODE_IS_32BIT_CODE(bMode)) 633 { 634 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0xfe, 2, 0, ASM_FN_ARGS(InhibitedMovSsSyscall, syscall, c32, Syscall)); 635 } 636 else 637 { 638 bs3CpuWeird1_DbgInhibitRingXfer_Worker(bMode, 0xff, 2, 0, ASM_FN_ARGS(InhibitedMovSsSyscall, syscall, c64, Syscall)); 639 } 640 641 ASMWrMsr(MSR_K6_EFER, fSavedEfer); 642 ASMWrMsr(MSR_K6_STAR, 0); 643 ASMWrMsr(MSR_K8_LSTAR, 0); 644 ASMWrMsr(MSR_K8_CSTAR, 0); 645 ASMWrMsr(MSR_K8_SF_MASK, 0); 532 646 } 533 647 -
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-weird-1.c
r105072 r105094 57 57 static const BS3TESTMODEBYONEENTRY g_aModeByOneTests[] = 58 58 { 59 #if 1/** @todo asserts in ring-0 on VT-x! */59 #if 1/** @todo asserts in ring-0 on VT-x! (It works when run directly on intel 6700K hardware.) */ 60 60 { "dbg+inhibit+ringxfer", BS3_CMN_FAR_NM(bs3CpuWeird1_DbgInhibitRingXfer), 0 }, 61 61 #endif 62 #if 0 62 63 #if 1 63 64 { "pc wrapping", BS3_CMN_FAR_NM(bs3CpuWeird1_PcWrapping), 0 }, … … 65 66 // { "push/pop", BS3_CMN_FAR_NM(bs3CpuWeird1_PushPop), 0 }, 66 67 { "push/pop sreg", BS3_CMN_FAR_NM(bs3CpuWeird1_PushPopSReg), 0 }, 68 #endif 67 69 }; 68 70 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk
r105075 r105094 372 372 bs3-cmn-PagingMapRamAbove4GForLM.c \ 373 373 bs3-cmn-SwitchHlpConvFlatRetToRetfProtMode.asm \ 374 bs3-c64-Syscall64Generic.asm \ 374 375 bs3-c64-Trap64Generic.asm \ 375 376 ../../../Runtime/common/asm/ASMGetIDTR.asm \ -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-c64-Syscall64Generic.asm
r105060 r105094 1 1 ; $Id$ 2 2 ;; @file 3 ; BS3Kit - Trap, 64-bit assembly handlers.4 ; 5 6 ; 7 ; Copyright (C) 2007-202 3Oracle and/or its affiliates.3 ; BS3Kit - Syscall, 64-bit assembly handlers. 4 ; 5 6 ; 7 ; Copyright (C) 2007-2024 Oracle and/or its affiliates. 8 8 ; 9 9 ; This file is part of VirtualBox base platform packages, as … … 49 49 ;********************************************************************************************************************************* 50 50 BS3_EXTERN_DATA16 g_bBs3CurrentMode 51 BS3_EXTERN_DATA16 g_apfnBs3TrapHandlers_c6452 51 TMPL_BEGIN_TEXT 53 52 BS3_EXTERN_CMN Bs3TrapDefaultHandler 54 53 BS3_EXTERN_CMN Bs3RegCtxRestore 54 55 56 ;********************************************************************************************************************************* 57 ;* Global Variables * 58 ;********************************************************************************************************************************* 59 BS3_BEGIN_DATA16 60 ;; Easy to access flat address of Bs3Syscall64Generic. 61 BS3_GLOBAL_DATA g_pfnBs3Syscall64GenericFlat, 4 62 dd Bs3Syscall64Generic wrt FLAT 63 ;; Easy to access flat address of Bs3Syscall64Generic. 64 BS3_GLOBAL_DATA g_pfnBs3Syscall64GenericCompatibilityFlat, 4 65 dd Bs3Syscall64GenericCompatibility wrt FLAT 66 67 55 68 TMPL_BEGIN_TEXT 56 69 57 58 ;*********************************************************************************************************************************59 ;* Global Variables *60 ;*********************************************************************************************************************************61 BS3_BEGIN_DATA1662 ;; Easy to access flat address of Bs3Trap64GenericEntries.63 BS3_GLOBAL_DATA g_Bs3Trap64GenericEntriesFlatAddr, 464 dd Bs3Trap64GenericEntries wrt FLAT65 66 67 TMPL_BEGIN_TEXT68 69 70 ;; 70 ; Generic entry points for IDT handlers, 8 byte spacing. 71 ; 72 BS3_PROC_BEGIN Bs3Trap64GenericEntries 73 %macro Bs3Trap64GenericEntry 1 74 db 06ah, i ; push imm8 - note that this is a signextended value. 75 jmp %1 76 ALIGNCODE(8) 77 %assign i i+1 78 %endmacro 79 80 %assign i 0 ; start counter. 81 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 0 82 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 1 83 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 2 84 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 3 85 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 4 86 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 5 87 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 6 88 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 7 89 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; 8 90 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 9 91 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; a 92 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; b 93 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; c 94 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; d 95 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; e 96 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; f (reserved) 97 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 10 98 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; 11 99 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 12 100 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 13 101 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 14 102 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 15 (reserved) 103 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 16 (reserved) 104 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 17 (reserved) 105 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 18 (reserved) 106 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 19 (reserved) 107 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 1a (reserved) 108 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 1b (reserved) 109 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 1c (reserved) 110 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 1d (reserved) 111 Bs3Trap64GenericEntry Bs3Trap64GenericTrapErrCode ; 1e 112 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt ; 1f (reserved) 113 %rep 224 114 Bs3Trap64GenericEntry Bs3Trap64GenericTrapOrInt 115 %endrep 116 BS3_PROC_END Bs3Trap64GenericEntries 117 118 71 ; Generic function to load into LSTAR 72 ; 73 ; This will just skip 20h on the stack and set up a flat call frame there. 74 ; 75 BS3_PROC_BEGIN Bs3Syscall64Generic 76 lea rsp, [rsp - 20h] 77 push rcx ; fake return address 78 push rbp ; 0 79 mov rbp, rsp 80 push 0xffff ; rbp-08h: bXpct+cbIretFrame values 81 jmp Bs3Syscall64GenericCommon 82 BS3_PROC_END Bs3Syscall64Generic 119 83 120 84 121 85 ;; 122 ; Trap or interrupt (no error code). 123 ; 124 BS3_PROC_BEGIN Bs3Trap64GenericTrapOrInt 125 push rbp ; 0 86 ; Generic function to load into CSTAR. 87 ; 88 ; Companion to Bs3Syscall64Generic. 89 ; 90 BS3_PROC_BEGIN Bs3Syscall64GenericCompatibility 91 lea rsp, [rsp - 20h] 92 push rcx ; fake return address 93 push rbp ; 0 126 94 mov rbp, rsp 127 pushfq ; -08h 95 push 0xfffe ; rbp-08h: bXpct+cbIretFrame values 96 jmp Bs3Syscall64GenericCommon 97 BS3_PROC_END Bs3Syscall64GenericCompatibility 98 99 100 ;; 101 ; Common context saving code and dispatching. 102 ; 103 ; @param rbp Pointer to fake RBP frame. 104 ; 105 BS3_PROC_BEGIN Bs3Syscall64GenericCommon 106 pushfq ; rbp-10h 128 107 cld 129 push rdi 130 131 ; Reserve space for the register and trap frame. 108 push rdi ; rbp-10h 109 mov di, ds 110 push rdi ; rbp-20h 111 mov di, ss 112 mov ds, di ; ds := ss 113 114 ; 115 ; Align the stack and reserve space for the register and trap frame. 116 ; 117 and rsp, ~0xf 132 118 mov edi, (BS3TRAPFRAME_size + 15) / 16 133 119 .more_zeroed_space: … … 136 122 dec edi 137 123 jnz .more_zeroed_space 138 mov rdi, rsp ; rdi points to trapframe structure. 139 140 ; Free up rax. 141 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], rax 142 124 mov rdi, rsp ; rdi points to trapframe structure. 125 126 ; 127 ; Save rax so we can use it. 128 ; 129 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], rax 130 131 ; 132 ; Mark the trap frame as a special one. 133 ; 134 mov ax, [rbp - 08h] 135 mov word [rdi + BS3TRAPFRAME.bXcpt], ax ; Also sets cbIretFrame 136 137 mov word [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.cs], 0 ; We cannot tell. 138 mov word [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], 0 ; We cannot tell. 139 mov byte [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.bCpl], 3 ; We cannot tell. 140 141 mov [rdi + BS3TRAPFRAME.uHandlerCs], cs 142 mov [rdi + BS3TRAPFRAME.uHandlerSs], ss 143 144 ; 143 145 ; Copy stuff from the stack over. 144 mov al, [rbp + 08h] 145 mov [rdi + BS3TRAPFRAME.bXcpt], al 146 ; 146 147 mov rax, [rbp] 147 148 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp], rax 148 mov rax, [rbp - 08h] 149 150 mov rax, [rbp - 10h] 149 151 mov [rdi + BS3TRAPFRAME.fHandlerRfl], rax 150 mov rax, [rbp - 10h] 152 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], r11 ; with RF cleared 153 154 mov rax, [rbp - 18h] 151 155 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rdi], rax 152 156 153 lea rbp, [rbp + 08h] ; iret - 8 (i.e. rbp frame chain location) 154 jmp Bs3Trap64GenericCommon 155 BS3_PROC_END Bs3Trap64GenericTrapOrInt 156 157 158 ;; 159 ; Trap with error code. 160 ; 161 BS3_PROC_BEGIN Bs3Trap64GenericTrapErrCode 162 push rbp ; 0 163 mov rbp, rsp 164 pushfq ; -08h 165 cld 166 push rdi 167 168 ; Reserve space for the register and trap frame. 169 mov edi, (BS3TRAPFRAME_size + 15) / 16 170 .more_zeroed_space: 171 push qword 0 172 push qword 0 173 dec edi 174 jnz .more_zeroed_space 175 mov rdi, rsp ; rdi points to trapframe structure. 176 177 ; Free up rax. 178 mov [edi + BS3TRAPFRAME.Ctx + BS3REGCTX.rax], rax 179 180 ; Copy stuff from the stack over. 181 mov rax, [rbp + 10h] 182 mov [rdi + BS3TRAPFRAME.uErrCd], rax 183 mov al, [rbp + 08h] 184 mov [rdi + BS3TRAPFRAME.bXcpt], al 185 mov rax, [rbp] 186 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp], rax 187 mov rax, [rbp - 08h] 188 mov [rdi + BS3TRAPFRAME.fHandlerRfl], rax 189 mov rax, [rbp - 10h] 190 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rdi], rax 191 192 lea rbp, [rbp + 10h] ; iret - 8 (i.e. rbp frame chain location) 193 jmp Bs3Trap64GenericCommon 194 BS3_PROC_END Bs3Trap64GenericTrapErrCode 195 196 197 ;; 198 ; Common context saving code and dispatching. 199 ; 200 ; @param rdi Pointer to the trap frame. The following members have been 201 ; filled in by the previous code: 202 ; - bXcpt 203 ; - uErrCd 204 ; - fHandlerRfl 205 ; - Ctx.rax 206 ; - Ctx.rbp 207 ; - Ctx.rdi 208 ; 209 ; @param rbp Pointer to the dword before the iret frame, i.e. where rbp 210 ; would be saved if this was a normal call. 211 ; 212 BS3_PROC_BEGIN Bs3Trap64GenericCommon 213 ; 214 ; Fake RBP frame. 215 ; 216 mov rax, [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rbp] 217 mov [rbp], rax 157 lea rax, [rbp + 20h + 8 + 8] 158 mov [rdi + BS3TRAPFRAME.uHandlerRsp], rax 159 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], rax 160 161 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rip], rcx 162 163 mov ax, [rbp - 20h] 164 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.ds], ax 165 166 mov [rdi + BS3TRAPFRAME.uHandlerSs], ss 218 167 219 168 ; … … 232 181 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.r14], r14 233 182 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.r15], r15 234 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.ds], ds235 183 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.es], es 236 184 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.fs], fs 237 185 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.gs], gs 238 lea rax, [rbp + 8h] 239 mov [rdi + BS3TRAPFRAME.uHandlerRsp], rax 240 mov [rdi + BS3TRAPFRAME.uHandlerSs], ss 241 242 ; 243 ; Load 32-bit data selector for the DPL we're executing at into DS, ES and SS. 244 ; Save the handler CS value first. 245 ; 246 mov ax, cs 247 mov [rdi + BS3TRAPFRAME.uHandlerCs], ax 248 AssertCompile(BS3_SEL_RING_SHIFT == 8) 249 and al, 3 250 mov ah, al 251 add ax, BS3_SEL_R0_DS64 252 mov ds, ax 186 187 ; 188 ; Load the SS selector into ES. 189 ; 190 mov ax, ss 253 191 mov es, ax 254 mov ss, ax255 192 256 193 ; … … 259 196 mov al, [BS3_DATA16_WRT(g_bBs3CurrentMode)] 260 197 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.bMode], al 261 and al, ~BS3_MODE_CODE_MASK 262 or al, BS3_MODE_CODE_64 263 mov [BS3_DATA16_WRT(g_bBs3CurrentMode)], al 264 265 ; 266 ; Copy iret info. Bless AMD for only doing one 64-bit iret frame layout. 267 ; 268 mov rcx, [rbp + 08] 269 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rip], rcx 270 mov cx, [rbp + 10h] 271 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.cs], cx 272 and cl, 3 273 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.bCpl], cl 274 mov rcx, [rbp + 18h] 275 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rflags], rcx 276 mov rcx, [rbp + 20h] 277 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.rsp], rcx 278 mov cx, [rbp + 28h] 279 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.ss], cx 280 mov byte [rdi + BS3TRAPFRAME.cbIretFrame], 5*8 198 mov byte [BS3_DATA16_WRT(g_bBs3CurrentMode)], BS3_MODE_LM64 281 199 282 200 ; … … 287 205 sldt ax 288 206 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.ldtr], ax 289 290 mov ax, ss291 test al, 3292 jnz .skip_crX_because_cpl_not_0293 207 294 208 mov rax, cr0 … … 300 214 mov rax, cr4 301 215 mov [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr4], rax 302 jmp .dispatch_to_handler 303 304 .skip_crX_because_cpl_not_0: 305 or byte [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.fbFlags], \ 306 BS3REG_CTX_F_NO_CR0_IS_MSW | BS3REG_CTX_F_NO_CR2_CR3 | BS3REG_CTX_F_NO_CR4 307 smsw [rdi + BS3TRAPFRAME.Ctx + BS3REGCTX.cr0] 308 309 ; 310 ; Dispatch it to C code. 311 ; 312 .dispatch_to_handler: ; The double fault code joins us here. 313 movzx ebx, byte [rdi + BS3TRAPFRAME.bXcpt] 314 lea rax, [BS3_DATA16_WRT(_g_apfnBs3TrapHandlers_c64)] 315 mov rax, [rax + rbx * 8] 316 or rax, rax 317 jnz .call_handler 318 lea rax, [BS3_WRT_RIP(Bs3TrapDefaultHandler)] 319 .call_handler: 216 217 ; 218 ; There are no _g_apfnBs3TrapHandlers_c64 entries for syscalls, but call 219 ; Bs3TrapDefaultHandler to get the g_pBs3TrapSetJmpFrame handling & panic. 220 ; 320 221 sub rsp, 20h 321 222 mov [rsp], rdi 322 223 mov rcx, rdi 323 call rax224 call Bs3TrapDefaultHandler 324 225 325 226 ; … … 334 235 hlt 335 236 jmp .panic 336 BS3_PROC_END Bs3 Trap64GenericCommon337 237 BS3_PROC_END Bs3Syscall64GenericCommon 238 -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TrapDefaultHandler.c
r98103 r105094 324 324 /* 325 325 * Fatal. 326 * 327 * Special case for #DB so we can get at the DRx values before we print anything, 328 * as a aid for debugging VT-x/AMD-V code getting these out of sync. 326 329 */ 327 Bs3TestPrintf("*** GURU ***\n"); 328 Bs3TrapPrintFrame(pTrapFrame); 330 if (pTrapFrame->bXcpt != X86_XCPT_DB) 331 { 332 Bs3TestPrintf("*** GURU ***\n"); 333 Bs3TrapPrintFrame(pTrapFrame); 334 } 335 else 336 { 337 Bs3TestPrintf("*** GURU ***\n" 338 #if ARCH_BITS == 64 339 "dr6=%08RX32 dr7=%08RX32 dr0=%08RX64\n" 340 "dr1=%08RX64 dr2=%08RX64 dr3=%08RX64\n" 341 #else 342 "dr6=%08RX32 dr7=%08RX32 dr0=%08RX32 dr1=%08RX32 dr2=%08RX32 dr3=%08RX32\n" 343 #endif 344 , (uint32_t)Bs3RegGetDr6(), (uint32_t)Bs3RegGetDr7(), 345 Bs3RegGetDr0(), Bs3RegGetDr1(), Bs3RegGetDr2(), Bs3RegGetDr3()); 346 Bs3TrapPrintFrame(pTrapFrame); 347 } 329 348 Bs3Panic(); 330 349 } -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h
r104071 r105094 196 196 #define Bs3StrPrintfV BS3_CMN_MANGLER(Bs3StrPrintfV) 197 197 #define Bs3SwitchFromV86To16BitAndCallC BS3_CMN_MANGLER(Bs3SwitchFromV86To16BitAndCallC) 198 #define Bs3Syscall64Generic BS3_CMN_MANGLER(Bs3Syscall64Generic) 199 #define Bs3Syscall64GenericCompatibility BS3_CMN_MANGLER(Bs3Syscall64GenericCompatibility) 198 200 #define Bs3TestCheckExtCtx BS3_CMN_MANGLER(Bs3TestCheckExtCtx) 199 201 #define Bs3TestCheckRegCtxEx BS3_CMN_MANGLER(Bs3TestCheckRegCtxEx) -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h
r104071 r105094 196 196 #undef Bs3StrPrintfV 197 197 #undef Bs3SwitchFromV86To16BitAndCallC 198 #undef Bs3Syscall64Generic 199 #undef Bs3Syscall64GenericCompatibility 198 200 #undef Bs3TestCheckExtCtx 199 201 #undef Bs3TestCheckRegCtxEx -
trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h
r104440 r105094 3608 3608 BS3_CMN_PROTO_STUB(void, Bs3TrapUnsetJmp,(void)); 3609 3609 3610 /** Entry point for MSR_K8_LSTAR (64-bit). 3611 * This hooks into the default Bs3TrapSetJmp logic. */ 3612 BS3_CMN_PROTO_NOSB(void, Bs3Syscall64Generic,(void)); 3613 /** The 32-bit FLAT address of Bs3Syscall64Generic (for 16-bit code). */ 3614 extern uint32_t g_pfnBs3Syscall64GenericFlat; 3615 3616 /** Entry point for MSR_K8_CSTAR (64-bit). 3617 * This hooks into the default Bs3TrapSetJmp logic. */ 3618 BS3_CMN_PROTO_NOSB(void, Bs3Syscall64GenericCompatibility,(void)); 3619 /** The 32-bit FLAT address of Bs3Syscall64Generic (for 16-bit code). */ 3620 extern uint32_t g_pfnBs3Syscall64GenericCompatibilityFlat; 3621 3622 3610 3623 3611 3624 /**
Note:
See TracChangeset
for help on using the changeset viewer.