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:
parent
e8df1d4eb3
commit
c8600122db
3 changed files with 25 additions and 7 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
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
|
||||||
|
|
||||||
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
2009-06-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Remove nested functions in efiemu core
|
Remove nested functions in efiemu core
|
||||||
|
|
15
configure.ac
15
configure.ac
|
@ -339,18 +339,23 @@ fi
|
||||||
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||||
# Use large model to support 4G memory
|
# Use large model to support 4G memory
|
||||||
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
||||||
CFLAGS="-m64 -mcmodel=large"
|
SAVED_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS="$CFLAGS -m64 -mcmodel=large"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
[grub_cv_cc_mcmodel=yes],
|
[grub_cv_cc_mcmodel=yes],
|
||||||
[grub_cv_cc_mcmodel=no])
|
[grub_cv_cc_mcmodel=no])
|
||||||
])
|
])
|
||||||
if test "x$grub_cv_cc_no_mcmodel" = xno; then
|
if test "x$grub_cv_cc_mcmodel" = xno; then
|
||||||
AC_MSG_ERROR([-mcmodel=large not supported, upgrade your gcc])
|
CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
|
||||||
|
AC_MSG_WARN([-mcmodel=large not supported. You wan't be able to use the memory over 4GiB. Upgrade your gcc])
|
||||||
|
else
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# EFI writes to stack below %rsp, we must not use the red zone
|
# EFI writes to stack below %rsp, we must not use the red zone
|
||||||
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
|
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
|
||||||
CFLAGS="-m64 -mno-red-zone"
|
CFLAGS="$CFLAGS -m64 -mno-red-zone"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
[grub_cv_cc_no_red_zone=yes],
|
[grub_cv_cc_no_red_zone=yes],
|
||||||
[grub_cv_cc_no_red_zone=no])
|
[grub_cv_cc_no_red_zone=no])
|
||||||
|
@ -359,7 +364,7 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||||
AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
|
AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large -mno-red-zone"
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -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. */
|
/* Limit the memory access to less than 4GB for 32-bit platforms. */
|
||||||
if (address > 0xffffffff)
|
if (address > 0xffffffff)
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
|
||||||
if (address == 0)
|
if (address == 0)
|
||||||
{
|
{
|
||||||
type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
|
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))
|
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
|
||||||
{
|
{
|
||||||
if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
|
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
|
&& desc->physical_start <= 0xffffffff
|
||||||
#endif
|
#endif
|
||||||
&& desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
|
&& 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;
|
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)
|
if (BYTES_TO_PAGES (filtered_desc->physical_start)
|
||||||
+ filtered_desc->num_pages
|
+ filtered_desc->num_pages
|
||||||
> BYTES_TO_PAGES (0x100000000LL))
|
> BYTES_TO_PAGES (0x100000000LL))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue