[rtems commit] SPARC: syscall code clean-up and minor optimizations

Joel Sherrill joel at rtems.org
Fri May 23 14:06:12 UTC 2014


Module:    rtems
Branch:    master
Commit:    434e7f7bee74fbd5467a7c8d239bb3faf8880044
Changeset: http://git.rtems.org/rtems/commit/?id=434e7f7bee74fbd5467a7c8d239bb3faf8880044

Author:    Daniel Hellstrom <daniel at gaisler.com>
Date:      Fri May 23 08:52:15 2014 -0500

SPARC: syscall code clean-up and minor optimizations

---

 c/src/lib/libcpu/sparc/syscall/syscall.S |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/c/src/lib/libcpu/sparc/syscall/syscall.S b/c/src/lib/libcpu/sparc/syscall/syscall.S
index aa69f45..2d53ebe 100644
--- a/c/src/lib/libcpu/sparc/syscall/syscall.S
+++ b/c/src/lib/libcpu/sparc/syscall/syscall.S
@@ -37,42 +37,37 @@ SYM(syscall):
 
 	subcc   %g1, 2, %g0		! syscall 2, disable interrupts
 	bne 	3f
+	 subcc   %g1, 3, %g0		! syscall 3, enable interrupts
 	or    	%l0, 0x0f00, %l4	! set PIL=15
-	mov   	%l4, %psr
-	or	%l0, SPARC_PSR_ET_MASK, %i0	! return old psr with ET=1
-	ba,a	9f
+	ba	9f
+	 or	%l0, SPARC_PSR_ET_MASK, %i0	! return old psr with ET=1
 3:
-	subcc   %g1, 3, %g0		! syscall 3, enable interrupts
 	bne 	1f
-	and	%i0, SPARC_PSR_PIL_MASK, %l4
+	 and	%i0, SPARC_PSR_PIL_MASK, %l4
 	andn	%l0, SPARC_PSR_PIL_MASK, %l5
 	or	%l5, %l4, %l4
-	mov   	%l4, %psr
-	ba,a	9f
-
-1:
-	ta	0			! halt
 9:					! leave
+	mov   	%l4, %psr		! Update PSR according to Syscall 2 or 3
 	mov	0, %g1			! clear %g1
-        jmpl    %l2, %g0
-        rett    %l2 + 4
+	jmpl    %l2, %g0
+	 rett    %l2 + 4
+1:
+	ta	0			! syscall 1 (not 2 or 3), halt
 
         PUBLIC(sparc_disable_interrupts)
 
 SYM(sparc_disable_interrupts):
 
 	mov	SYS_irqdis, %g1
-	ta	0
 	retl
-	nop
+	 ta	0
 
         PUBLIC(sparc_enable_interrupts)
 
 SYM(sparc_enable_interrupts):
 
 	mov	SYS_irqen, %g1
-	ta	0
 	retl
-	nop
+	 ta	0
 
 /* end of file */




More information about the vc mailing list