summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/shared/start/start.S
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2014-05-26 15:22:12 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2014-05-28 17:33:22 +0200
commitd6f1ec91b6fd074e3a2b15f7ca8b2a8c73a39484 (patch)
tree811725cdfc49acf88fa10febf6c60965225c242b /c/src/lib/libbsp/sparc/shared/start/start.S
parentLEON3: coding style clean bsp_irq_fixup() (diff)
downloadrtems-d6f1ec91b6fd074e3a2b15f7ca8b2a8c73a39484.tar.bz2
SPARC: syscall optimizations and PSR-write fix
The last optimization missed was incorrect in regards to PSR write instruction delay must be 3 instructions. New optimizations: * align to 32-byte cache line. * rearrange code into three "blocks" of 4 instructions that is executed by syscall 2 and 3. This is to optimize for 16/32 byte cache lines. * use delay-slot instruction in trap table to reduce by one instruction. * use the fact that "wr %PSR" implements XOR to reduce by one instruction.
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/start/start.S')
-rw-r--r--c/src/lib/libbsp/sparc/shared/start/start.S11
1 files changed, 10 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/start/start.S b/c/src/lib/libbsp/sparc/shared/start/start.S
index 65dd559376..070387ff1e 100644
--- a/c/src/lib/libbsp/sparc/shared/start/start.S
+++ b/c/src/lib/libbsp/sparc/shared/start/start.S
@@ -33,6 +33,15 @@
nop;
/*
+ * System call optimized trap table entry
+ */
+#define SYSCALL_TRAP(_vector, _handler) \
+ mov %psr, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ subcc %g1, 3, %g0; ! prepare for syscall 3 check
+
+/*
* Software trap. Treat as BAD_TRAP for the time being...
*/
@@ -156,7 +165,7 @@ SYM(CLOCK_SPEED):
* installed before.
*/
- TRAP( 0x80, SYM(syscall) ); ! 80 syscall SW trap
+ SYSCALL_TRAP( 0x80, SYM(syscall) ); ! 80 syscall SW trap
SOFT_TRAP; SOFT_TRAP; ! 81 - 82
TRAP( 0x83, SYM(window_flush_trap_handler) ); ! 83 flush windows SW trap