diff options
| author | forsyth <forsyth@vitanuova.com> | 2010-02-13 21:14:07 +0000 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2010-02-13 21:14:07 +0000 |
| commit | aee7f58dfcd519d45482e45ab1ce6026c846dc21 (patch) | |
| tree | 625f826e28ad2b461bf6c89fd75d56508000239a | |
| parent | ef8c4b7cc9976629fb7fab3bee406a42e6a2dece (diff) | |
20100213-2114
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | emu/port/devfs-posix.c | 5 | ||||
| -rw-r--r-- | include/version.h | 2 | ||||
| -rw-r--r-- | libkern/div-thumb.s | 119 | ||||
| -rw-r--r-- | libkern/mkfile-thumb | 1 | ||||
| -rw-r--r-- | mkfiles/mkfile-os-thumb | 6 | ||||
| -rw-r--r-- | os/port/portmkfile | 2 | ||||
| -rw-r--r-- | utils/5l/span.c | 2 |
8 files changed, 129 insertions, 10 deletions
@@ -1,3 +1,5 @@ +20100213 + apply saoret.one's changes for thumb [issue 155] 20100205 update man pages to replace most references to Styx by 9P update man pages to replace references to sys-dial(2) by dial(2) diff --git a/emu/port/devfs-posix.c b/emu/port/devfs-posix.c index 1ce6af40..7372f589 100644 --- a/emu/port/devfs-posix.c +++ b/emu/port/devfs-posix.c @@ -750,7 +750,7 @@ fsdirread(Chan *c, uchar *va, int count, vlong offset) struct stat stbuf; char path[MAXPATH], *ep; struct dirent *de; - static char slop[8192]; + static uchar slop[8192]; i = 0; fspath(FS(c)->name, "", path); @@ -951,7 +951,6 @@ static User* newuname(char *name) { struct passwd *p; - User *u; p = getpwnam(name); if(p == nil) @@ -963,7 +962,6 @@ static User* newuid(int id) { struct passwd *p; - User *u; p = getpwuid(id); if(p == nil) @@ -1010,7 +1008,6 @@ newgname(char *name) static User* id2user(User **tab, int id, User* (*get)(int)) { - int i; User *u, **h; h = hashuser(tab, id); diff --git a/include/version.h b/include/version.h index 4756a811..ea0b4213 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define VERSION "Fourth Edition (20100209)" +#define VERSION "Fourth Edition (20100213)" diff --git a/libkern/div-thumb.s b/libkern/div-thumb.s new file mode 100644 index 00000000..a08289f9 --- /dev/null +++ b/libkern/div-thumb.s @@ -0,0 +1,119 @@ +Q = 0 +N = 1 +D = 2 +CC = 3 +TMP = 11 + +TEXT save<>(SB), 1, $0 + MOVW R(Q), 0(FP) + MOVW R(N), 4(FP) + MOVW R(D), 8(FP) + MOVW R(CC), 12(FP) + + MOVW R(TMP), R(Q) /* numerator */ + MOVW 20(FP), R(D) /* denominator */ + CMP $0, R(D) + BNE s1 + SWI 0 +/* MOVW -1(R(D)), R(TMP) /* divide by zero fault */ +s1: RET + +TEXT rest<>(SB), 1, $0 + MOVW 0(FP), R(Q) + MOVW 4(FP), R(N) + MOVW 8(FP), R(D) + MOVW 12(FP), R(CC) +/* + * return to caller + * of rest<> + */ + MOVW 0(R13), R14 + ADD $20, R13 + B (R14) + +TEXT div<>(SB), 1, $0 + MOVW $32, R(CC) +/* + * skip zeros 8-at-a-time + */ +e1: + AND.S $(0xff<<24),R(Q), R(N) + BNE e2 + SLL $8, R(Q) + SUB.S $8, R(CC) + BNE e1 + RET +e2: + MOVW $0, R(N) + +loop: +/* + * shift R(N||Q) left one + */ + SLL $1, R(N) + CMP $0, R(Q) + ORR.LT $1, R(N) + SLL $1, R(Q) + +/* + * compare numerator to denominator + * if less, subtract and set quotent bit + */ + CMP R(D), R(N) + ORR.HS $1, R(Q) + SUB.HS R(D), R(N) + SUB.S $1, R(CC) + BNE loop + RET + +TEXT _div(SB), 1, $16 + BL save<>(SB) + CMP $0, R(Q) + BGE d1 + RSB $0, R(Q), R(Q) + CMP $0, R(D) + BGE d2 + RSB $0, R(D), R(D) +d0: + BL div<>(SB) /* none/both neg */ + MOVW R(Q), R(TMP) + B out +d1: + CMP $0, R(D) + BGE d0 + RSB $0, R(D), R(D) +d2: + BL div<>(SB) /* one neg */ + RSB $0, R(Q), R(TMP) + B out + +TEXT _mod(SB), 1, $16 + BL save<>(SB) + CMP $0, R(D) + RSB.LT $0, R(D), R(D) + CMP $0, R(Q) + BGE m1 + RSB $0, R(Q), R(Q) + BL div<>(SB) /* neg numerator */ + RSB $0, R(N), R(TMP) + B out +m1: + BL div<>(SB) /* pos numerator */ + MOVW R(N), R(TMP) + B out + +TEXT _divu(SB), 1, $16 + BL save<>(SB) + BL div<>(SB) + MOVW R(Q), R(TMP) + B out + +TEXT _modu(SB), 1, $16 + BL save<>(SB) + BL div<>(SB) + MOVW R(N), R(TMP) + B out + +out: + BL rest<>(SB) + B out diff --git a/libkern/mkfile-thumb b/libkern/mkfile-thumb index 4ccd1653..0b06b695 100644 --- a/libkern/mkfile-thumb +++ b/libkern/mkfile-thumb @@ -10,3 +10,4 @@ TARGFILES=\ strchr-thumb.$O\ vlop-thumb.$O\ vlrt-thumb.$O\ + div-thumb.$O\ diff --git a/mkfiles/mkfile-os-thumb b/mkfiles/mkfile-os-thumb index afe0cb6f..d9a9ec58 100644 --- a/mkfiles/mkfile-os-thumb +++ b/mkfiles/mkfile-os-thumb @@ -1,7 +1,7 @@ TARGMODEL= Inferno TARGSHTYPE= sh CPUS= arm -OBJDIR= Inferno/arm #force everything to point to inferno directory +OBJDIR= Inferno/thumb #force everything to point to inferno directory O= t OS= 5t @@ -11,10 +11,10 @@ ARFLAGS= vu ARPREFIX= AS= 5a -ASFLAGS= +ASFLAGS= -t CC= tc -CFLAGS= -wFV -I$ROOT/Inferno/arm/include -I$ROOT/include +CFLAGS= -wFV -I$ROOT/Inferno/thumb/include -I$ROOT/include ANSICPP= -p LD= 5l diff --git a/os/port/portmkfile b/os/port/portmkfile index 111cc81f..96a5ebc6 100644 --- a/os/port/portmkfile +++ b/os/port/portmkfile @@ -9,7 +9,7 @@ LIBFILES=${LIBS:%=$ROOT/Inferno/$OBJTYPE/lib/lib%.a} CLEANEXTRA= %.$O: %.s - $AS $stem.s + $AS $ASFLAGS $stem.s %.$O: %.c $CC $CFLAGS $stem.c diff --git a/utils/5l/span.c b/utils/5l/span.c index f91c776e..0b69a96f 100644 --- a/utils/5l/span.c +++ b/utils/5l/span.c @@ -266,7 +266,7 @@ span(void) loop: passes++; - if(passes > 100){ + if(passes > 150){ diag("span looping !"); errorexit(); } |
