dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0079-Allow-loading-old-kernels-by-placing-GDT-in-conventi.patch

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