Commit f6eb62b6 authored by Alexander van Heukelum's avatar Alexander van Heukelum Committed by Ingo Molnar

x86: reserve_early end-of-conventional-memory to 1MB, 64-bit

Explicitly reserve_early the whole address range from the end of
conventional memory as reported by the bios data area up to the
1Mb mark. Regard the info retrieved from the BIOS data area with
a bit of paranoia, though, because some biosses forget to register
the EBDA correctly.
Signed-off-by: default avatarAlexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent dedd04be
...@@ -49,33 +49,42 @@ static void __init copy_bootdata(char *real_mode_data) ...@@ -49,33 +49,42 @@ static void __init copy_bootdata(char *real_mode_data)
} }
} }
#define EBDA_ADDR_POINTER 0x40E #define BIOS_EBDA_SEGMENT 0x40E
#define BIOS_LOWMEM_KILOBYTES 0x413
/*
* The BIOS places the EBDA/XBDA at the top of conventional
* memory, and usually decreases the reported amount of
* conventional memory (int 0x12) too.
*/
static __init void reserve_ebda(void) static __init void reserve_ebda(void)
{ {
unsigned ebda_addr, ebda_size; unsigned int lowmem, ebda_addr;
/* /* end of low (conventional) memory */
* there is a real-mode segmented pointer pointing to the lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
* 4K EBDA area at 0x40E lowmem <<= 10;
*/
ebda_addr = *(unsigned short *)__va(EBDA_ADDR_POINTER); /* start of EBDA area */
ebda_addr = *(unsigned short *)__va(BIOS_EBDA_SEGMENT);
ebda_addr <<= 4; ebda_addr <<= 4;
if (!ebda_addr) /* Fixup: bios puts an EBDA in the top 64K segment */
return; /* of conventional memory, but does not adjust lowmem. */
if ((lowmem - ebda_addr) <= 0x10000)
lowmem = ebda_addr;
ebda_size = *(unsigned short *)__va(ebda_addr); /* Fixup: bios does not report an EBDA at all. */
/* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
if ((ebda_addr == 0) && (lowmem >= 0x9f000))
lowmem = 0x9f000;
/* Round EBDA up to pages */ /* Paranoia: should never happen, but... */
if (ebda_size == 0) if (lowmem >= 0x100000)
ebda_size = 1; lowmem = 0xa0000;
ebda_size <<= 10;
ebda_size = round_up(ebda_size + (ebda_addr & ~PAGE_MASK), PAGE_SIZE);
if (ebda_size > 64*1024)
ebda_size = 64*1024;
reserve_early(ebda_addr, ebda_addr + ebda_size, "EBDA"); /* reserve all memory between lowmem and the 1MB mark */
reserve_early(lowmem, 0x100000, "BIOS reserved");
} }
void __init x86_64_start_kernel(char * real_mode_data) void __init x86_64_start_kernel(char * real_mode_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment