Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2003 18:06:42 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29753 for review
Message-ID:  <200304260106.h3Q16g1k002410@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29753

Change 29753 by peter@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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304260106.h3Q16g1k002410>