summaryrefslogtreecommitdiff
path: root/emu
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2009-04-01 22:54:06 +0000
committerCharles.Forsyth <devnull@localhost>2009-04-01 22:54:06 +0000
commit4eb166cf184c1f102fb79e31b1465ea3e2021c39 (patch)
tree0e1bd8c059324d5cb99d625a67398e48a9ffce95 /emu
parenta9b1d9c7f57ec21ff8be147f5c949966b966e519 (diff)
20090401-2350
Diffstat (limited to 'emu')
-rw-r--r--emu/Linux/asm-spim.S70
1 files changed, 70 insertions, 0 deletions
diff --git a/emu/Linux/asm-spim.S b/emu/Linux/asm-spim.S
new file mode 100644
index 00000000..5e281187
--- /dev/null
+++ b/emu/Linux/asm-spim.S
@@ -0,0 +1,70 @@
+#include "syscall.h"
+#include <sys/asm.h>
+#include <sys/regdef.h>
+#include <asm/cachectl.h>
+
+/*
+ * executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg)
+ */
+
+LEAF(executeonnewstack)
+ and a0,a0,~7
+ addu sp,a0,-16
+ move a0,a2
+ move t9,a1
+ jalr t9
+
+ li v0,SYS_exit
+ li a0,0
+ syscall
+
+ END(executeonnewstack)
+
+/*
+ * unlockandexit(int *key)
+ */
+
+LEAF(unlockandexit)
+ lw a1,0(a0)
+ li v0,SYS_exit
+ li a0,0
+ sw a0,0(a1)
+ syscall
+ END(unlockandexit)
+
+LEAF(FPsave)
+ cfc1 t0, $31
+ sw t0, 0(a0) /* a0 is argument */
+ j $31
+ END(FPsave)
+
+LEAF(FPrestore)
+ lw t0, 0(a0) /* a0 is argument */
+ ctc1 t0, $31
+ j $31
+ END(FPrestore)
+
+LEAF(_tas)
+ .set noreorder
+1:
+ ll v0,0(a0) /* a0 is argument */
+ or t1, v0, 1
+ sc t1,0(a0)
+ beq t1,zero,1b
+ nop
+ j $31 /* lock held */
+ nop
+ .set reorder
+ END(_tas)
+
+/*
+ * int segflush(void *p, ulong len)
+ */
+
+LEAF(segflush)
+ li a2,BCACHE
+ li v0,SYS_cacheflush
+ syscall
+ li v0,0
+ j $31
+ END(segflush)