diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | i386/i386at/model_dep.c | 9 |
2 files changed, 14 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2006-11-26 Samuel Thibault <samuel.thibault@ens-lyon.org> + + Fix i386's 4GiB overflow. + * i386/i386at/model_dep.c (mem_size_init): Truncate memory size to + 4GiB. + 2006-11-21 Thomas Schwinge <tschwinge@gnu.org> * doc/Makefrag.am (doc/web, html-local, ps-local, pdf-local) diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 1546077..9f0a1c7 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -196,11 +196,18 @@ void db_reset_cpu() void mem_size_init() { + vm_size_t phys_last_kb; + /* Physical memory on all PCs starts at physical address 0. XX make it a constant. */ phys_first_addr = 0; - phys_last_addr = 0x100000 + (boot_info.mem_upper * 0x400); + phys_last_kb = 0x400 + boot_info.mem_upper; + /* Avoid 4GiB overflow. */ + if (phys_last_kb < 0x400 || phys_last_kb >= 0x400000) + phys_last_kb = 0x400000 - 1; + + phys_last_addr = phys_last_kb * 0x400; avail_remaining = phys_last_addr - (0x100000 - (boot_info.mem_lower * 0x400) - 0x1000); |