summaryrefslogtreecommitdiff
path: root/emu/Linux
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2009-06-12 18:34:15 +0000
committerCharles.Forsyth <devnull@localhost>2009-06-12 18:34:15 +0000
commitd2caef7bfa67181341fe2f1cbf68884ae6e45639 (patch)
tree1a2ebabf87a883d4886351007af33aa6ca5fd4ed /emu/Linux
parentf4ab6bd1adbb9bff11da6885084de2ed31f2a415 (diff)
20090612-1932
Diffstat (limited to 'emu/Linux')
-rw-r--r--emu/Linux/asm-power.S108
-rw-r--r--emu/Linux/segflush-power.c2
2 files changed, 66 insertions, 44 deletions
diff --git a/emu/Linux/asm-power.S b/emu/Linux/asm-power.S
index ff5f97cd..6af21fba 100644
--- a/emu/Linux/asm-power.S
+++ b/emu/Linux/asm-power.S
@@ -1,57 +1,80 @@
-#include <asm-ppc/reg.h>
-
- .file "asm-power.S"
- .section ".text"
- .align 2
- .globl FPsave
- .type FPsave, @function
+ .align 2
+ .global FPsave
FPsave:
- .set _framesize,0
- mffs f0
- stfd f0,0(r3)
+ stfd %f14,0*8(%r3)
+ stfd %f15,1*8(%r3)
+ stfd %f16,2*8(%r3)
+ stfd %f17,3*8(%r3)
+ stfd %f18,4*8(%r3)
+ stfd %f19,5*8(%r3)
+ stfd %f20,6*8(%r3)
+ stfd %f21,7*8(%r3)
+ stfd %f22,8*8(%r3)
+ stfd %f23,9*8(%r3)
+ stfd %f24,10*8(%r3)
+ stfd %f25,11*8(%r3)
+ stfd %f26,12*8(%r3)
+ stfd %f27,13*8(%r3)
+ stfd %f28,14*8(%r3)
+ stfd %f29,15*8(%r3)
+ stfd %f30,16*8(%r3)
+ stfd %f31,17*8(%r3)
blr
- .size FPsave,.-FPsave
- .align 2
- .globl FPrestore
+ .align 2
+ .global FPrestore
FPrestore:
- lfd f0,0(r3)
- mtfsf 0xff,f0
+ lfd %f14,0*8(%r3)
+ lfd %f15,1*8(%r3)
+ lfd %f16,2*8(%r3)
+ lfd %f17,3*8(%r3)
+ lfd %f18,4*8(%r3)
+ lfd %f19,5*8(%r3)
+ lfd %f20,6*8(%r3)
+ lfd %f21,7*8(%r3)
+ lfd %f22,8*8(%r3)
+ lfd %f23,9*8(%r3)
+ lfd %f24,10*8(%r3)
+ lfd %f25,11*8(%r3)
+ lfd %f26,12*8(%r3)
+ lfd %f27,13*8(%r3)
+ lfd %f28,14*8(%r3)
+ lfd %f29,15*8(%r3)
+ lfd %f30,16*8(%r3)
+ lfd %f31,17*8(%r3)
blr
- .size FPrestore, .-FPrestore
- .align 2
- .globl _tas
+ .align 2
+ .global _tas
_tas:
sync
- mr r4,r3
- addi r5,0,0x1
+ mr %r4, %r3
+ addi %r5,0,0x1
1:
- lwarx r3,0,r4
- cmpwi r3,0x0
- bne- 2f
- stwcx. r5,0,r4
- bne- 1b /* Lost reservation, try again */
+ lwarx %r3, 0, %r4
+ cmpwi %r3, 0
+ bne- 2f
+ stwcx. %r5, 0, %r4
+ bne- 1b
2:
sync
blr
- .size _tas,.-_tas
/*
- * void executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg)
+ * void
+ * executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg)
*/
.align 2
- .globl executeonnewstack:
+ .global executeonnewstack
executeonnewstack:
- mr r1,r3 /* change stacks */
- stwu 1,-16(r1) /* save lr to aid the traceback */
- li r0,0
- stw r0,20(r1)
- mr r3,r5
- mtctr r4
- bctrl /* tramp(arg) */
- br . /* failed */
- .size executeonnewstack,.-executeonnewstack
+ mr %r1,%r3 /* change stacks */
+ stwu %lr,-16(%r1) /* save lr to aid the traceback */
+ li %r0,0
+ stw %r0,20(%r1)
+ mr %r3,%r5
+ mtctr %r4
+ bctrl /* tramp(arg) */
+ br
/*
* void unlockandexit(int *key)
@@ -63,10 +86,9 @@ executeonnewstack:
.align 2
.globl unlockandexit
unlockandexit:
- li r0,0x0
- stw r0,0(r3) /* unlock */
- li r0,1 /* sys exit; 234 is exit group */
- li r3,0 /* exit status */
+ li %r0,0x0
+ stw %r0,0(%r3) /* unlock */
+ li %r0,1 /* sys exit; 234 is exit group */
+ li %r3,0 /* exit status */
sc
- br . /* not reached */
- .size unlockandexit,.-unlockandexit
+ br
diff --git a/emu/Linux/segflush-power.c b/emu/Linux/segflush-power.c
index 8fa58189..0804d686 100644
--- a/emu/Linux/segflush-power.c
+++ b/emu/Linux/segflush-power.c
@@ -16,7 +16,7 @@ segflush(void *a, ulong n)
// cache blocks are often eight words (32 bytes) long, sometimes 16 bytes.
// need to determine it dynamically?
- for (p = (ulong *)((ulong)a & ~3UL); (char *)p < (char *)a + n; p++)
+ for (p = (ulong *)((ulong)a & ~7UL); (char *)p < (char *)a + n; p++)
__asm__("dcbst 0,%0\n\t" // not dcbf, which writes back, then invalidates
"icbi 0,%0\n\t"
: // no output