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