Skip to content

Commit a2c606d

Browse files
Bjorn Helgaasjbarnes993
authored andcommitted
x86: avoid high BIOS area when allocating address space
This prevents allocation of the last 2MB before 4GB. The experiment described here shows Windows 7 ignoring the last 1MB: https://bugzilla.kernel.org/show_bug.cgi?id=23542#c27 This patch ignores the top 2MB instead of just 1MB because H. Peter Anvin says "There will be ROM at the top of the 32-bit address space; it's a fact of the architecture, and on at least older systems it was common to have a shadow 1 MiB below." Acked-by: H. Peter Anvin <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent 4dc2287 commit a2c606d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

arch/x86/include/asm/e820.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ struct e820map {
7272
#define BIOS_BEGIN 0x000a0000
7373
#define BIOS_END 0x00100000
7474

75+
#define BIOS_ROM_BASE 0xffe00000
76+
#define BIOS_ROM_END 0xffffffff
77+
7578
#ifdef __KERNEL__
7679
/* see comment in arch/x86/kernel/e820.c */
7780
extern struct e820map e820;

arch/x86/kernel/resource.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ static void remove_e820_regions(struct resource *avail)
3737

3838
void arch_remove_reservations(struct resource *avail)
3939
{
40-
/* Trim out BIOS area (low 1MB) and E820 regions */
40+
/* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */
4141
if (avail->flags & IORESOURCE_MEM) {
4242
if (avail->start < BIOS_END)
4343
avail->start = BIOS_END;
44+
resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
4445

4546
remove_e820_regions(avail);
4647
}

0 commit comments

Comments
 (0)