Add "Sanity check the entry" code to avoid Compatibilty Holes

(0xa0000 -- 0xfffff).
This commit is contained in:
kanaoka 2001-04-18 05:44:10 +00:00
parent 7f8c2c6de2
commit e2749d2799
1 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.431 2001/04/14 06:49:31 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.432 2001/04/18 05:44:10 kanaoka Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@ -1874,6 +1874,35 @@ init386(first_avail)
seg_start = bim->entry[x].addr;
seg_end = bim->entry[x].addr + bim->entry[x].size;
/*
* XXX: avoid Compatibility Holes
* PC-compatible frame buffer 0xa0000-0xbffff
* adapter ROM space 0xc0000-0xdffff
* system BIOS space 0xe0000-0xfffff
*/
if (seg_start >= 0xa0000) {
if (seg_end <= 0xfffff) {
printf("WARNING: skipping "
"Compatibility Holes...\n ");
continue;
} else {
if (seg_start <= 0xfffff) {
seg_start = 0x100000;
seg_end = seg_start
+ bim->entry[x].size;
}
}
} else {
if (seg_end >= 0xa0000 && seg_end <= 0xfffff) {
seg_end = 0x9ffff;
}
if (seg_end >= 0xfffff) {
seg_start = 0x100000;
seg_end = seg_start
+ bim->entry[x].size;
}
}
if (seg_end > 0x100000000ULL) {
printf("WARNING: skipping large "
"memory map entry: "