mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
Bare metal: fix corner case in __normalize_e820( ) (#624)
See https://github.com/jart/cosmopolitan/pull/609#issuecomment-1247083243
This commit is contained in:
parent
134ffee519
commit
3733b43a8f
1 changed files with 3 additions and 2 deletions
|
@ -93,8 +93,9 @@ static noasan textreal void __normalize_e820(struct mman *mm) {
|
||||||
x = mm->e820[n].addr;
|
x = mm->e820[n].addr;
|
||||||
y = mm->e820[n].addr + mm->e820[n].size;
|
y = mm->e820[n].addr + mm->e820[n].size;
|
||||||
a = ROUNDUP(x, 4096);
|
a = ROUNDUP(x, 4096);
|
||||||
b = ROUNDDOWN(y, 4096) - a;
|
b = ROUNDDOWN(y, 4096);
|
||||||
if (b > 0 && mm->e820[i].type == kMemoryUsable) {
|
if (b > a && mm->e820[i].type == kMemoryUsable) {
|
||||||
|
b -= a;
|
||||||
mm->e820[n].addr = a;
|
mm->e820[n].addr = a;
|
||||||
mm->e820[n].size = b;
|
mm->e820[n].size = b;
|
||||||
++n;
|
++n;
|
||||||
|
|
Loading…
Add table
Reference in a new issue