grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Another fix for x86_64


From: Jeroen Dekkers
Subject: [PATCH] Another fix for x86_64
Date: Wed, 07 Jun 2006 13:16:39 +0200
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.0.50 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Thu, 1 Jun 2006 17:39:13 +0200,
Yoshinori K. Okuji wrote:
> 
> On Wednesday 31 May 2006 23:00, Jeroen Dekkers wrote:
> > It's actually a necessary feature for GRUB on amd64. On amd64 you have
> > 64-bit executables but GRUB will run in 32-bit mode.
> >
> > When trying to compile on amd64 I already ran into some problems
> > related to that. First of all on amd64 all binaries are run in 64-bit
> > mode, so the host CFLAGS variable shouldn't have -m32. Secondly LIBS
> > is for the host only and shouldn't be defined when running target
> > tests. As last we set CFLAGS, CC, etc. to the TARGET_*, then we run
> > some checks and change the TARGET_* flags without updating CC, CFLAGS,
> > etc to the new version.
> >
> > The attached patch should fix those problems. I've tested it on i386-pc
> > and x86_64.
> 
> It looks good. Please check it in.

Now I actually booted GRUB 2 in qemu, I found another bug. :-) We are
still using grub_host_* types in grub/kernel.h, but the types of those
changed. We should use grub_target_* types there. As I didn't see any
other use of grub_host_* types, I just renamed those to grub_target_*
and changed the #ifdef. See the patch below.

Jeroen Dekkers

2006-06-07  Jeroen Dekkers  <address@hidden>

        * include/grub/types.h (grub_host_addr_t): Rename to
        grub_target_addr_t.
        (grub_host_off_t): Rename to grub_target_off_t.
        (grub_host_size_t): Rename to grub_target_size_t.
        (grub_host_ssize_t): Rename to grub_target_ssize_t.
        Refer to GRUB_TARGET_SIZEOF_VOID_P to define those variables.

        * include/grub/kernel.h (struct grub_module_header): Change type
        of OFFSET to grub_target_off_t and type of SIZE to grub_target_size_t.
        (grub_module_info): Likewise.
        
Index: include/grub/kernel.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/kernel.h,v
retrieving revision 1.8
diff -u -p -r1.8 kernel.h
--- include/grub/kernel.h       25 Apr 2006 20:08:31 -0000      1.8
+++ include/grub/kernel.h       7 Jun 2006 11:12:39 -0000
@@ -26,9 +26,9 @@
 struct grub_module_header
 {
   /* The offset of object code.  */
-  grub_host_off_t offset;
+  grub_target_off_t offset;
   /* The size of object code plus this header.  */
-  grub_host_size_t size;
+  grub_target_size_t size;
 };
 
 /* "gmim" (GRUB Module Info Magic).  */
@@ -39,9 +39,9 @@ struct grub_module_info
   /* Magic number so we know we have modules present.  */
   grub_uint32_t magic;
   /* The offset of the modules.  */
-  grub_host_off_t offset;
+  grub_target_off_t offset;
   /* The size of all modules plus this header.  */
-  grub_host_size_t size;
+  grub_target_size_t size;
 };
 
 extern grub_addr_t grub_arch_modules_addr (void);
Index: include/grub/types.h
===================================================================
RCS file: /cvsroot/grub/grub2/include/grub/types.h,v
retrieving revision 1.9
diff -u -p -r1.9 types.h
--- include/grub/types.h        4 Jun 2006 15:56:54 -0000       1.9
+++ include/grub/types.h        7 Jun 2006 11:12:39 -0000
@@ -69,16 +69,16 @@ typedef unsigned long long  grub_uint64_t
 #endif
 
 /* Misc types.  */
-#if SIZEOF_VOID_P == 8
-typedef grub_uint64_t  grub_host_addr_t;
-typedef grub_uint64_t  grub_host_off_t;
-typedef grub_uint64_t  grub_host_size_t;
-typedef grub_int64_t   grub_host_ssize_t;
+#if GRUB_TARGET_SIZEOF_VOID_P == 8
+typedef grub_uint64_t  grub_target_addr_t;
+typedef grub_uint64_t  grub_target_off_t;
+typedef grub_uint64_t  grub_target_size_t;
+typedef grub_int64_t   grub_target_ssize_t;
 #else
-typedef grub_uint32_t  grub_host_addr_t;
-typedef grub_uint32_t  grub_host_off_t;
-typedef grub_uint32_t  grub_host_size_t;
-typedef grub_int32_t   grub_host_ssize_t;
+typedef grub_uint32_t  grub_target_addr_t;
+typedef grub_uint32_t  grub_target_off_t;
+typedef grub_uint32_t  grub_target_size_t;
+typedef grub_int32_t   grub_target_ssize_t;
 #endif
 
 #if GRUB_CPU_SIZEOF_VOID_P == 8





reply via email to

[Prev in Thread] Current Thread [Next in Thread]