Changeset 96948 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Sep 30, 2022 6:58:20 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp
r96932 r96948 4122 4122 if (uNewCs == 0 || uNewSs == 0) 4123 4123 { 4124 /** @todo Neither Intel nor AMD document this check. */ 4124 4125 Log(("syscall: msrSTAR.CS = 0 or SS = 0 -> #GP(0)\n")); 4125 4126 return iemRaiseGeneralProtectionFault0(pVCpu); … … 4135 4136 if (!IEM_IS_CANONICAL(uNewRip)) 4136 4137 { 4138 /** @todo Intel claims this can't happen because IA32_LSTAR MSR can't be written with non-canonical address. */ 4137 4139 Log(("syscall: New RIP not canonical -> #UD\n")); 4138 4140 return iemRaiseUndefinedOpcode(pVCpu); … … 4142 4144 * Commit it. 4143 4145 */ 4144 Log(("syscall: %04x:%016RX64 [efl=%#llx] -> %04x:%016RX64\n", pVCpu->cpum.GstCtx.cs , pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, uNewCs, uNewRip));4146 Log(("syscall: %04x:%016RX64 [efl=%#llx] -> %04x:%016RX64\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, uNewCs, uNewRip)); 4145 4147 pVCpu->cpum.GstCtx.rcx = pVCpu->cpum.GstCtx.rip + cbInstr; 4146 4148 pVCpu->cpum.GstCtx.rip = uNewRip; … … 4152 4154 4153 4155 pVCpu->cpum.GstCtx.cs.Attr.u = X86DESCATTR_P | X86DESCATTR_G | X86DESCATTR_L | X86DESCATTR_DT | X86_SEL_TYPE_ER_ACC; 4154 pVCpu->cpum.GstCtx.ss.Attr.u = X86DESCATTR_P | X86DESCATTR_G | X86DESCATTR_ L| X86DESCATTR_DT | X86_SEL_TYPE_RW_ACC;4156 pVCpu->cpum.GstCtx.ss.Attr.u = X86DESCATTR_P | X86DESCATTR_G | X86DESCATTR_D | X86DESCATTR_DT | X86_SEL_TYPE_RW_ACC; 4155 4157 } 4156 4158 else … … 4159 4161 * Commit it. 4160 4162 */ 4161 Log(("syscall: %04x:%08RX32 [efl=%#x] -> %04x:%08RX32\n", 4162 pVCpu->cpum.GstCtx.cs, pVCpu->cpum.GstCtx.eip, pVCpu->cpum.GstCtx.eflags.u, uNewCs, (uint32_t)(pVCpu->cpum.GstCtx.msrSTAR & MSR_K6_STAR_SYSCALL_EIP_MASK))); 4163 Log(("syscall: %04x:%08RX32 [efl=%#x] -> %04x:%08RX32\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.eip, pVCpu->cpum.GstCtx.eflags.u, uNewCs, (uint32_t)(pVCpu->cpum.GstCtx.msrSTAR & MSR_K6_STAR_SYSCALL_EIP_MASK))); 4163 4164 pVCpu->cpum.GstCtx.rcx = pVCpu->cpum.GstCtx.eip + cbInstr; 4164 4165 pVCpu->cpum.GstCtx.rip = pVCpu->cpum.GstCtx.msrSTAR & MSR_K6_STAR_SYSCALL_EIP_MASK; … … 4179 4180 pVCpu->cpum.GstCtx.ss.u32Limit = UINT32_MAX; 4180 4181 pVCpu->cpum.GstCtx.ss.fFlags = CPUMSELREG_FLAGS_VALID; 4182 4183 pVCpu->iem.s.uCpl = 0; 4184 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 4181 4185 4182 4186 /* Flush the prefetch buffer. */ … … 4247 4251 if (pVCpu->iem.s.enmEffOpSize == IEMMODE_64BIT) 4248 4252 { 4249 Log(("sysret: %04x:%016RX64 [efl=%#llx] -> %04x:%016RX64 [r11=%#llx]\n", 4250 pVCpu->cpum.GstCtx.cs, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, uNewCs, pVCpu->cpum.GstCtx.rcx, pVCpu->cpum.GstCtx.r11)); 4251 /* Note! We disregard intel manual regarding the RCX cananonical 4253 Log(("sysret: %04x:%016RX64 [efl=%#llx] -> %04x:%016RX64 [r11=%#llx]\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, uNewCs, pVCpu->cpum.GstCtx.rcx, pVCpu->cpum.GstCtx.r11)); 4254 /* Note! We disregard intel manual regarding the RCX canonical 4252 4255 check, ask intel+xen why AMD doesn't do it. */ 4253 4256 pVCpu->cpum.GstCtx.rip = pVCpu->cpum.GstCtx.rcx; … … 4257 4260 else 4258 4261 { 4259 Log(("sysret: %04x:%016RX64 [efl=%#llx] -> %04x:%08RX32 [r11=%#llx]\n", 4260 pVCpu->cpum.GstCtx.cs, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, uNewCs, pVCpu->cpum.GstCtx.ecx, pVCpu->cpum.GstCtx.r11)); 4262 Log(("sysret: %04x:%016RX64 [efl=%#llx] -> %04x:%08RX32 [r11=%#llx]\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, uNewCs, pVCpu->cpum.GstCtx.ecx, pVCpu->cpum.GstCtx.r11)); 4261 4263 pVCpu->cpum.GstCtx.rip = pVCpu->cpum.GstCtx.ecx; 4262 4264 pVCpu->cpum.GstCtx.cs.Attr.u = X86DESCATTR_P | X86DESCATTR_G | X86DESCATTR_D | X86DESCATTR_DT | X86_SEL_TYPE_ER_ACC … … 4264 4266 } 4265 4267 /** @todo testcase: See what kind of flags we can make SYSRET restore and 4266 * what it really ignores. RF and VM are hinted at being zero, by AMD. */ 4268 * what it really ignores. RF and VM are hinted at being zero, by AMD. 4269 * Intel says: RFLAGS := (R11 & 3C7FD7H) | 2; */ 4267 4270 pVCpu->cpum.GstCtx.rflags.u = pVCpu->cpum.GstCtx.r11 & (X86_EFL_POPF_BITS | X86_EFL_VIF | X86_EFL_VIP); 4268 4271 pVCpu->cpum.GstCtx.rflags.u |= X86_EFL_1; … … 4270 4273 else 4271 4274 { 4272 Log(("sysret: %04x:%08RX32 [efl=%#x] -> %04x:%08RX32\n", pVCpu->cpum.GstCtx.cs , pVCpu->cpum.GstCtx.eip, pVCpu->cpum.GstCtx.eflags.u, uNewCs, pVCpu->cpum.GstCtx.ecx));4275 Log(("sysret: %04x:%08RX32 [efl=%#x] -> %04x:%08RX32\n", pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.eip, pVCpu->cpum.GstCtx.eflags.u, uNewCs, pVCpu->cpum.GstCtx.ecx)); 4273 4276 pVCpu->cpum.GstCtx.rip = pVCpu->cpum.GstCtx.rcx; 4274 4277 pVCpu->cpum.GstCtx.rflags.u |= X86_EFL_IF; … … 4289 4292 /** @todo Testcase: verify that SS.u1Long and SS.u1DefBig are left unchanged 4290 4293 * on sysret. */ 4294 4295 pVCpu->iem.s.uCpl = 3; 4296 pVCpu->iem.s.enmCpuMode = iemCalcCpuMode(pVCpu); 4291 4297 4292 4298 /* Flush the prefetch buffer. */
Note:
See TracChangeset
for help on using the changeset viewer.