PERFORCE change 30716 for review

Peter Wemm peter at FreeBSD.org
Wed May 7 12:31:00 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=30716

Change 30716 by peter at peter_daintree on 2003/05/07 12:30:10

	Fix the context switch bug with a sledgehammer.  Defer re-enabling
	interrupts till after we've retrieved the user stack pointer from
	PCPU area, otherwise if we preempt and another process makes a
	syscall before we resume saving, then all hell breaks loose.
	This defers the sti for too long and that needs to be fixed, but
	that can be fixed later.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/exception.S#2 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/exception.S#2 (text+ko) ====

@@ -202,7 +202,6 @@
 	#swapgs
 	movq	%rsp,PCPU(SCRATCH_RSP)
 	movq	common_tss+COMMON_TSS_RSP0,%rsp
-	sti
 	/* Now emulate a trapframe. Ugh. */
 	subq	$TF_SIZE,%rsp
 	movq	$KUDSEL,TF_SS(%rsp)
@@ -226,6 +225,7 @@
 	movq	%r15,TF_R15(%rsp)	/* C preserved */
 	movq	PCPU(SCRATCH_RSP),%r12	/* %r12 already saved */
 	movq	%r12,TF_RSP(%rsp)	/* user stack pointer */
+	sti
 	call	syscall
 	movq	PCPU(CURPCB),%rax
 	testq	$PCB_FULLCTX,PCB_FLAGS(%rax)


More information about the p4-projects mailing list