From 25ff557f26f67a00095ea3e3522dabc1ba05516c Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 16 May 1997 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1997-05-16 --- carrera/segment.h | 1 + port/devproc.c | 2 +- port/fault.c | 11 +++++++++-- port/portdat.h | 1 + port/segment.c | 1 + port/swap.c | 1 + 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/carrera/segment.h b/carrera/segment.h index 4e28d10b30ca0bd63d7e15305b73a3e8cf99ebef..5c5d8d229defdfb508eed585445f3411e1b4c48e 100644 --- a/carrera/segment.h +++ b/carrera/segment.h @@ -6,6 +6,7 @@ Physseg physseg[] = { { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 }, { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 }, + { SG_MAP, "map", 0, SEGMAXSIZE, 0, 0 }, { SG_PHYSICAL, "eisaio", Eisaphys, 64*1024, 0, 0 }, { SG_PHYSICAL, "eisavga", Eisavgaphys, 128*1024, 0, 0 }, { SG_PHYSICAL, "bootrom", 0x1fc00000, 256*1024, 0, 0 }, diff --git a/port/devproc.c b/port/devproc.c index 5962be1ff13307f69b49fb82ff4600096f9e036f..afa4e6c86892f1e02aa6a4c1ad4c83d555e8a0c3 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -47,7 +47,7 @@ Dirtab procdir[] = }; /* Segment type from portdat.h */ -char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata" }; +char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata", "Map" }; /* * Qids are, in path: diff --git a/port/fault.c b/port/fault.c index f91f6383e43926cee2d7f3a0b761c9bc84ff2f95..f694e5f1a55a4a07cf3d0485bd11c3539c29fc81 100644 --- a/port/fault.c +++ b/port/fault.c @@ -52,10 +52,12 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu) { int type; Pte **p, *etp; - ulong mmuphys=0, soff; + char buf[ERRLEN]; + ulong va, mmuphys=0, soff; Page **pg, *lkp, *new; Page *(*fn)(Segment*, ulong); + va = addr; addr &= ~(BY2PG-1); soff = addr-s->base; p = &s->map[soff/PTEMAPMEM]; @@ -97,8 +99,13 @@ fixfault(Segment *s, ulong addr, int read, int doputmmu) case SG_BSS: case SG_SHARED: /* Zero fill on demand */ - case SG_STACK: + case SG_STACK: + case SG_MAP: if(*pg == 0) { + if(type == SG_MAP) { + sprint(buf, "map 0x%lux %c", va, read ? 'r' : 'w'); + postnote(up, 1, buf, NDebug); + } new = newpage(1, &s, addr); if(s == 0) return -1; diff --git a/port/portdat.h b/port/portdat.h index bbc24b78e40297ada0009d3b80a25996947e0272..e4bdb3e6b2d957d08486ed6b47ddfa0ab6c1d450 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -341,6 +341,7 @@ enum SG_SHARED = 04, SG_PHYSICAL = 05, SG_SHDATA = 06, + SG_MAP = 07, SG_RONLY = 0040, /* Segment is read only */ SG_CEXEC = 0100, /* Detach at exec */ diff --git a/port/segment.c b/port/segment.c index 073232fe1cf24a51a94cfcc98996de51418dad0a..25bf4a3a2a637b7caf30b3e723dc3d3edf3daaab 100644 --- a/port/segment.c +++ b/port/segment.c @@ -144,6 +144,7 @@ dupseg(Segment **seg, int segno, int share) break; case SG_BSS: /* Just copy on write */ + case SG_MAP: qlock(&s->lk); if(share && s->ref == 1) { s->type = (s->type&~SG_TYPE)|SG_SHARED; diff --git a/port/swap.c b/port/swap.c index 807b9dd7d9ea0babdb6737f9ea1bc3cd03469fa9..72a51767070322d25b99df86ba4bb0b933873c08 100644 --- a/port/swap.c +++ b/port/swap.c @@ -134,6 +134,7 @@ loop: case SG_BSS: case SG_STACK: case SG_SHARED: + case SG_MAP: up->psstate = "Pageout"; pageout(p, s); if(ioptr != 0) {