[PATCH v2 3/6] kexec, x86: put ramdisk high for 64bit bzImage

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

 



only do that for 64bit bzImage, and will fall back to low if fail to get high.

Signed-off-by: Yinghai Lu <yinghai at kernel.org>
---
 kexec/arch/i386/x86-linux-setup.c |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 53d9df9..b0e6119 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -69,20 +69,34 @@ void setup_linux_bootloader_parameters(
 	}
 
 	/* Load the initrd if we have one */
+	initrd_base = 0;
 	if (initrd_buf) {
-		initrd_base = add_buffer(info,
-			initrd_buf, initrd_size, initrd_size,
-			4096, INITRD_BASE, initrd_addr_max, -1);
+		if (real_mode->protocol_version >= 0x020c &&
+		    real_mode->code64_start_offset) {
+			initrd_base = add_buffer(info,
+				initrd_buf, initrd_size, initrd_size,
+				4096, 1UL<<32, ULONG_MAX, -1);
+			if (!initrd_base)
+				initrd_base = add_buffer(info,
+					initrd_buf, initrd_size, initrd_size,
+					4096, 1UL<<30, 1UL<<32, -1);
+		}
+		if (!initrd_base)
+			initrd_base = add_buffer(info,
+				initrd_buf, initrd_size, initrd_size,
+				4096, INITRD_BASE, initrd_addr_max, -1);
 		dbgprintf("Loaded initrd at 0x%lx size 0x%lx\n", initrd_base,
 			initrd_size);
-	} else {
-		initrd_base = 0;
+	} else
 		initrd_size = 0;
-	}
 
 	/* Ramdisk address and size */
-	real_mode->initrd_start = initrd_base;
-	real_mode->initrd_size  = initrd_size;
+	real_mode->initrd_start = initrd_base & 0xffffffff;
+	real_mode->initrd_size  = initrd_size & 0xffffffff;
+	if ((initrd_base + initrd_size) > (1ULL<<32)) {
+		real_mode->ext_ramdisk_image = initrd_base >> 32;
+		real_mode->ext_ramdisk_size  = initrd_size >> 32;
+	}
 
 	/* The location of the command line */
 	/* if (real_mode_base == 0x90000) { */
-- 
1.7.7




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux