]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix efiemu.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 13 Jan 2012 14:12:28 +0000 (15:12 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 13 Jan 2012 14:12:28 +0000 (15:12 +0100)
* grub-core/efiemu/runtime/efiemu.c: explicitly include right
cpu/types.h.
(efiemu_set_virtual_address_map): Remove UINT_TO_PTR.
* configure.ac: Fix efiemu check.

ChangeLog
configure.ac
grub-core/efiemu/runtime/efiemu.c

index b115e11b7caa76b2d090a15a43a275036fc174a7..45db5ffb35f73dd7a8f4dfeb8361c636ae7d92db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-13  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Fix efiemu.
+
+       * grub-core/efiemu/runtime/efiemu.c: explicitly include right
+       cpu/types.h.
+       (efiemu_set_virtual_address_map): Remove UINT_TO_PTR.
+       * configure.ac: Fix efiemu check.
+
 2012-01-13  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * util/grub.d/30_os-prober.in: Fix occurence of grub-probe instead of
index 7699e833027be25dfa81e9c89fe3d7c7d1cc119d..014e2fb9472856d33851297ddf4569ef73dae362 100644 (file)
@@ -477,6 +477,40 @@ case "${host_os}" in
 esac
 AC_MSG_RESULT([$TARGET_OBJ2ELF])
 
+
+AC_ARG_ENABLE([efiemu],
+             [AS_HELP_STRING([--enable-efiemu],
+                             [build and install the efiemu runtimes (default=guessed)])])
+if test x"$enable_efiemu" = xno ; then
+  efiemu_excuse="explicitly disabled"
+fi
+if test x"$target_cpu" != xi386 ; then
+  efiemu_excuse="only available on i386"
+fi
+if test x"$platform" = xefi ; then
+  efiemu_excuse="not available on efi"
+fi
+if test x"$efiemu_excuse" = x ; then
+  AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
+    CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+                     [grub_cv_cc_efiemu=yes],
+                     [grub_cv_cc_efiemu=no])
+  ])
+  if test x$grub_cv_cc_efiemu = xno; then
+     efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
+  fi
+fi
+if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
+  AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
+fi
+if test x"$efiemu_excuse" = x ; then
+enable_efiemu=yes
+else
+enable_efiemu=no
+fi
+AC_SUBST([enable_efiemu])
+
 if test "x$target_m32" = x1; then
   # Force 32-bit mode.
   TARGET_CFLAGS="$TARGET_CFLAGS -m32"
@@ -636,39 +670,6 @@ if test "x$target_cpu" = xi386; then
   grub_I386_ASM_ADDR32
 fi
 
-AC_ARG_ENABLE([efiemu],
-             [AS_HELP_STRING([--enable-efiemu],
-                             [build and install the efiemu runtimes (default=guessed)])])
-if test x"$enable_efiemu" = xno ; then
-  efiemu_excuse="explicitly disabled"
-fi
-if test x"$target_cpu" != xi386 ; then
-  efiemu_excuse="only available on i386"
-fi
-if test x"$platform" = xefi ; then
-  efiemu_excuse="not available on efi"
-fi
-if test x"$efiemu_excuse" = x ; then
-  AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
-    CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
-                     [grub_cv_cc_efiemu=yes],
-                     [grub_cv_cc_efiemu=no])
-  ])
-  if test x$grub_cv_cc_efiemu = xno; then
-     efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
-  fi
-fi
-if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
-  AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
-fi
-if test x"$efiemu_excuse" = x ; then
-enable_efiemu=yes
-else
-enable_efiemu=no
-fi
-AC_SUBST([enable_efiemu])
-
 if test "$platform" != emu; then
 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
   SAVED_CPPFLAGS="$CPPFLAGS"
index 73893414ab9434258ff5e7fcaf0259f673696bff..2c71fbed06bd60439ca78903aba9dacd54585c9e 100644 (file)
    As it emulates only runtime serviceit isn't able
    to chainload EFI bootloader on non-EFI system (TODO) */
 
+#ifdef __i386__
+#include <grub/i386/types.h>
+#else
+#include <grub/x86_64/types.h>
+#endif
+
 #include <grub/symbol.h>
 #include <grub/types.h>
 #include <grub/efi/api.h>
@@ -369,16 +375,16 @@ grub_efi_status_t EFI_FUNC
       switch (cur_relloc->size)
        {
        case 8:
-         *((grub_uint64_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
+         *((grub_uint64_t *) (grub_addr_t) cur_relloc->addr) += corr;
          break;
        case 4:
-         *((grub_uint32_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
+         *((grub_uint32_t *) (grub_addr_t) cur_relloc->addr) += corr;
          break;
        case 2:
-         *((grub_uint16_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
+         *((grub_uint16_t *) (grub_addr_t) cur_relloc->addr) += corr;
          break;
        case 1:
-         *((grub_uint8_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
+         *((grub_uint8_t *) (grub_addr_t) cur_relloc->addr) += corr;
          break;
        }
     }