diff options
-rw-r--r-- | xen/arch/x86/boot/head.S | 14 | ||||
-rw-r--r-- | xen/include/xen/multiboot.h | 23 |
2 files changed, 26 insertions, 11 deletions
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 7efa155a65..d3cbddb349 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -88,6 +88,20 @@ __start: movzwl 0x413,%eax /* use base memory size on failure */ shl $10-4,%eax 1: + /* + * Compare the value in the BDA with the information from the + * multiboot structure (if available) and use the smallest. + */ + testb $MBI_MEMLIMITS,(%ebx) + jz 2f /* not available? BDA value will be fine */ + mov 4(%ebx),%edx + cmp $0x100,%edx /* is the multiboot value too small? */ + jb 2f /* if so, do not use it */ + shl $10-4,%edx + cmp %eax,%edx /* compare with BDA value */ + cmovb %edx,%eax /* and use the smaller */ + +2: /* Reserve 64kb for the trampoline */ sub $0x1000,%eax /* From arch/x86/smpboot.c: start_eip had better be page-aligned! */ diff --git a/xen/include/xen/multiboot.h b/xen/include/xen/multiboot.h index 53b30f22a6..67483ed843 100644 --- a/xen/include/xen/multiboot.h +++ b/xen/include/xen/multiboot.h @@ -18,6 +18,7 @@ #ifndef __MULTIBOOT_H__ #define __MULTIBOOT_H__ +#include "const.h" /* * Multiboot header structure. @@ -31,17 +32,17 @@ /* The magic number passed by a Multiboot-compliant boot loader. */ #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 -#define MBI_MEMLIMITS (1u<< 0) -#define MBI_BOOTDEV (1u<< 1) -#define MBI_CMDLINE (1u<< 2) -#define MBI_MODULES (1u<< 3) -#define MBI_AOUT_SYMS (1u<< 4) -#define MBI_ELF_SYMS (1u<< 5) -#define MBI_MEMMAP (1u<< 6) -#define MBI_DRIVES (1u<< 7) -#define MBI_BIOSCONFIG (1u<< 8) -#define MBI_LOADERNAME (1u<< 9) -#define MBI_APM (1u<<10) +#define MBI_MEMLIMITS (_AC(1,u) << 0) +#define MBI_BOOTDEV (_AC(1,u) << 1) +#define MBI_CMDLINE (_AC(1,u) << 2) +#define MBI_MODULES (_AC(1,u) << 3) +#define MBI_AOUT_SYMS (_AC(1,u) << 4) +#define MBI_ELF_SYMS (_AC(1,u) << 5) +#define MBI_MEMMAP (_AC(1,u) << 6) +#define MBI_DRIVES (_AC(1,u) << 7) +#define MBI_BIOSCONFIG (_AC(1,u) << 8) +#define MBI_LOADERNAME (_AC(1,u) << 9) +#define MBI_APM (_AC(1,u) << 10) #ifndef __ASSEMBLY__ |