summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-11-26 20:01:47 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:56 +0200
commit4319b1c2e5e9dc7d5c6e145b7363124246f7ac54 (patch)
treee3d323dda13ad252c606017d98fcdcf82627dd85 /i386
parent5a091eb5a5a1b22cb2676fe2ecc461b5289fc556 (diff)
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.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386at/model_dep.c9
1 files changed, 8 insertions, 1 deletions
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);