* [9front] [PATCH] mk for only supported archs @ 2021-08-17 14:00 unobe 2021-08-17 15:53 ` Amavect 2021-08-18 3:00 ` ori 0 siblings, 2 replies; 9+ messages in thread From: unobe @ 2021-08-17 14:00 UTC (permalink / raw) To: 9front http://fqa.9front.org/fqa1.html#1.2 states the supported archs. However, clean and nuke also remove build files for 0 (spim) and q (power). 'mk all' using those archs fails; 'mk kernels' also tries to build all the kernels, even those which are not supported. For example, I tried to build the power arch (qc, qa, ql) and without surprise it failed (when building dtracy): ... mk dtracy qc -FTVw dtracy.c yacc -v -d -D1 parse.y qc -FTVw cgen.c qc -FTVw act.c qc -FTVw type.c == regfree == REGISTER R0 <11> STRUCT DTAct cgen.c:302 == regfree == REGISTER R0 <11> STRUCT DTAct act.c:266 == regfree == qc -FTVw agg.c cgen.c:299 unknown type in regalloc: STRUCT DTAct cgen.c:299 bad opcode in gmove INT -> STRUCT DTAct cgen.c:302 unknown type in regalloc: STRUCT DTAct cgen.c:302 bad opcode in gmove INT -> STRUCT DTAct cgen.c:302 error in regfree: 0 [0] REGISTERmk: qc -FTVw cgen.c : exit status=rc 387386: qc 387392: error R0 <11> STRUCT DTAct act.c:269 act.c:250 unknown type in regalloc: STRUCT DTAct act.c:250 bad opcode in gmove INT -> STRUCT DTAct act.c:266 unknown type in regalloc: STRUCT DTAct act.c:266 bad opcode in gmove INT -> STRUCT DTAct act.c:266 error in regfree: 0 [0] act.c:269 unknown type in regalloc: STRUCT DTAct act.c:269 bad opcode in gmove INT -> STRUCT DTAct act.c:269 error in regfree: 0 [0] act.c:274 unknown type in regalloc: STRUCT DTAct act.c:274 bad opcode in gmove INT -> STRUCT DTAct act.c:274 error in regfree: 0 [0] too many errors mk: for(i in cc ... : exit status=rc 382748: rc 387379: mk 387381: error mk: date for (i ... : exit status=rc 373781: rc 382226: mk 382227: error cpu% The patch below skips over non-supported architectures. Is that something we want? This way, 'mk kernels' should work without a problem (tested on amd64). Then if someone works on getting those architectures supported again in the future, they can be added back in. --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/9/mkfile +++ /sys/src/9/mkfile @@ -3,11 +3,13 @@ bcm64\ cycv\ kw\ - mtx\ +# power arch:\ +# mtx\ omap\ pc\ pc64\ - ppc\ +# power arch:\ +# ppc\ sgi\ teg2\ xen\ --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/boot/zynq/mkfile +++ /sys/src/boot/zynq/mkfile @@ -7,6 +7,9 @@ all:V: $TARG +install:V: + echo install not supported >[1=2] + clean:V: rm -rf $TARG *.$O @{objtype=$cputype mk -f mkfile.port clean} --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/mkfile +++ /sys/src/mkfile @@ -1,5 +1,12 @@ </$objtype/mkfile +SUPPORTED_OBJS=\ + 386\ + amd64\ + arm\ + arm64\ + mips\ + LIBS=\ lib9p\ libString\ @@ -52,10 +59,14 @@ all install clean nuke:VQ: date - for (i in $LIBS $SUBSYS $CMDS) @{ - cd $i - mk $target + if (~ $objtype $SUPPORTED_OBJS) { + for (i in $LIBS $SUBSYS $CMDS) @{ + cd $i + mk $target + } } + if not + echo $objtype arch not supported by 9front >[1=2] date installall:V: @@ -62,11 +73,15 @@ echo "installall not supported" release:V: - mk nuke - rm -f /$objtype/lib/ape/*.a - rm -f /$objtype/lib/*.a - mk install - mk clean + if (~ $objtype $SUPPORTED_OBJS) { + mk nuke + rm -f /$objtype/lib/ape/*.a + rm -f /$objtype/lib/*.a + mk install + mk clean + } + if not + echo $objtype architecture not supported >[1=2] kernels:V: for (i in 9 boot) @{ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-17 14:00 [9front] [PATCH] mk for only supported archs unobe @ 2021-08-17 15:53 ` Amavect 2021-08-17 20:15 ` unobe 2021-08-18 3:00 ` ori 1 sibling, 1 reply; 9+ messages in thread From: Amavect @ 2021-08-17 15:53 UTC (permalink / raw) To: 9front This patch can be made cleaner. Just remove spim from $CPUS in mkfile.proto, and add powerpc detection in cmd/mkfile. I have work on revising the system mkfiles. It's pretty old because there felt like a lack of interest, and I took a sizeable break. Some people had recently encouraged me to try again, so I will make a new patch request soon. I have a few changes that I want to push later tonight before doing so. Feel free to look through it as it is and provide any thoughts. I don't believe I have any fix for mk kernels yet. https://git.sr.ht/~amavect/mkfilechanges Thanks, Amavect ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-17 15:53 ` Amavect @ 2021-08-17 20:15 ` unobe 2021-08-21 8:27 ` unobe 0 siblings, 1 reply; 9+ messages in thread From: unobe @ 2021-08-17 20:15 UTC (permalink / raw) To: 9front Quoth Amavect <amavect@gmail.com>: > This patch can be made cleaner. > Just remove spim from $CPUS in mkfile.proto, Oy, I can't believe I overlooked that file. I've updated the patch (see below). > and add powerpc detection in cmd/mkfile. I added a detection to not make dtracy on powerpc and everything else under /sys/src/cmd built. It's included in the patch below. I'm testing that all the "supported" archs build. Even tho' ppc cmd now builds, the two powerpc kernels (mtx and ppc) still fail for different reasons. This is the rc script I use: #!/bin/rc echo Updating system sysupdate || exit 'sysupdate failed' . /sys/lib/rootstub cd /sys/src objtypes_default=`{cat mkfile.proto| grep 'CPUS=' | sed -e 's/CPUS=//'} if (~ $objtypes '') objtypes=($cputype `{{for (f in $cputype $objtypes_default) echo $f} | sort | uniq -u}) for (objtype in $objtypes) for (mk in nuke all install clean) mk $mk || exit 'mk '^$mk^' failed for '^$objtype cd /sys/man mk || exit '/sys/man failed' cd /sys/doc mk || exit '/sys/doc failed' cd /sys/src mk kernels || exit 'mk kernels failed' > I have work on revising the system mkfiles. > It's pretty old because there felt like a lack of interest, > and I took a sizeable break. > Some people had recently encouraged me to try again, > so I will make a new patch request soon. > I have a few changes that I want to push later tonight before doing so. > Feel free to look through it as it is and provide any thoughts. > > I don't believe I have any fix for mk kernels yet. > > https://git.sr.ht/~amavect/mkfilechanges Thanks for the link. I remember you working on this, but didn't follow it closely. --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/9/mkfile +++ /sys/src/9/mkfile @@ -3,11 +3,13 @@ bcm64\ cycv\ kw\ - mtx\ +# multiple build errors: raven.c and trap.c \ +# mtx\ omap\ pc\ pc64\ - ppc\ +# build errors: no recipe to make devce.q \ +# ppc\ sgi\ teg2\ xen\ --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/boot/zynq/mkfile +++ /sys/src/boot/zynq/mkfile @@ -7,6 +7,9 @@ all:V: $TARG +install:V: + echo install not supported >[1=2] + clean:V: rm -rf $TARG *.$O @{objtype=$cputype mk -f mkfile.port clean} --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/cmd/mkfile +++ /sys/src/cmd/mkfile @@ -8,8 +8,9 @@ YFLAGS=-d NOTSYS=sml|dup|.+\..+ +NOTPOWER=|dtracy PCONLY=|vmx -NOMK=$NOTSYS`{~ $objtype (386 amd64) || echo $PCONLY} +NOMK=$NOTSYS$NOTPOWER`{~ $objtype (386 amd64) || echo $PCONLY} cpuobjtype=`{sed -n 's/^O=//p' /$cputype/mkfile} DIRS=`{echo */mkfile | sed 's,/mkfile *,\n,g' | grep -v '^('$NOMK')$'} --- //.git/fs/object/cfebf83947550f3ae730cef4a9b1ab6bf6b8d4f7/tree//sys/src/mkfile.proto +++ /sys/src/mkfile.proto @@ -2,8 +2,8 @@ # common mkfile parameters shared by all architectures # -OS=05678qv -CPUS=spim arm arm64 amd64 386 power mips +OS=5678qv +CPUS=arm arm64 amd64 386 power mips CFLAGS=-FTVw LEX=lex YACC=yacc ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-17 20:15 ` unobe @ 2021-08-21 8:27 ` unobe 2021-08-22 14:15 ` cinap_lenrek 2021-08-22 14:33 ` cinap_lenrek 0 siblings, 2 replies; 9+ messages in thread From: unobe @ 2021-08-21 8:27 UTC (permalink / raw) To: 9front The mtx and ppc (ucu config) kernel now build. I've also added a Readme for the ppc kernel. I gleaned the Readme and some code from the Plan 9 kernel found on github; I assume it was updated after 9front had forked. I made some minor edits to Readme, but otherwise I left the code received as-is (namely, ppc/^(trap.c l.s devce.c) ). I did not see any manual page for devce. As for (emulated) hardware, QEMU emulates the G3 but not the G2. 'mk kernels' now completes without failure. Quoth unobe@cpan.org: > I'm testing that all the "supported" archs build. This is the rc > script I use: > > #!/bin/rc > echo Updating system > sysupdate || exit 'sysupdate failed' > . /sys/lib/rootstub > cd /sys/src > objtypes_default=`{cat mkfile.proto| grep 'CPUS=' | sed -e 's/CPUS=//'} > if (~ $objtypes '') > objtypes=($cputype `{{for (f in $cputype $objtypes_default) echo $f} | sort | uniq -u}) > for (objtype in $objtypes) > for (mk in nuke all install clean) > mk $mk || exit 'mk '^$mk^' failed for '^$objtype > > cd /sys/man > mk || exit '/sys/man failed' > > cd /sys/doc > mk || exit '/sys/doc failed' > > cd /sys/src > mk kernels || exit 'mk kernels failed' > --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/dat.h +++ /sys/src/9/mtx/dat.h @@ -71,6 +71,8 @@ FPinit, FPactive, FPinactive, + + FPillegal= 0x100, }; struct Confmem --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/devarch.c +++ /sys/src/9/mtx/devarch.c @@ -130,7 +130,6 @@ uchar *cp; ushort *sp; ulong *lp; - IOMap *m; Rdwrfn *fn; switch((ulong)c->qid.path){ --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/fns.h +++ /sys/src/9/mtx/fns.h @@ -47,7 +47,6 @@ void ioinit(void); int iprint(char*, ...); int isaconfig(char*, int, ISAConf*); -#define kexit(a) #define kmapinval() void links(void); void mmuinit(void); @@ -88,6 +87,10 @@ void tlbflushall(void); #define userureg(ur) (((ur)->status & MSR_PR) != 0) void watchreset(void); + +/* devarch */ +Dirtab* addarchfile(char*, int, long(*)(Chan*, void*, long, vlong), + long(*)(Chan*, void*, long, vlong)); #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1])) #define KADDR(a) ((void*)((ulong)(a)|KZERO)) --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/mem.h +++ /sys/src/9/mtx/mem.h @@ -2,6 +2,9 @@ * Memory and machine-specific definitions. Used in C and assembler. */ +#define MIN(a, b) ((a) < (b)? (a): (b)) +#define MAX(a, b) ((a) > (b)? (a): (b)) + /* * Sizes */ @@ -31,7 +34,8 @@ /* * Time */ -#define HZ 100 /* clock frequency */ +#define HZ (100) /* clock frequency */ +#define MS2HZ (1000/HZ) /* millisec per clock tick */ #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */ /* --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/mkfile +++ /sys/src/9/mtx/mkfile @@ -58,8 +58,8 @@ /$objtype/lib/libmemdraw.a\ /$objtype/lib/libdraw.a\ /$objtype/lib/libip.a\ - /$objtype/lib/libc.a\ /$objtype/lib/libsec.a\ + /$objtype/lib/libc.a\ ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'} VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'} --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/mtx +++ /sys/src/9/mtx/mtx @@ -9,6 +9,7 @@ proc mnt srv + shr dup ssl cap --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/pcimtx.c +++ /sys/src/9/mtx/pcimtx.c @@ -115,7 +115,7 @@ int pcicfgrw8(int tbdf, int rno, int data, int read) { - int o, x; + int o; switch(pcicfgmode){ case 1: --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/raven.c +++ /sys/src/9/mtx/raven.c @@ -3,6 +3,7 @@ */ #include "u.h" #include "../port/lib.h" +#include "../port/pci.h" #include "mem.h" #include "dat.h" #include "fns.h" --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/9/mtx/trap.c +++ /sys/src/9/mtx/trap.c @@ -1,5 +1,6 @@ #include "u.h" #include "../port/lib.h" +#include "../port/pci.h" #include "mem.h" #include "dat.h" #include "fns.h" @@ -632,7 +633,7 @@ up->s = *((Sargs*)(sp+BY2WD)); up->psstate = sysctab[scallnr]; - ret = systab[scallnr](up->s.args); + ret = systab[scallnr]((char *)up->s.args); poperror(); }else{ /* failure: save the error buffer for errstr */ --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/boot/zynq/mkfile +++ /sys/src/boot/zynq/mkfile @@ -7,6 +7,9 @@ all:V: $TARG +install:V: + echo install not supported >[1=2] + clean:V: rm -rf $TARG *.$O @{objtype=$cputype mk -f mkfile.port clean} --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/cmd/mkfile +++ /sys/src/cmd/mkfile @@ -8,8 +8,9 @@ YFLAGS=-d NOTSYS=sml|dup|.+\..+ +NOTPOWER=|dtracy PCONLY=|vmx -NOMK=$NOTSYS`{~ $objtype (386 amd64) || echo $PCONLY} +NOMK=$NOTSYS$NOTPOWER`{~ $objtype (386 amd64) || echo $PCONLY} cpuobjtype=`{sed -n 's/^O=//p' /$cputype/mkfile} DIRS=`{echo */mkfile | sed 's,/mkfile *,\n,g' | grep -v '^('$NOMK')$'} --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree//sys/src/mkfile.proto +++ /sys/src/mkfile.proto @@ -2,8 +2,8 @@ # common mkfile parameters shared by all architectures # -OS=05678qv -CPUS=spim arm arm64 amd64 386 power mips +OS=5678qv +CPUS=arm arm64 amd64 386 power mips CFLAGS=-FTVw LEX=lex YACC=yacc --- /tmp/diff100001999533 +++ sys/src/9/ppc/Readme @@ -1,0 +1,26 @@ +This directory contains source code for two PowerPC ports, + +The kernel made with + mk 'CONF=blast' +is an 8260 kernel. The 8260 (PowerQUICC II, e.g. Apple G2) is an +embedded PowerPC with on-chip DMA, Uart, Ethernet, ATM controllers and +a few other things. + +The 8260-specific code is in m8260.c (no surprises there) and in the +device drivers for SMC uart (uartsmc.c) and FCC ethernet (etherfcc.c). + +The kernel made with + mk 'CONF=ucu' +is a PowerPC 750/755 (e.g., Apple G3) kernel using the saturn chip for +Ether and Uart. + +We run both kernels on Lucent proprietary boards, but the kernels are +pretty generic. On a different board, the ports may be hooked up differently, +the clocks may be running at different speeds, the memory banks may be +configured differently and this will require tweaking the Ethernet setup, +Uart setup, Memory bank setup and several other things as well. + +There is 8260 and Ucu specific code in l.s too (lucu.s and lblast.s). +These differences primarily concern the state of the system at bootup. +In the case of the ucu, virtual memory is already on when the kernel +starts. --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/clock.c +++ sys/src/9/ppc/clock.c @@ -82,6 +82,11 @@ } ulong +µs(void) +{ + return fastticks2us(m->ticks); +} +ulong perfticks(void) { return (ulong)fastticks(nil); --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/dat.h +++ sys/src/9/ppc/dat.h @@ -15,7 +15,7 @@ typedef struct Sys Sys; typedef struct Ureg Ureg; typedef struct Vctl Vctl; -typedef long Tval; +typedef uvlong Tval; #pragma incomplete Ureg #pragma incomplete Imap @@ -37,8 +37,9 @@ ulong sr; ulong pc; Proc *p; - ulong pid; + Mach *m; ushort isilock; + long lockcycles; }; struct Label --- /tmp/diff100001999542 +++ sys/src/9/ppc/devce.c @@ -1,0 +1,191 @@ +// +// channel element driver +// +#include "u.h" +#include "../port/lib.h" +#include "mem.h" +#include "dat.h" +#include "fns.h" +#include "io.h" +#include "../port/error.h" +#include "msaturn.h" + +enum{ + Ucuunknown = 0, + Ucu64, + + Ndsp = 16, + + Cedead = 0, + Cereset, + Celoaded, + Cerunning, + + Qdir = 0, + Qctl, + Qce, + + Cpldbase = Saturn + 0x6000000, + Cplducuversion_ucu = 0x1c, + Cebase = Saturn + 0x3000000, + Cesize = 0x100000, +}; + +typedef struct Cpld Cpld; +struct Cpld{ + uchar led; + uchar fpga1; + uchar slotid; + uchar version; + uchar watchdog; + uchar spi; + uchar asicreset; + uchar dspreset; + uchar generalreset; + uchar ucuversion; + uchar fpga2; +}; + +typedef struct Circbuf Circbuf; +struct Circbuf{ + uchar *nextin; + uchar *nextout; + uchar *start; + uchar *end; +}; + +typedef struct Dsp Dsp; +struct Dsp{ + Ref; + int state; + Circbuf *cb; +}; + +typedef struct Ce Ce; +struct Ce{ + int ucutype; + Ce *ces[Ndsp]; +}; + +static Cpld*cpld = (Cpld*)Cpldbase; +static Ce ce; + +static void +ceinit(void) +{ + if(cpld->ucuversion & Cplducuversion_ucu) + ce.ucutype = Ucu64; + else{ + print("ceinit: unsuppoerted UCU\n"); + return; + } + +} + +static Chan* +ceattach(char*spec) +{ + return devattach('C', spec); +} + +#define DEV(q) ((int)(((q).path >> 8) & 0xff)) +#define TYPE(q) ((int)((q).path & 0xff)) +#define QID(d, t) ((((d) & 0xff) << 8) | (t)) + +static int +cegen(Chan*c, char*, Dirtab*, int, int i, Dir*dp) +{ + Qid qid; + + switch(TYPE(c->qid)){ + case Qdir: + if(i == DEVDOTDOT){ + mkqid(&qid, QID(0, Qdir), 0, QTDIR); + devdir(c, qid, "#C", 0, eve, 0555, dp); + return 1; + } + + if(i == 0){ + mkqid(&qid, QID(-1, Qctl), 0, QTFILE); + devdir(c, qid, "cectl", 0, eve, 0644, dp); + return 1; + } + + if (--i >= Ndsp) + return -1; + + mkqid(&qid, QID(Qce, i), 0, QTFILE); + snprint(up->genbuf, sizeof(up->genbuf), "ce%d", i); + devdir(c, qid, up->genbuf, 0, eve, 0644, dp); + return 1; + + default: + return -1; + } +} + +static Walkqid * +cewalk(Chan*c, Chan*nc, char**name, int nname) +{ + return devwalk(c, nc, name, nname, 0, 0, cegen); +} + +static int +cestat(Chan*c, uchar*db, int n) +{ + return devstat(c, db, n, 0, 0, cegen); +} + +static Chan* +ceopen(Chan*c, int omode) +{ + c->mode = openmode(omode); + c->flag |= COPEN; + c->offset = 0; + return c; +} + +static void +ceclose(Chan*) +{} + +static long +ceread(Chan*c, void*a, long n, vlong) +{ + switch(TYPE(c->qid)){ + case Qdir: + return devdirread(c, a, n, 0, 0, cegen); + + default: + error("unsupported operation"); + } + return 0; +} + +static long +cewrite(Chan*, void*, long, vlong) +{ + return 0; +} + +Dev cedevtab = { + 'C', + "channel element", + + devreset, + ceinit, + devshutdown, + ceattach, + cewalk, + cestat, + ceopen, + devcreate, + ceclose, + ceread, + devbread, + cewrite, + devbwrite, + devremove, + devwstat, + devpower, +}; --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/fns.h +++ sys/src/9/ppc/fns.h @@ -1,7 +1,9 @@ #include "../port/portfns.h" +ulong cankaddr(ulong); void clockinit(void); void clockintr(Ureg*); +int cmpswap(long*, long, long); void cpuidprint(void); void cycles(uvlong*); void dbgputc(int c); --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/l.s +++ sys/src/9/ppc/l.s @@ -346,7 +346,6 @@ RETURN TEXT tas(SB), $0 -TEXT _tas(SB), $0 MOVW R3, R4 MOVW $0xdead, R5 tas1: @@ -360,6 +359,42 @@ EIEIO tas0: SYNC + RETURN + +TEXT _xinc(SB), $0 /* void _xinc(long *); */ + MOVW R3, R4 +xincloop: + DCBF (R4) /* fix for 603x bug */ + LWAR (R4), R3 + ADD $1, R3 + STWCCC R3, (R4) + BNE xincloop + RETURN + +TEXT _xdec(SB), $0 /* long _xdec(long *); */ + MOVW R3, R4 +xdecloop: + DCBF (R4) /* fix for 603x bug */ + LWAR (R4), R3 + ADD $-1, R3 + STWCCC R3, (R4) + BNE xdecloop + RETURN + +TEXT cmpswap(SB),$0 /* int cmpswap(long*, long, long) */ + MOVW R3, R4 /* addr */ + MOVW old+4(FP), R5 + MOVW new+8(FP), R6 + DCBF (R4) /* fix for 603x bug? */ + LWAR (R4), R3 + CMP R3, R5 + BNE fail + STWCCC R6, (R4) + BNE fail + MOVW $1, R3 + RETURN +fail: + MOVW $0, R3 RETURN TEXT tlbflushall(SB), $0 --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/mem.h +++ sys/src/9/ppc/mem.h @@ -8,6 +8,9 @@ #include "blast.h" #endif +#define MIN(a, b) ((a) < (b)? (a): (b)) +#define MAX(a, b) ((a) > (b)? (a): (b)) + /* * Sizes */ @@ -37,7 +40,8 @@ /* * Time */ -#define HZ 1000 /* clock frequency */ +#define HZ (1000) /* clock frequency */ +#define MS2HZ (HZ) /* millisec per clock tick */ #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */ /* --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/mkfile +++ sys/src/9/ppc/mkfile @@ -37,6 +37,7 @@ tod.$O\ xalloc.$O\ random.$O\ + userinit.$O\ OBJ=\ l.$O\ @@ -60,8 +61,9 @@ /$objtype/lib/libmemlayer.a\ /$objtype/lib/libmemdraw.a\ /$objtype/lib/libdraw.a\ - /$objtype/lib/libc.a\ /$objtype/lib/libsec.a\ + /$objtype/lib/libip.a\ + /$objtype/lib/libc.a\ ETHER=`{echo devether.c ether*.c | sed 's/\.c/.'$O'/g'} VGA=`{echo devvga.c screen.c vga*.c | sed 's/\.c/.'$O'/g'} --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/saturntimer.c +++ sys/src/9/ppc/saturntimer.c @@ -72,7 +72,7 @@ } void -timerset(uvlong next) +timerset(Tval next) { ulong offset; uvlong now; --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/trap.c +++ sys/src/9/ppc/trap.c @@ -11,6 +11,14 @@ static Lock vctllock; Vctl *vctl[256]; +int nintr[10]; +int nintro; +int dblintr[64]; +ulong thisto[32]; +ulong thistoo; +vlong vnot[64]; +ulong vnon[64]; + void intrenable(int irq, void (*f)(Ureg*, void*), void* a, char *name) { @@ -368,6 +376,62 @@ vp[n] = 0x4e800021; /* BL (LR) */ }else vp[n] = (18<<26)|(pa&0x3FFFFFC)|3; /* bla */ +} + +void +intr(Ureg *ureg) +{ + int vno, pvno, i; + Vctl *ctl, *v; + void (*pt)(Proc*, int, vlong); + uvlong tt, x; + + cycles(&tt); + pt = proctrace; + pvno = -1; + for(i = 0; i < 64; i++){ + vno = intvec(); + if(vno == 0) + break; + cycles(&x); + vnot[vno] -= x; + if(vno == pvno) + dblintr[vno]++; + pvno = vno; + if(pt && up && up->trace) + pt(up, (vno << 16) | SInts, 0); + + if(vno > nelem(vctl) || (ctl = vctl[vno]) == 0) { + iprint("spurious intr %d\n", vno); + return; + } + + for(v = ctl; v != nil; v = v->next) + if(v->f) + v->f(ureg, v->a); + + intend(vno); /* reenable the interrupt */ + + if(pt && up && up->trace) + pt(up, (vno << 16) | SInte, 0); + cycles(&x); + vnot[vno] += x; + vnon[vno]++; + } + if(i < nelem(nintr)) + nintr[i]++; + else + nintro++; + cycles(&x); + tt = x - tt; + i = tt / 3600; /* 100 microseconds units */ + if(i < nelem(thisto)) + thisto[i]++; + else + thistoo++; + + if(up) + preempted(); } char* --- //.git/fs/object/8c796bf8b9c10a0845717c47af908e47dfe14482/tree/sys/src/9/ppc/ucu +++ sys/src/9/ppc/ucu @@ -1,11 +1,13 @@ dev root cons + swap env pipe proc mnt srv + shr dup ssl cap ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-21 8:27 ` unobe @ 2021-08-22 14:15 ` cinap_lenrek 2021-08-22 14:33 ` cinap_lenrek 1 sibling, 0 replies; 9+ messages in thread From: cinap_lenrek @ 2021-08-22 14:15 UTC (permalink / raw) To: 9front the patch is mangled by the mailinglist. please send it as an attachment, and not inline for application. preferrably in a way where i can just git/import it without having to recreating your commit message. thank you. -- cinap ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-21 8:27 ` unobe 2021-08-22 14:15 ` cinap_lenrek @ 2021-08-22 14:33 ` cinap_lenrek 2021-08-22 15:13 ` Amavect 1 sibling, 1 reply; 9+ messages in thread From: cinap_lenrek @ 2021-08-22 14:33 UTC (permalink / raw) To: 9front also, can we separate the /sys/src/mkfile.proto and /sys/src/cmd/mkfile and /sys/src/9/zynq changes from the mtx kernel changes? why are we removing spim from archs? -- cinap ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-22 14:33 ` cinap_lenrek @ 2021-08-22 15:13 ` Amavect 0 siblings, 0 replies; 9+ messages in thread From: Amavect @ 2021-08-22 15:13 UTC (permalink / raw) To: 9front [-- Attachment #1: Type: text/plain, Size: 1033 bytes --] On Sun, 22 Aug 2021 16:33:37 +0200 cinap_lenrek@felloff.net wrote: > why are we removing spim from archs? spim does not build, and we have no working spim kernel. Thus, there is no reason to include spim for mk installall. Attached is my changes. Thanks, Amavect From: Amavect <amavect@gmail.com> Date: Sun, 22 Aug 2021 15:05:38 +0000 Subject: [PATCH] mkfile.proto: remove spim and $MK, organize $CPUS `objtype=spim mk install` does not build, and we have no working kernel. $MK is useless, and is not used anywhere in the system. Reorder $CPUS in lexographic order for fun. --- diff 8c796bf8b9c10a0845717c47af908e47dfe14482 2106158cb0e529e550a65e51b21b66cc12d580b0 --- a/sys/src/mkfile.proto Thu Aug 19 23:07:37 2021 +++ b/sys/src/mkfile.proto Sun Aug 22 10:05:38 2021 @@ -3,11 +3,10 @@ # OS=05678qv -CPUS=spim arm arm64 amd64 386 power mips +CPUS=386 amd64 arm arm64 mips power CFLAGS=-FTVw LEX=lex YACC=yacc -MK=/bin/mk # recursive mk will have these set from the parent # this is never what we want. clear them [-- Attachment #2.1: Type: text/plain, Size: 313 bytes --] from postmaster@1ess: The following attachment had content that we can't prove to be harmless. To avoid possible automatic execution, we changed the content headers. The original header was: Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=mkfileproto.diff [-- Attachment #2.2: mkfileproto.diff.suspect --] [-- Type: application/octet-stream, Size: 766 bytes --] From: Amavect <amavect@gmail.com> Date: Sun, 22 Aug 2021 15:05:38 +0000 Subject: [PATCH] mkfile.proto: remove spim and $MK, organize $CPUS `objtype=spim mk install` does not build, and we have no working kernel. $MK is useless, and is not used anywhere in the system. Reorder $CPUS in lexographic order for fun. --- diff 8c796bf8b9c10a0845717c47af908e47dfe14482 2106158cb0e529e550a65e51b21b66cc12d580b0 --- a/sys/src/mkfile.proto Thu Aug 19 23:07:37 2021 +++ b/sys/src/mkfile.proto Sun Aug 22 10:05:38 2021 @@ -3,11 +3,10 @@ # OS=05678qv -CPUS=spim arm arm64 amd64 386 power mips +CPUS=386 amd64 arm arm64 mips power CFLAGS=-FTVw LEX=lex YACC=yacc -MK=/bin/mk # recursive mk will have these set from the parent # this is never what we want. clear them ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-17 14:00 [9front] [PATCH] mk for only supported archs unobe 2021-08-17 15:53 ` Amavect @ 2021-08-18 3:00 ` ori 2021-08-18 22:47 ` unobe 1 sibling, 1 reply; 9+ messages in thread From: ori @ 2021-08-18 3:00 UTC (permalink / raw) To: 9front Quoth unobe@cpan.org: > http://fqa.9front.org/fqa1.html#1.2 states the supported archs. > However, clean and nuke also remove build files for 0 (spim) and q > (power). 'mk all' using those archs fails; 'mk kernels' also tries to > build all the kernels, even those which are not supported. For > example, I tried to build the power arch (qc, qa, ql) and without > surprise it failed (when building dtracy): ... Maybe it's worth talking about deleting the code to support them, if nobody has hardware to test... The code will still be in history if anyone wants to resurrect it. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [9front] [PATCH] mk for only supported archs 2021-08-18 3:00 ` ori @ 2021-08-18 22:47 ` unobe 0 siblings, 0 replies; 9+ messages in thread From: unobe @ 2021-08-18 22:47 UTC (permalink / raw) To: 9front Quoth ori@eigenstate.org: > Quoth unobe@cpan.org: > > http://fqa.9front.org/fqa1.html#1.2 states the supported archs. > > However, clean and nuke also remove build files for 0 (spim) and q > > (power). 'mk all' using those archs fails; 'mk kernels' also tries to > > build all the kernels, even those which are not supported. For > > example, I tried to build the power arch (qc, qa, ql) and without > > surprise it failed (when building dtracy): ... > > Maybe it's worth talking about deleting > the code to support them, if nobody has > hardware to test... > QEMU can emulate PPC, so maybe a requirement that someone have hardware to test is setting the bar high? My introduction to Plan 9 was via emulation because newer hardware was not supported well, at all. > The code will still be in history if anyone > wants to resurrect it. If it's in git history, then there's zero cost *not* deleting it, save someone tries to use it, right? And in that case, the cost is localized to the person using it. Generally (for software in the distribution) my take is that things should not be removed unless broken beyond repair OR superseded by something better (so for the latter there's not really a removal, but a replacement). For example: 1. zuke replaced juke: yay! 2. Nail replaced Mail: yay! 3. fossil was removed but wasn't replaced with something better. I'm certain this isn't everyone's take, but it's like, just my opinion, man. And opinions can change. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-22 17:07 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-17 14:00 [9front] [PATCH] mk for only supported archs unobe 2021-08-17 15:53 ` Amavect 2021-08-17 20:15 ` unobe 2021-08-21 8:27 ` unobe 2021-08-22 14:15 ` cinap_lenrek 2021-08-22 14:33 ` cinap_lenrek 2021-08-22 15:13 ` Amavect 2021-08-18 3:00 ` ori 2021-08-18 22:47 ` unobe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).