Unified · Split
| @@ -1,3 +1,5 @@ | |||
| 1 | 200090612 | ||
| 2 | added support for Linux-power (ericvh; and further simplified) | ||
| 1 | 20090605 | 3 | 20090605 |
| 2 | appl/cmd/disk/kfs.b dis/disk/kfs.dis - don't try to update super block if readonly(!) [issue 175] | 4 | appl/cmd/disk/kfs.b dis/disk/kfs.dis - don't try to update super block if readonly(!) [issue 175] |
| 3 | 20090526 | 5 | 20090526 |
| @@ -1,57 +1,80 @@ | |||
| 1 | #include <asm-ppc/reg.h> | 1 | .align 2 |
| 2 | 2 | .global FPsave | |
| 3 | .file "asm-power.S" | ||
| 4 | .section ".text" | ||
| 5 | .align 2 | ||
| 6 | .globl FPsave | ||
| 7 | .type FPsave, @function | ||
| 8 | FPsave: | 3 | FPsave: |
| 9 | .set _framesize,0 | 4 | stfd %f14,0*8(%r3) |
| 10 | mffs f0 | 5 | stfd %f15,1*8(%r3) |
| 11 | stfd f0,0(r3) | 6 | stfd %f16,2*8(%r3) |
| 7 | stfd %f17,3*8(%r3) | ||
| 8 | stfd %f18,4*8(%r3) | ||
| 9 | stfd %f19,5*8(%r3) | ||
| 10 | stfd %f20,6*8(%r3) | ||
| 11 | stfd %f21,7*8(%r3) | ||
| 12 | stfd %f22,8*8(%r3) | ||
| 13 | stfd %f23,9*8(%r3) | ||
| 14 | stfd %f24,10*8(%r3) | ||
| 15 | stfd %f25,11*8(%r3) | ||
| 16 | stfd %f26,12*8(%r3) | ||
| 17 | stfd %f27,13*8(%r3) | ||
| 18 | stfd %f28,14*8(%r3) | ||
| 19 | stfd %f29,15*8(%r3) | ||
| 20 | stfd %f30,16*8(%r3) | ||
| 21 | stfd %f31,17*8(%r3) | ||
| 12 | blr | 22 | blr |
| 13 | .size FPsave,.-FPsave | ||
| 14 | 23 | ||
| 15 | .align 2 | 24 | .align 2 |
| 16 | .globl FPrestore | 25 | .global FPrestore |
| 17 | FPrestore: | 26 | FPrestore: |
| 18 | lfd f0,0(r3) | 27 | lfd %f14,0*8(%r3) |
| 19 | mtfsf 0xff,f0 | 28 | lfd %f15,1*8(%r3) |
| 29 | lfd %f16,2*8(%r3) | ||
| 30 | lfd %f17,3*8(%r3) | ||
| 31 | lfd %f18,4*8(%r3) | ||
| 32 | lfd %f19,5*8(%r3) | ||
| 33 | lfd %f20,6*8(%r3) | ||
| 34 | lfd %f21,7*8(%r3) | ||
| 35 | lfd %f22,8*8(%r3) | ||
| 36 | lfd %f23,9*8(%r3) | ||
| 37 | lfd %f24,10*8(%r3) | ||
| 38 | lfd %f25,11*8(%r3) | ||
| 39 | lfd %f26,12*8(%r3) | ||
| 40 | lfd %f27,13*8(%r3) | ||
| 41 | lfd %f28,14*8(%r3) | ||
| 42 | lfd %f29,15*8(%r3) | ||
| 43 | lfd %f30,16*8(%r3) | ||
| 44 | lfd %f31,17*8(%r3) | ||
| 20 | blr | 45 | blr |
| 21 | .size FPrestore, .-FPrestore | ||
| 22 | 46 | ||
| 23 | .align 2 | 47 | .align 2 |
| 24 | .globl _tas | 48 | .global _tas |
| 25 | _tas: | 49 | _tas: |
| 26 | sync | 50 | sync |
| 27 | mr r4,r3 | 51 | mr %r4, %r3 |
| 28 | addi r5,0,0x1 | 52 | addi %r5,0,0x1 |
| 29 | 1: | 53 | 1: |
| 30 | lwarx r3,0,r4 | 54 | lwarx %r3, 0, %r4 |
| 31 | cmpwi r3,0x0 | 55 | cmpwi %r3, 0 |
| 32 | bne- 2f | 56 | bne- 2f |
| 33 | stwcx. r5,0,r4 | 57 | stwcx. %r5, 0, %r4 |
| 34 | bne- 1b /* Lost reservation, try again */ | 58 | bne- 1b |
| 35 | 2: | 59 | 2: |
| 36 | sync | 60 | sync |
| 37 | blr | 61 | blr |
| 38 | .size _tas,.-_tas | ||
| 39 | 62 | ||
| 40 | /* | 63 | /* |
| 41 | * void executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg) | 64 | * void |
| 65 | * executeonnewstack(void *tos, void (*tramp)(void *arg), void *arg) | ||
| 42 | */ | 66 | */ |
| 43 | .align 2 | 67 | .align 2 |
| 44 | .globl executeonnewstack: | 68 | .global executeonnewstack |
| 45 | executeonnewstack: | 69 | executeonnewstack: |
| 46 | mr r1,r3 /* change stacks */ | 70 | mr %r1,%r3 /* change stacks */ |
| 47 | stwu 1,-16(r1) /* save lr to aid the traceback */ | 71 | stwu %lr,-16(%r1) /* save lr to aid the traceback */ |
| 48 | li r0,0 | 72 | li %r0,0 |
| 49 | stw r0,20(r1) | 73 | stw %r0,20(%r1) |
| 50 | mr r3,r5 | 74 | mr %r3,%r5 |
| 51 | mtctr r4 | 75 | mtctr %r4 |
| 52 | bctrl /* tramp(arg) */ | 76 | bctrl /* tramp(arg) */ |
| 53 | br . /* failed */ | 77 | br |
| 54 | .size executeonnewstack,.-executeonnewstack | ||
| 55 | 78 | ||
| 56 | /* | 79 | /* |
| 57 | * void unlockandexit(int *key) | 80 | * void unlockandexit(int *key) |
| @@ -63,10 +86,9 @@ executeonnewstack: · 5 unmodified lines | |||
| 63 | .align 2 | 86 | .align 2 |
| 64 | .globl unlockandexit | 87 | .globl unlockandexit |
| 65 | unlockandexit: | 88 | unlockandexit: |
| 66 | li r0,0x0 | 89 | li %r0,0x0 |
| 67 | stw r0,0(r3) /* unlock */ | 90 | stw %r0,0(%r3) /* unlock */ |
| 68 | li r0,1 /* sys exit; 234 is exit group */ | 91 | li %r0,1 /* sys exit; 234 is exit group */ |
| 69 | li r3,0 /* exit status */ | 92 | li %r3,0 /* exit status */ |
| 70 | sc | 93 | sc |
| 71 | br . /* not reached */ | 94 | br |
| 72 | .size unlockandexit,.-unlockandexit | ||
| @@ -16,7 +16,7 @@ segflush(void *a, ulong n) · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | // cache blocks are often eight words (32 bytes) long, sometimes 16 bytes. | 17 | // cache blocks are often eight words (32 bytes) long, sometimes 16 bytes. |
| 18 | // need to determine it dynamically? | 18 | // need to determine it dynamically? |
| 19 | for (p = (ulong *)((ulong)a & ~3UL); (char *)p < (char *)a + n; p++) | 19 | for (p = (ulong *)((ulong)a & ~7UL); (char *)p < (char *)a + n; p++) |
| 20 | __asm__("dcbst 0,%0\n\t" // not dcbf, which writes back, then invalidates | 20 | __asm__("dcbst 0,%0\n\t" // not dcbf, which writes back, then invalidates |
| 21 | "icbi 0,%0\n\t" | 21 | "icbi 0,%0\n\t" |
| 22 | : // no output | 22 | : // no output |
| @@ -1 +1 @@ | |||
| 1 | #define VERSION "Fourth Edition (20090605)" | 1 | #define VERSION "Fourth Edition (20090612)" |
| @@ -25,6 +25,10 @@ Linux · 24 unmodified lines | |||
| 25 | bin | 25 | bin |
| 26 | include | 26 | include |
| 27 | lib | 27 | lib |
| 28 | power | ||
| 29 | bin | ||
| 30 | include | ||
| 31 | lib | ||
| 28 | spim | 32 | spim |
| 29 | bin | 33 | bin |
| 30 | include | 34 | include |
| @@ -0,0 +1,12 @@ | |||
| 1 | #include <lib9.h> | ||
| 2 | |||
| 3 | ulong | ||
| 4 | getcallerpc(void *x) | ||
| 5 | { | ||
| 6 | ulong *lp; | ||
| 7 | |||
| 8 | lp = x; | ||
| 9 | |||
| 10 | return lp[-1]; | ||
| 11 | } | ||
| 12 | |||
| @@ -413,7 +413,7 @@ sub(Opcode *o, Instr *i) · 412 unmodified lines | |||
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | static void | 415 | static void |
| 416 | div(Opcode *o, Instr *i) | 416 | idiv(Opcode *o, Instr *i) |
| 417 | { | 417 | { |
| 418 | format(o->mnemonic, i, 0); | 418 | format(o->mnemonic, i, 0); |
| 419 | if(i->op == 31) | 419 | if(i->op == 31) |
| @@ -554,8 +554,8 @@ static Opcode opcodes[] = { · 134 unmodified lines | |||
| 554 | {31, 246, ALL, "DCBTST", dcb, 0}, | 554 | {31, 246, ALL, "DCBTST", dcb, 0}, |
| 555 | {31, 1014, ALL, "DCBZ", dcb, 0}, | 555 | {31, 1014, ALL, "DCBZ", dcb, 0}, |
| 556 | 556 | ||
| 557 | {31, 491, OEM, "DIVW%V%C", div, ir3}, | 557 | {31, 491, OEM, "DIVW%V%C", idiv, ir3}, |
| 558 | {31, 459, OEM, "DIVWU%V%C", div, ir3}, | 558 | {31, 459, OEM, "DIVWU%V%C", idiv, ir3}, |
| 559 | 559 | ||
| 560 | {31, 310, ALL, "ECIWX", ldx, 0}, | 560 | {31, 310, ALL, "ECIWX", ldx, 0}, |
| 561 | {31, 438, ALL, "ECOWX", stx, 0}, | 561 | {31, 438, ALL, "ECOWX", stx, 0}, |
| @@ -647,7 +647,7 @@ static Opcode opcodes[] = { · 85 unmodified lines | |||
| 647 | {31, 242, ALL, "MOVW", gen, "R%s,SEG(R%b)"}, | 647 | {31, 242, ALL, "MOVW", gen, "R%s,SEG(R%b)"}, |
| 648 | 648 | ||
| 649 | {31, 235, OEM, "MULLW%V%C", gencc, ir3}, | 649 | {31, 235, OEM, "MULLW%V%C", gencc, ir3}, |
| 650 | {7, 0, 0, "MULLW", div, "%i,R%a,R%d"}, | 650 | {7, 0, 0, "MULLW", idiv, "%i,R%a,R%d"}, |
| 651 | 651 | ||
| 652 | {31, 476, ALL, "NAND%C", gencc, il3}, | 652 | {31, 476, ALL, "NAND%C", gencc, il3}, |
| 653 | {31, 104, OEM, "NEG%V%C", neg, ir2}, | 653 | {31, 104, OEM, "NEG%V%C", neg, ir2}, |