Module Name: src Committed By: maxv Date: Sun Feb 25 12:37:16 UTC 2018
Modified Files: src/sys/arch/amd64/amd64: amd64_trap.S locore.S trap.c Log Message: Fix handling of segment register faults when running with SVS. The behavior is changed also in the non-SVS case. I've put a documentation in amd64_trap.S. Basically, the problem with SVS is that if iret faults, we already have a full trapframe pushed on the stack and the CPU will push another frame on this stack (nested), but it hits the redzone below the stack since it is still running with the user page table loaded. To fix that, we pop a good part of the trapframe earlier in intrfastexit. If iret faults, the current %rsp has enough room for an iret frame, and the CPU can push that without problem. We then switch back to the outer iret frame (the frame the CPU was trying to pop by executing iret, but that it didn't pop for real because iret faulted), call INTRENTRY, and handle the trap as if it had been received from userland directly. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/amd64/amd64_trap.S cvs rdiff -u -r1.156 -r1.157 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.111 -r1.112 src/sys/arch/amd64/amd64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.