increase the size of the adr map to 200; and panic on overflow Reference: /n/atom/patch/applied2013/adrmap200 Date: Mon Sep 16 23:24:19 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/adr.c Mon Sep 16 23:23:58 2013 +++ /sys/src/nix/k10/adr.c Mon Sep 16 23:23:58 2013 @@ -18,7 +18,7 @@ static struct { Lock; - Adrmap map[125]; + Adrmap map[200]; int nmap; uvlong pagecnt[Mlast]; } adr; @@ -45,6 +45,14 @@ "vmap", }; +static char* +tnam(int type) +{ + if(type == -1 || type >= nelem(tname)) + return "-1"; + return tname[type]; +} + static int fmta(Fmt *f) { @@ -93,15 +101,15 @@ return (ROUNDDN(a->base+a->len, PGSZ) - ROUNDUP(a->base, PGSZ))/PGSZ; } -void +static void insert(uintmem base, uintmem len, int type, int use, uint memflags) { int i, n; Adrmap a; - DBG("insert: %#P %.P %s %d\n", base, len, tname[type], use); + DBG("insert: %#P %.P t=%d %d\n", base, len, type, use); if(adr.nmap == nelem(adr.map)){ - print("adr: map overflow\n"); + print("adr: map too small\n"); return; } @@ -236,14 +244,6 @@ return 0; } -static char* -tnam(int type) -{ - if(type == -1 || type >= nelem(tname)) - return "-1"; - return tname[type]; -} - uintmem adralloc(uintmem base, uintmem len, int align, int type, int use, uint flags) { @@ -263,6 +263,8 @@ continue; /* add split */ if(a->base < base){ + if(adr.nmap == nelem(adr.map)) + panic("adr: map too small"); l = base - a->base; memmove(a+1, a, (adr.nmap++ - i)*sizeof(Adrmap)); a->len = l; @@ -277,6 +279,8 @@ continue; base = a->base+slop; if(a->len > adjlen){ + if(adr.nmap == nelem(adr.map)) + panic("adr: map too small"); memmove(a+1, a, (adr.nmap++ - i)*sizeof(Adrmap)); a->len = adjlen; a[1].base += adjlen; @@ -490,7 +494,11 @@ } } sys->meminit = 1; - print("%d %d %d\n", npg[0], npg[1], npg[2]); + + print("adr: "); + for(i = 0; i < m->npgsz; i++) + print("%d/%d ", m->pgszlg2[i], npg[i]); + print("\n"); } void