[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC/PoC PATCH 1/3] i386: set initrd_max to 4G - 1 to allow
From: |
Li Zhijian |
Subject: |
[Qemu-devel] [RFC/PoC PATCH 1/3] i386: set initrd_max to 4G - 1 to allow up to 4G initrd |
Date: |
Thu, 8 Nov 2018 18:59:42 +0800 |
x86/x86_64 has alredy supported 4G initrd.
linux/arch/x86/boot/header.S:
# (Header version 0x0203 or later) the highest safe address for the contents
# of an initrd. The current kernel allows up to 4 GB, but leave it at 2 GB to
# avoid possible bootloader bugs.
CC: Philip Li <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
---
hw/i386/pc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index cd5029c..e1b910f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -913,6 +913,12 @@ static void load_linux(PCMachineState *pcms,
/* highest address for loading the initrd */
if (protocol >= 0x203) {
initrd_max = ldl_p(header+0x22c);
+ if (initrd_max == 0x7fffffff) {
+ /* for some reasons, initrd_max is hard code with 0x7fffffff
+ * hard code to 4G - 1 to allow 4G initrd
+ */
+ initrd_max = UINT32_MAX - 1;
+ }
} else {
initrd_max = 0x37ffffff;
}
--
2.7.4