011fe81
From 42c1756fd0ff7d94dcc8e9be2e429a2a976f6d41 Mon Sep 17 00:00:00 2001
011fe81
From: Piotr Krysiuk <piotras@gmail.com>
011fe81
Date: Sun, 20 Apr 2014 15:58:45 +0200
4dcaf21
Subject: [PATCH 079/143] Allow loading old kernels by placing GDT in
011fe81
 conventional memory.
011fe81
011fe81
---
011fe81
 ChangeLog                      |  5 +++++
011fe81
 grub-core/lib/i386/relocator.c | 11 +++++++----
011fe81
 2 files changed, 12 insertions(+), 4 deletions(-)
011fe81
011fe81
diff --git a/ChangeLog b/ChangeLog
011fe81
index 3556468..73a8928 100644
011fe81
--- a/ChangeLog
011fe81
+++ b/ChangeLog
011fe81
@@ -1,3 +1,8 @@
011fe81
+2014-04-20  Piotr Krysiuk  <piotras@gmail.com>
011fe81
+
011fe81
+	* grub-core/lib/i386/relocator.c: Allow loading old kernels by placing
011fe81
+	GDT in conventional memory.
011fe81
+
011fe81
 2014-04-10  Colin Watson  <cjwatson@ubuntu.com>
011fe81
 
011fe81
 	* util/grub.d/30_os-prober.in: Tolerate devices with no filesystem
011fe81
diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c
011fe81
index d2a1b27..ffaf25f 100644
011fe81
--- a/grub-core/lib/i386/relocator.c
011fe81
+++ b/grub-core/lib/i386/relocator.c
011fe81
@@ -81,10 +81,13 @@ grub_relocator32_boot (struct grub_relocator *rel,
011fe81
   void *relst;
011fe81
   grub_relocator_chunk_t ch;
011fe81
 
011fe81
-  err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
011fe81
-					  (0xffffffff - RELOCATOR_SIZEOF (32))
011fe81
-					  + 1, RELOCATOR_SIZEOF (32), 16,
011fe81
-					  GRUB_RELOCATOR_PREFERENCE_NONE,
011fe81
+  /* Specific memory range due to Global Descriptor Table for use by payload
011fe81
+     that we will store in returned chunk.  The address range and preference
011fe81
+     are based on "THE LINUX/x86 BOOT PROTOCOL" specification.  */
011fe81
+  err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000,
011fe81
+					  0x9a000 - RELOCATOR_SIZEOF (32),
011fe81
+					  RELOCATOR_SIZEOF (32), 16,
011fe81
+					  GRUB_RELOCATOR_PREFERENCE_LOW,
011fe81
 					  avoid_efi_bootservices);
011fe81
   if (err)
011fe81
     return err;
011fe81
-- 
37b39b7
1.9.3
011fe81