--- /n/sources/plan9/sys/src/9k/k10/fns.h Thu Sep 24 10:29:32 2026 +++ /sys/src/9k/k10/fns.h Thu Sep 24 00:00:00 2026 @@ -23,6 +23,7 @@ u32int cpuid(u32int, u32int, u32int[4]); int dbgprint(char*, ...); #define decref(r) adec(&(r)->ref) void delay(int); +int e820(void); #define evenaddr(x) /* x86 doesn't care */ int fpudevprocio(Proc*, void*, long, uintptr, int); void fpuinit(void); --- /n/sources/plan9/sys/src/9k/k10/main.c Thu Sep 24 10:29:32 2026 +++ /sys/src/9k/k10/main.c Thu Sep 24 00:00:00 2026 @@ -192,9 +192,11 @@ main(u32int ax, u32int bx) up = nil; asminit(); - multiboot(ax, bx, 0); + i = multiboot(ax, bx, 0); options(oargc, oargv); crapoptions(); + if(i < 0) + e820(); /* * Need something for initial delays --- /n/sources/plan9/sys/src/9k/k10/multiboot.c Thu Sep 24 10:29:32 2026 +++ /sys/src/9k/k10/multiboot.c Thu Sep 24 00:00:00 2026 @@ -149,3 +149,34 @@ multiboot(u32int magic, u32int pmbi, int vflag) return 0; } + +int +e820(void) +{ + char *s; + int type; + u64int base, top; + + if((s = getconf("*e820")) == nil) + return -1; + for(;;){ + while(*s == ' ') + s++; + if(*s == 0) + break; + type = 1; + if(s[1] == ' '){ + type = s[0] - '0'; + s += 2; + } + base = strtoull(s, &s, 16); + if(*s != ' ') + break; + top = strtoull(s, &s, 16); + if(*s != ' ' && *s != 0) + break; + if(base < top && type >= 1 && type <= 4) + asmmapinit(base, top-base, type); + } + return 0; +} --- /n/sources/plan9/sys/man/8/plan9.ini Fri May 11 10:50:09 2012 +++ /sys/man/8/plan9.ini Thu Sep 24 00:00:00 2026 @@ -757,6 +757,11 @@ This variable disables such switches. .SS \fL*noe820scan=\fP When available, the PC kernel uses the BIOS E820 memory map to size memory. This variable disables the scan. +.SS \fL*e820=\fItype base top ... +.IR 9boot (8) +passes the BIOS E820 memory map in this variable: +a type, a base address and a top address, in hexadecimal, for each range. +The 9k kernel sizes memory from it when not started by a multiboot loader. .SS \fL*maxmem=\fIaddress This defines the maximum physical address that the system will scan when sizing memory. By default the PC operating system will scan up to 3.75 gigabytes