summaryrefslogtreecommitdiff
path: root/emu/Solaris/asm-sparc.s
diff options
context:
space:
mode:
Diffstat (limited to 'emu/Solaris/asm-sparc.s')
-rw-r--r--emu/Solaris/asm-sparc.s76
1 files changed, 76 insertions, 0 deletions
diff --git a/emu/Solaris/asm-sparc.s b/emu/Solaris/asm-sparc.s
new file mode 100644
index 00000000..c53a0bc0
--- /dev/null
+++ b/emu/Solaris/asm-sparc.s
@@ -0,0 +1,76 @@
+
+ .section ".text", #alloc, #execinstr
+ .align 8
+ .skip 16
+ .global segflush
+ .type segflush,2
+
+ ! The flush instruction works on 8-byte chunks.
+ ! We truncate the pointer and increase the count
+ ! to make sure we flush the right range.
+
+ ! SPARC requires 5 instructions after flush to
+ ! let the caches settle. The loop code supplies
+ ! the delay instructions.
+
+segflush: ! int segflush(void *p, ulong len)
+
+ and %o0,-8,%o0 ! clear low 3 bits of p
+ add %o1, 7, %o1 ! len += 7
+1:
+ flush %o0 ! synchronize cache
+ sub %o1, 8, %o1 ! len -= 8
+ cmp %o1, 0 ! if len > 0, repeat
+ bg 1b
+ add %o0, 8, %o0 ! p += 8 in delay slot
+
+ retl
+ add %g0, %g0, %o0 ! return 0
+ .size segflush,(.-segflush)
+
+
+ .section ".text", #alloc, #execinstr
+ .align 8
+ .skip 16
+ .global FPsave
+ .type FPsave,2
+FPsave:
+ retl
+ st %fsr,[%o0]
+ .size FPsave,(.-FPsave)
+
+
+ .section ".text", #alloc, #execinstr
+ .align 8
+ .skip 16
+ .global FPrestore
+ .type FPrestore,2
+FPrestore:
+ retl
+ ld [%o0],%fsr
+ .size FPrestore,(.-FPrestore)
+
+
+ .section ".text", #alloc, #execinstr
+ .align 8
+ .skip 16
+ .global getcallerpc
+ .type getcallerpc, 2
+getcallerpc: ! ignore argument
+ retl
+ add %i7,0,%o0
+
+ .size getcallerpc,(.-getcallerpc)
+
+
+ .section ".text", #alloc, #execinstr
+ .align 8
+ .skip 16
+ .global _tas
+ .type _tas, 2
+_tas:
+ or %g0,1,%o1
+ swap [%o0],%o1
+ retl
+ or %g0,%o1,%o0
+ .size _tas,(.-_tas)