PERFORCE change 29753 for review

Peter Wemm peter at FreeBSD.org
Fri Apr 25 18:06:44 PDT 2003


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

Change 29753 by peter at peter_daintree on 2003/04/25 18:06:27

	Optimize a little.  The cli is redundant, the only code path
	there is via the AST check which leaves interrupts disabled.
	Branch for the unusual case (full context restore), not the usual case.

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/exception.s#30 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/x86_64/exception.s#30 (text+ko) ====

@@ -229,9 +229,7 @@
 	call	syscall
 	movq	PCPU(CURPCB),%rax
 	testq	$PCB_FULLCTX,PCB_FLAGS(%rax)
-	je	1f
-	andq	$~PCB_FULLCTX,PCB_FLAGS(%rax)
-	jmp	doreti
+	jne	3f
 	/* simplified from doreti */
 1:	/* Check for and handle AST's on return to userland */
 	cli
@@ -243,7 +241,6 @@
 	call	ast
 	jmp	1b
 2:	/* restore preserved registers */
-	movq	TF_RSP(%rsp),%rdi	/* user stack pointer */
 	movq	TF_RAX(%rsp),%rax	/* return value 1 */
 	movq	TF_RDX(%rsp),%rdx	/* return value 2 */
 	movq	TF_RBX(%rsp),%rbx	/* C preserved */
@@ -254,10 +251,13 @@
 	movq	TF_R15(%rsp),%r15	/* C preserved */
 	movq	TF_RFLAGS(%rsp),%r11	/* original %rflags */
 	movq	TF_RIP(%rsp),%rcx	/* original %rip */
-	cli
+	movq	TF_RSP(%rsp),%rdi	/* user stack pointer */
 	movq	%rdi,%rsp		/* original %rsp */
 	#swapgs
 	sysretq
+3:	/* Requested full context restore, use doreti for that */
+	andq	$~PCB_FULLCTX,PCB_FLAGS(%rax)
+	jmp	doreti
 
 ENTRY(fork_trampoline)
 	movq	%r12, %rdi		/* function */


More information about the p4-projects mailing list