2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>

Allow a compilation without -mcmodel=large

	* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB
	when compiled without -mcmodel=large
	(filter_memory_map): remove memory post 4 GiB when compiled 
	without -mcmodel=large
	* configure.ac: fail gracefully and add -DMCMODEL_SMALL=1 to 
	TARGET_CFLAGS when -mcmodel=large isn't supported
This commit is contained in:
phcoder 2009-06-04 20:25:11 +00:00
parent e8df1d4eb3
commit c8600122db
3 changed files with 25 additions and 7 deletions

View file

@ -63,7 +63,9 @@ grub_efi_allocate_pages (grub_efi_physical_address_t address,
/* Limit the memory access to less than 4GB for 32-bit platforms. */
if (address > 0xffffffff)
return 0;
#endif
#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
if (address == 0)
{
type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
@ -218,7 +220,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
{
if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
#if GRUB_TARGET_SIZEOF_VOID_P < 8
#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
&& desc->physical_start <= 0xffffffff
#endif
&& desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
@ -234,7 +236,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map,
desc->physical_start = 0x100000;
}
#if GRUB_TARGET_SIZEOF_VOID_P < 8
#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ filtered_desc->num_pages
> BYTES_TO_PAGES (0x100000000LL))