aml can chew through enormous amounts of memory in patterns that show weaknesses in the allocator. use binalloc to get around this issue. Reference: /n/atom/patch/applied/amlbin Date: Mon Aug 17 05:11:32 CES 2015 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/k10/cpu Mon Aug 17 05:10:30 2015 +++ /sys/src/nix/k10/cpu Mon Aug 17 05:10:31 2015 @@ -181,6 +181,7 @@ lib libaml + libbin libip libsec libmp --- /sys/src/nix/k10/cpud Mon Aug 17 05:10:33 2015 +++ /sys/src/nix/k10/cpud Mon Aug 17 05:10:35 2015 @@ -180,6 +180,7 @@ lib libaml + libbin libip libsec libmp --- /sys/src/nix/k10/cpuf Mon Aug 17 05:10:37 2015 +++ /sys/src/nix/k10/cpuf Mon Aug 17 05:10:38 2015 @@ -182,6 +182,7 @@ lib libaml + libbin libip libsec libmp --- /sys/src/nix/k10/term Mon Aug 17 05:10:40 2015 +++ /sys/src/nix/k10/term Mon Aug 17 05:10:41 2015 @@ -194,6 +194,7 @@ libmemdraw libdraw libaml + libbin libip libsec libmp --- /sys/src/nix/k10/termd Mon Aug 17 05:10:43 2015 +++ /sys/src/nix/k10/termd Mon Aug 17 05:10:44 2015 @@ -194,6 +194,7 @@ libmemdraw libdraw libaml + libbin libip libsec libmp --- /sys/src/nix/k10/termf Mon Aug 17 05:10:46 2015 +++ /sys/src/nix/k10/termf Mon Aug 17 05:10:47 2015 @@ -195,6 +195,7 @@ libmemdraw libdraw libaml + libbin libip libsec libmp --- /sys/src/nix/k10/acpi.c Mon Aug 17 05:10:50 2015 +++ /sys/src/nix/k10/acpi.c Mon Aug 17 05:10:51 2015 @@ -9,6 +9,8 @@ #include "apic.h" #include "acpi.h" #include +#include + typedef struct Rsd Rsd; @@ -36,6 +38,7 @@ static Tbl *tblmap[64]; Fadt fadt; Acpicfg acpicfg; + Bin *amlbin; static int checksum(void *v, int n) @@ -1103,6 +1106,7 @@ /* free the AML interpreter */ amlexit(); + binfree(&amlbin); addarchfile("acpifadt", 0444, readfadt, nil); /* hack */ addarchfile("acpitbls", 0444, readtbls, nil); --- /sys/src/nix/k10/acpiio.c Mon Aug 17 05:10:53 2015 +++ /sys/src/nix/k10/acpiio.c Mon Aug 17 05:10:54 2015 @@ -8,13 +8,20 @@ #include "apic.h" #include +#include extern int pcibusno(void*); +enum { + debug = 0, +}; + +extern Bin *amlbin; + static void memtr(char *s, uintmem pa, int len, void *data) { - if(DBGFLG == 0) + if(debug) return; if(len <= 8) print("aml: %s %#P len %d %#llux\n", s, pa, len, getle(data, len)); @@ -190,7 +197,7 @@ putle(a, inb(port), 1); break; } - if(port != Post) + if(debug && port != Post) print("aml: io read: %ux len %d %llux\n", port, len, getle(a, len)); return len; } @@ -202,7 +209,7 @@ a = data; port += io->off; - if(port != Post) + if(debug && port != Post) print("aml: io write: %ux len %d %llux\n", port, len, getle(a, len)); switch(len){ default: @@ -233,7 +240,8 @@ print("amlmapio: address space %d not implemented\n", io->space); break; case MemSpace: - print("aml: map [%#llux, %#llux)\n", io->off, io->off+io->len); + if(debug) + print("aml: map [%#llux, %#llux)\n", io->off, io->off+io->len); // adrmapck(io->off, io->len, Aacpireclaim, Mfree, Cnone); io->read = readmem; io->write = writemem; @@ -282,18 +290,14 @@ { void *p; - if((p = malloc(n)) == nil) + if((p = binalloc(&amlbin, n, 1)) == nil) panic("amlalloc: no memory"); - memset(p, 0, n); - setmalloctag(&p, getcallerpc(&n)); - setrealloctag(&p, 0); return p; } void -amlfree(void *p) +amlfree(void*) { - free(p); } void