From 1f1afa319209330105bb4f3a568d139722c1162f Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 31 Oct 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-10-31 --- carrera/main.c | 3 +-- carrera/screen.c | 2 +- ip/ipifc.c | 5 ++++- pc/plan9l.s | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ port/devdraw.c | 10 ++++++---- port/devsdp.c | 4 ++-- port/rdb.c | 2 +- 7 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 pc/plan9l.s diff --git a/carrera/main.c b/carrera/main.c index 7caccc03941c159842eddcdfabb896d4cfaabdd6..a19e96fb2c67aaf10e8a5b56be78121cd77ccab3 100644 --- a/carrera/main.c +++ b/carrera/main.c @@ -56,10 +56,9 @@ main(void) iomapinit(); printinit(); serialinit(); - iprint("Brazil\n"); /**/ + iprint("Plan 9\n"); /**/ vecinit(); screeninit(); -// print("Brazil config reg %#ux\n", configreg); pageinit(); procinit0(); initseg(); diff --git a/carrera/screen.c b/carrera/screen.c index e910161c95e733170cfba2019a3bf586807b7974..15762a7f0ee54dd3461411d36e7a89c6ddd88f6f 100644 --- a/carrera/screen.c +++ b/carrera/screen.c @@ -130,7 +130,7 @@ screenwin(void) freememimage(grey); window = insetrect(window, 5); - greet = " Brazil Console: New Draw version "; + greet = " Plan 9 Console "; p = addpt(window.min, Pt(10, 0)); q = memsubfontwidth(memdefont, greet); memimagestring(gscreen, p, conscol, memdefont, greet); diff --git a/ip/ipifc.c b/ip/ipifc.c index c6fe4f95251beaf7fd3a12c9581daee09ca90b07..521dca26e49cba2eb759432217d37ef87cd9d8f0 100644 --- a/ip/ipifc.c +++ b/ip/ipifc.c @@ -463,6 +463,8 @@ ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock) uchar mask[IPaddrlen]; Iplifc *lifc, **l; Fs *f; + uchar *addr; + int type; if(argc < 3) return Ebadarg; @@ -490,7 +492,8 @@ ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock) addr = lifc->local; if(type == Rptpt) addr = lifc->remote; - if(memcmp(ip, addr, IPaddrlen) == 0 && memcmp(mask, lifc->mask, IPaddrlen) == 0) { + if(memcmp(ip, addr, IPaddrlen) == 0) + if(memcmp(mask, lifc->mask, IPaddrlen) == 0) { *l = lifc->next; break; } diff --git a/pc/plan9l.s b/pc/plan9l.s new file mode 100644 index 0000000000000000000000000000000000000000..e44671ac7eccde864af09a1fcc973ed9c6eb3cdf --- /dev/null +++ b/pc/plan9l.s @@ -0,0 +1,52 @@ +#include "mem.h" + +/* + * This must match io.h. + */ +#define VectorSYSCALL 0x40 + +/* + * Used to get to the first process: + * set up an interrupt return frame and IRET to user level. + */ +TEXT touser(SB), $0 + PUSHL $(UDSEL) /* old ss */ + MOVL sp+0(FP), AX /* old sp */ + PUSHL AX + MOVL $0x200, AX /* interrupt enable flag */ + PUSHL AX /* old flags */ + PUSHL $(UESEL) /* old cs */ + PUSHL $(UTZERO+32) /* old pc */ + MOVL $(UDSEL), AX + MOVW AX, DS + MOVW AX, ES + MOVW AX, GS + MOVW AX, FS + IRETL + +/* + * This is merely _strayintr from l.s optimised to vector + * to syscall() without going through trap(). + */ +TEXT _syscallintr(SB), $0 + PUSHL $VectorSYSCALL /* trap type */ + + PUSHL DS + PUSHL ES + PUSHL FS + PUSHL GS + PUSHAL + MOVL $(KDSEL), AX + MOVW AX, DS + MOVW AX, ES + PUSHL SP + CALL syscall(SB) + + POPL AX + POPAL + POPL GS + POPL FS + POPL ES + POPL DS + ADDL $8, SP /* pop error code and trap type */ + IRETL diff --git a/port/devdraw.c b/port/devdraw.c index 2b95cbd462b7016c6acd7c8facb13bb3e2e0c31d..3498c7a7b4e87ecad6975a3c2b6249399f510ff2 100644 --- a/port/devdraw.c +++ b/port/devdraw.c @@ -1559,12 +1559,16 @@ drawmesg(Client *client, void *av, int n) continue; /* create image mask: 'm' newid[4] id[4] */ +/* + * case 'm': printmesg("LL", a, 0); m = 4+4; if(n < m) error(Eshortdraw); break; + * + */ /* attach to a named image: 'n' dstid[4] j[1] name[j] */ case 'n': @@ -1876,10 +1880,8 @@ drawmesg(Client *client, void *av, int n) drawflush(); continue; - /* old write: 'w' id[4] R[4*4] data[x*1] */ - /* old write from compressed data: 'W' id[4] R[4*4] data[x*1] */ - /* new write: 'y' id[4] R[4*4] data[x*1] */ - /* new write from compressed data: 'Y' id[4] R[4*4] data[x*1] */ + /* write: 'y' id[4] R[4*4] data[x*1] */ + /* write from compressed data: 'Y' id[4] R[4*4] data[x*1] */ case 'y': case 'Y': printmesg(fmt="LR", a, 0); diff --git a/port/devsdp.c b/port/devsdp.c index 89cd2c2fc72d6afd3c84178f5ebc4696c65cf07b..9de273658f170c500b3c4e2666aca4841b16e450 100644 --- a/port/devsdp.c +++ b/port/devsdp.c @@ -1185,7 +1185,7 @@ print("dup sequence number: %ld (%ld %ld)\n", seq, c->in.seqwrap, seqdiff); if(0) print("coniput seq=%ulx\n", seq); if(c->in.auth != 0) { if(!(*c->in.auth)(&c->in, b->rp-4, BLEN(b)+4)) { -print("bad auth\n"); +print("bad auth %d\n", BLEN(b)+4); c->lstats.inBadAuth++; freeb(b); return nil; @@ -1726,7 +1726,7 @@ writedata(Conv *c, Block *b) c->lstats.outDataPackets++; c->lstats.outDataBytes += n; - if(c->out.comp != nil) { + if(c->out.comp != nil && 0) { // must generate same value as convoput seq = (c->out.seq + 1) & (SeqMax-1); diff --git a/port/rdb.c b/port/rdb.c index f48a50bc9bfc21bdf59ea893b5a2a39d9fc39fac..dda9ee78ff27bf47ec86f91640b21f0a4c8dae56 100644 --- a/port/rdb.c +++ b/port/rdb.c @@ -62,7 +62,7 @@ talkrdb(Ureg *ureg) char *req; printq = nil; // turn off serial console -// scrprint("Brazil debugger\n"); +// scrprint("Plan 9 debugger\n"); iprint("Edebugger reset\n"); for(;;){ req = getline();