From 141278b5e065eea1074a5818a8083a61dffa73bd Mon Sep 17 00:00:00 2001
From: phcoder <phcoder@debian.bg45.phnet>
Date: Mon, 12 Oct 2009 11:23:08 +0200
Subject: [PATCH 1/2] fix

---
 lib/i386/relocator.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/lib/i386/relocator.c b/lib/i386/relocator.c
index 84832eb02..94cbfba72 100644
--- a/lib/i386/relocator.c
+++ b/lib/i386/relocator.c
@@ -57,11 +57,9 @@ extern grub_uint32_t grub_relocator32_backward_esp;
 #define PREFIX(x) grub_relocator32_ ## x
 
 static void
-write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
-		    grub_size_t size, struct grub_relocator32_state state)
+write_call_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
+			 grub_size_t size, struct grub_relocator32_state state)
 {
-  void (*entry) ();
-
   grub_relocator32_backward_dest = dest;
   grub_relocator32_backward_src = PTR_TO_UINT64 (src);
   grub_relocator32_backward_size = size;
@@ -76,13 +74,12 @@ write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
   grub_memmove (ptr,
 		&grub_relocator32_backward_start,
 		RELOCATOR_SIZEOF (backward));
-  entry = (void (*)()) (ptr);
-  entry ();
+  ((void (*)()) ptr) ();
 }
 
 static void
-write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
-		    grub_size_t size, struct grub_relocator32_state state)
+write_call_relocator_fw (void *ptr, void *src, grub_uint32_t dest,
+			 grub_size_t size, struct grub_relocator32_state state)
 {
 
   grub_relocator32_forward_dest = dest;
@@ -99,6 +96,7 @@ write_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
   grub_memmove (ptr,
 		&grub_relocator32_forward_start,
 		RELOCATOR_SIZEOF (forward));
-  entry = (void (*)()) ptr;
-  entry ();
+  ((void (*)()) ptr) ();
 }
+
+#include "../relocator.c"

From 9385e55bddb8f4008b3ac4a9c87fc0d3f4949f09 Mon Sep 17 00:00:00 2001
From: phcoder <phcoder@debian.bg45.phnet>
Date: Sun, 18 Oct 2009 00:24:17 +0200
Subject: [PATCH 2/2] warning fixes

---
 lib/relocator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/relocator.c b/lib/relocator.c
index 622adc517..e551f337f 100644
--- a/lib/relocator.c
+++ b/lib/relocator.c
@@ -75,8 +75,8 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
       overhead =
 	ALIGN_UP (dest - RELOCATOR_SIZEOF (backward) - RELOCATOR_ALIGN,
 		  RELOCATOR_ALIGN);
-      write_call_relocator_bw (relocator - overhead,
-			       relocator - overhead,
+      write_call_relocator_bw ((char *) relocator - overhead,
+			       (char *) relocator - overhead,
 			       dest - overhead, size + overhead, state);
     }
   else
@@ -86,7 +86,7 @@ PREFIX (boot) (void *relocator, grub_uint32_t dest,
       overhead = ALIGN_UP (dest + size, RELOCATOR_ALIGN)
 	+ RELOCATOR_SIZEOF (forward) - (dest + size);
 
-      write_call_relocator_fw (relocator + size + overhead
+      write_call_relocator_fw ((char *) relocator + size + overhead
 			       - RELOCATOR_SIZEOF (forward),
 			       relocator, dest, size + overhead, state);
     }