summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/shared/start/start.S
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2014-12-03 11:35:52 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2014-12-04 12:51:11 +0100
commitdff1803cfbec3775fff1b9c34cc707c05494dc3b (patch)
treedbb8850d94b30f8388f9e3df9a68fc6c99855f74 /c/src/lib/libbsp/sparc/shared/start/start.S
parentpc386 bsp fix for default mode (diff)
downloadrtems-dff1803cfbec3775fff1b9c34cc707c05494dc3b.tar.bz2
SPARC: optimize IRQ enable & disable
* Coding style cleanups. * Use OS reserved trap 0x89 for IRQ Disable * Use OS reserved trap 0x8A for IRQ Enable * Add to SPARC CPU supplement documentation This will result in faster Disable/Enable code since the system trap handler does not need to decode which function the user wants. Besides the IRQ disable/enabled can now be inline which avoids the caller to take into account that o0-o7+g1-g4 registers are destroyed by trap handler. It was also possible to reduce the interrupt trap handler by five instructions due to this.
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/start/start.S')
-rw-r--r--c/src/lib/libbsp/sparc/shared/start/start.S30
1 files changed, 25 insertions, 5 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/start/start.S b/c/src/lib/libbsp/sparc/shared/start/start.S
index 3e0e42e7df..f38fe8cb99 100644
--- a/c/src/lib/libbsp/sparc/shared/start/start.S
+++ b/c/src/lib/libbsp/sparc/shared/start/start.S
@@ -35,11 +35,20 @@
/*
* System call optimized trap table entry
*/
-#define SYSCALL_TRAP(_vector, _handler) \
+#define IRQDIS_TRAP(_handler) \
mov %psr, %l0 ; \
sethi %hi(_handler), %l4 ; \
jmp %l4+%lo(_handler); \
- subcc %g1, 3, %g0; ! prepare for syscall 3 check
+ or %l0, 0x0f00, %l3; ! Set PIL=0xf to disable IRQ
+
+/*
+ * System call optimized trap table entry
+ */
+#define IRQEN_TRAP(_handler) \
+ mov %psr, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ andn %l0, 0xf00, %l3; ! Set PIL=0 to Enable IRQ
/*
* Window Overflow optimized trap table entry
@@ -183,12 +192,23 @@ SYM(CLOCK_SPEED):
* installed before.
*/
- SYSCALL_TRAP( 0x80, SYM(syscall) ); ! 80 syscall SW trap
- SOFT_TRAP; SOFT_TRAP; ! 81 - 82
+ TRAP( 0x80, SYM(syscall) ); ! 80 halt syscall SW trap
+ SOFT_TRAP; SOFT_TRAP; ! 81 - 82
TRAP( 0x83, SYM(window_flush_trap_handler) ); ! 83 flush windows SW trap
SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 84 - 87
- SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 88 - 8B
+ SOFT_TRAP; ! 88
+
+ /*
+ * SW Trap 9-15 Reserved for Operating System
+ *
+ * SPARC_SWTRAP_IRQDIS
+ * SPARC_SWTRAP_IRQEN
+ */
+ IRQDIS_TRAP(SYM(syscall_irqdis)); ! 89 IRQ Disable syscall trap
+ IRQEN_TRAP(SYM(syscall_irqen)); ! 8A IRQ Enable syscall trap
+
+ SOFT_TRAP; ! 8B
SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 8C - 8F
SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 90 - 93
SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 94 - 97