Move realmode into link section, add vesa driver. [rsc] --rw-rw-r-- M 15674 presotto sys 1504 Nov 10 10:21 sys/src/9/pc/pcf /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pcf:34,39 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pcf:34,40 usb link + realmode devpccard devi82365 apm apmjump /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pcf:62,68 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pcf:63,68 usbuhci misc - realmode archmp mp apic sdata pci sdscsi [rsc] --rw-rw-r-- M 15674 glenda sys 1427 Nov 10 10:21 sys/src/9/pc/pccd /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pccd:34,39 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pccd:34,40 usb link + realmode devpccard devi82365 apm apmjump /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pccd:61,67 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pccd:62,67 usbuhci misc - realmode archmp mp apic sdata pci sdscsi /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pccd:91,96 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pccd:91,97 vgat2r4 +cur vgatvp3020 =cur vgatvp3026 =cur + vgavesa vgavmware +cur ip [rsc] --rw-rw-r-- M 15674 presotto sys 1486 Nov 10 10:21 sys/src/9/pc/pccpuf /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pccpuf:32,37 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pccpuf:32,38 usb link + realmode devpccard devi82365 ether2000 ether8390 /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pccpuf:58,64 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pccpuf:59,64 usbuhci misc - realmode archmp mp apic uarti8250 [rsc] --rw-rw-r-- M 15674 rsc sys 1473 Nov 10 10:21 sys/src/9/pc/pcflop /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pcflop:34,39 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pcflop:34,40 # usb link + realmode devpccard devi82365 # apm apmjump /n/sourcesdump/2005/1110/plan9/sys/src/9/pc/pcflop:62,68 - /n/sourcesdump/2005/1111/plan9/sys/src/9/pc/pcflop:63,68 # usbuhci misc - realmode # archmp mp apic sdata pci sdscsi [rsc] --rw-rw-r-- M 15674 glenda sys 11128 Nov 10 10:21 sys/src/9/port/page.c /n/sourcesdump/2005/1110/plan9/sys/src/9/port/page.c:240,246 - /n/sourcesdump/2005/1111/plan9/sys/src/9/port/page.c:240,246 } Page* - auxpage() + auxpage(void) { Page *p; Fix initial rectangle location. [rsc] --rw-rw-r-- M 15674 glenda sys 22791 Nov 10 10:21 sys/src/cmd/rio/rio.c /n/sourcesdump/2005/1110/plan9/sys/src/cmd/rio/rio.c:962,973 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/rio/rio.c:962,974 p = mouse->xy; which = whichcorner(w, p); - startp = cornerpt(w->screenr, p, which); - wmovemouse(w, startp); + p = cornerpt(w->screenr, p, which); + wmovemouse(w, p); readmouse(mousectl); r = whichrect(w->screenr, p, which); drawborder(r, 1); or = r; + startp = p; but = mouse->buttons; while(mouse->buttons == but){ p = onscreen(mouse->xy); Add keys. [rsc] --rw-rw-r-- M 15674 glenda sys 865 Nov 10 10:48 sys/include/keyboard.h /n/sourcesdump/2005/1110/plan9/sys/include/keyboard.h:16,23 - /n/sourcesdump/2005/1111/plan9/sys/include/keyboard.h:16,23 extern Keyboardctl* initkeyboard(char*); - extern int ctlkeyboard(Keyboardctl*, char*); - extern void closekeyboard(Keyboardctl*); + extern int ctlkeyboard(Keyboardctl*, char*); + extern void closekeyboard(Keyboardctl*); enum { KF= 0xF000, /* Rune: beginning of private Unicode space */ /n/sourcesdump/2005/1110/plan9/sys/include/keyboard.h:38,41 - /n/sourcesdump/2005/1111/plan9/sys/include/keyboard.h:38,46 Kalt= KF|0x15, Kshift= KF|0x16, Kctl= KF|0x17, + + Kbs= 0x08, + Kdel= 0x7f, + Kesc= 0x1b, + Keof= 0x04, }; Set malloc tags. [rsc] --rw-rw-r-- M 15674 glenda sys 4160 Nov 10 10:48 sys/src/libdraw/alloc.c /n/sourcesdump/2005/1110/plan9/sys/src/libdraw/alloc.c:5,11 - /n/sourcesdump/2005/1111/plan9/sys/src/libdraw/alloc.c:5,16 Image* allocimage(Display *d, Rectangle r, ulong chan, int repl, ulong val) { - return _allocimage(nil, d, r, chan, repl, val, 0, 0); + Image* i; + + i = _allocimage(nil, d, r, chan, repl, val, 0, 0); + if (i) + setmalloctag(i, getcallerpc(&d)); + return i; } Image* [rsc] --rw-rw-r-- M 15674 glenda sys 2415 Nov 10 10:48 sys/src/libdraw/creadimage.c /n/sourcesdump/2005/1110/plan9/sys/src/libdraw/creadimage.c:58,63 - /n/sourcesdump/2005/1111/plan9/sys/src/libdraw/creadimage.c:58,64 if(dolock) lockdisplay(d); i = allocimage(d, r, chan, 0, 0); + setmalloctag(i, getcallerpc(&d)); if(dolock) unlockdisplay(d); if(i == nil) [rsc] --rw-rw-r-- M 15674 glenda sys 807 Nov 10 10:48 sys/src/libdraw/getsubfont.c /n/sourcesdump/2005/1110/plan9/sys/src/libdraw/getsubfont.c:32,36 - /n/sourcesdump/2005/1111/plan9/sys/src/libdraw/getsubfont.c:32,37 if(f == 0) fprint(2, "getsubfont: can't read %s: %r\n", name); close(fd); + setmalloctag(f, getcallerpc(&d)); return f; } 64-bit fixes. [rsc] --rw-rw-r-- M 15674 glenda sys 5615 Nov 10 16:50 sys/src/cmd/snap/take.c /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/take.c:96,102 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/take.c:96,102 } static Seg* - readseg(int fd, long off, ulong len, char *name) + readseg(int fd, vlong off, ulong len, char *name) { char buf[Pagesize]; Page **pg; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/take.c:187,193 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/take.c:187,193 switch(mach->szreg) { case 2: return machdata->swab(*(ushort*)q); case 4: return machdata->swal(*(ulong*)q); - case 8: /* too much code assumes stackptr fits in ulong */ + case 8: return machdata->swav(*(uvlong*)q); default: fprint(2, "register size is %d bytes?\n", mach->szreg); return 0; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/take.c:200,209 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/take.c:200,209 Data *d; Proc *proc; Seg **s; - char *segdat, *q, *f[128+1], buf[128]; + char *name, *segdat, *q, *f[128+1], buf[128]; int fd, i, stacki, nf, np; - ulong off, len, stackoff, stacklen; - ulong sp; + uvlong off, len, stackoff, stacklen; + uvlong sp; proc = emalloc(sizeof(*proc)); proc->pid = pid; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/take.c:263,278 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/take.c:263,277 for(i=0; inseg = nf; proc->seg = s; [rsc] --rw-rw-r-- M 15674 glenda sys 1453 Nov 10 16:50 sys/src/cmd/snap/write.c /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/write.c:22,34 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/write.c:22,38 Page **pp, *p; int type; - type = proc->text == s ? 't' : 'm'; + if(s == nil){ + Bprint(b, "%-11ud %-11ud ", 0, 0); + return; + } + type = proc->text == s ? 't' : 'm'; npg = (s->len+Pagesize-1)/Pagesize; if(npg != s->npg) abort(); - Bprint(b, "%-11lud %-11lud ", s->offset, s->len); + Bprint(b, "%-11llud %-11llud ", s->offset, s->len); if(s->len == 0) return; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/write.c:38,44 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/write.c:42,48 Bprint(b, "z"); continue; } - Bprint(b, "%c%-11ld %-11lud ", p->type, p->pid, p->offset); + Bprint(b, "%c%-11ld %-11llud ", p->type, p->pid, p->offset); } else { Bprint(b, "r"); Bwrite(b, p->data, p->len); [rsc] --rw-rw-r-- M 15674 glenda sys 4287 Nov 10 16:50 sys/src/cmd/snap/read.c /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/read.c:23,29 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/read.c:23,29 } Page* - findpage(Proc *plist, long pid, int type, ulong off) + findpage(Proc *plist, long pid, int type, uvlong off) { Seg *s; int i; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/read.c:58,63 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/read.c:58,116 return s->pg[off/Pagesize]; } + static int + Breadnumber(Biobuf *b, char *buf) + { + int i; + int c; + int havedigits; + + havedigits = 0; + for(i=0; i<22; i++){ + if((c = Bgetc(b)) == Beof) + return -1; + if('0' <= c && c <= '9'){ + *buf++ = c; + havedigits = 1; + }else if(c == ' '){ + if(havedigits){ + while((c = Bgetc(b)) == ' ') + ; + if(c != Beof) + Bungetc(b); + break; + } + }else{ + werrstr("bad character %.2ux", c); + return -1; + } + } + *buf = 0; + return 0; + } + + static int + Breadulong(Biobuf *b, ulong *x) + { + char buf[32]; + + if(Breadnumber(b, buf) < 0) + return -1; + *x = strtoul(buf, 0, 0); + return 0; + } + + static int + Breaduvlong(Biobuf *b, uvlong *x) + { + char buf[32]; + + if(Breadnumber(b, buf) < 0) + return -1; + *x = strtoull(buf, 0, 0); + return 0; + } + static Data* readdata(Biobuf *b) { /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/read.c:84,99 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/read.c:137,152 int i, npg; int t; int len; - ulong pid, off; + ulong pid; + uvlong off; char buf[Pagesize]; static char zero[Pagesize]; s = emalloc(sizeof *s); - if(Bread(b, buf, 2*12) != 2*12) + if(Breaduvlong(b, &s->offset) < 0 + || Breaduvlong(b, &s->len) < 0) panic("error reading segment"); - s->offset = atoi(buf); - s->len = atoi(buf+12); npg = (s->len + Pagesize-1)/Pagesize; s->npg = npg; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/read.c:113,140 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/read.c:166,193 case 'z': pp[i] = datapage(zero, len); if(debug) - fprint(2, "0x%.8lux all zeros\n", s->offset+i*Pagesize); + fprint(2, "0x%.8llux all zeros\n", s->offset+i*Pagesize); break; case 'm': case 't': - if(Bread(b, buf, 2*12) != 2*12) - panic("error reading segment"); - pid = atol(buf); - off = atol(buf+12); + if(Breadulong(b, &pid) < 0 + || Breaduvlong(b, &off) < 0) + panic("error reading segment x"); pp[i] = findpage(plist, pid, t, off); if(pp[i] == nil) panic("bad page reference in snapshot"); if(debug) - fprint(2, "0x%.8lux same as %s pid %lud 0x%.8lux\n", s->offset+i*Pagesize, t=='m'?"mem":"text", pid, off); + fprint(2, "0x%.8llux same as %s pid %lud 0x%.8llux\n", s->offset+i*Pagesize, t=='m'?"mem":"text", pid, off); break; case 'r': if(Bread(b, buf, len) != len) - panic("error reading segment"); + panic("error reading segment xx"); pp[i] = datapage(buf, len); if(debug) - fprint(2, "0x%.8lux is raw data\n", s->offset+i*Pagesize); + fprint(2, "0x%.8llux is raw data\n", s->offset+i*Pagesize); break; default: + fprint(2, "bad type char %#.2ux\n", t); panic("error reading segment"); } } [rsc] --rw-rw-r-- M 15674 glenda sys 985 Nov 10 16:50 sys/src/cmd/snap/snap.h /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/snap.h:25,32 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/snap.h:25,32 struct Seg { char* name; - ulong offset; - ulong len; + uvlong offset; + uvlong len; Page** pg; int npg; }; /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/snap.h:40,46 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/snap.h:40,46 int written; int type; ulong pid; - ulong offset; + uvlong offset; }; struct Proc { /n/sourcesdump/2005/1110/plan9/sys/src/cmd/snap/snap.h:61,66 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/snap/snap.h:61,66 void writesnap(Biobuf*, Proc*); Page* datapage(char *p, long len); Proc* readsnap(Biobuf *b); - Page* findpage(Proc *plist, long pid, int type, ulong off); + Page* findpage(Proc *plist, long pid, int type, uvlong off); int debug; [rsc] --rw-rw-r-- M 15674 glenda sys 5615 Nov 10 16:50 sys/src/cmd/snap/take.c [rsc] --rw-rw-r-- M 15674 glenda sys 1453 Nov 10 16:50 sys/src/cmd/snap/write.c 64-bit fix fixes. [rsc] --rw-rw-r-- M 15674 glenda sys 297 Nov 10 16:16 sys/src/cmd/9nfs/listalloc.c /n/sourcesdump/2005/1110/plan9/sys/src/cmd/9nfs/listalloc.c:8,19 - /n/sourcesdump/2005/1111/plan9/sys/src/cmd/9nfs/listalloc.c:8,19 { char *p, *base; - size = (size+sizeof(ulong)-1)/sizeof(ulong); + size = (size+sizeof(ulong)-1)/sizeof(ulong)*sizeof(ulong); p = base = malloc(n*size); while(--n > 0){ *(char**)p = p+size; p += size; } - *p = 0; + *(char**)p = 0; return base; }