Shuo Liu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82705?usp=email )
Change subject: util/cbfstool: Disable paging for linux payload ......................................................................
util/cbfstool: Disable paging for linux payload
cbfs linux payload follows 32 bit kenrel boot protocol. Per kernel spec requires, paging should be disabled. Enforce 32 bit paging disabling in the trampoline codes.
Reference: https://www.kernel.org/doc/Documentation/x86/boot.rst
TEST=Build and boot on intel/archercity CRB
Change-Id: I50a4ab2664910e5772b90b3dade8866f28361d87 Signed-off-by: Shuo Liu shuo.liu@intel.com Co-authored-by: Gang Chen gang.c.chen@intel.com --- M util/cbfstool/linux_trampoline.S M util/cbfstool/linux_trampoline.c 2 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/82705/1
diff --git a/util/cbfstool/linux_trampoline.S b/util/cbfstool/linux_trampoline.S index 4f61209..0161984 100644 --- a/util/cbfstool/linux_trampoline.S +++ b/util/cbfstool/linux_trampoline.S @@ -21,6 +21,8 @@ #define LINUX_ENTRY_OFFSET 0x214 #define E820_OFFSET 0x2d0
+#define CR0_PG (1 << 31) + .trampoline_start: cld xor %edx, %edx @@ -185,6 +187,10 @@ movl %eax, 2(%eax) // Set pointer to new GDT lgdt (%eax) // Load it
+movl %cr0, %eax +andl $(~(CR0_PG)), %eax // Disable paging +movl %eax, %cr0 + /* finally: jump to kernel */ mov $LINUX_PARAM_LOC, %esi jmp *(LINUX_PARAM_LOC + LINUX_ENTRY_OFFSET) diff --git a/util/cbfstool/linux_trampoline.c b/util/cbfstool/linux_trampoline.c index 13c0edb..6ec90bf 100644 --- a/util/cbfstool/linux_trampoline.c +++ b/util/cbfstool/linux_trampoline.c @@ -3,7 +3,7 @@ unsigned char trampoline[] = { 0xfc, 0x31, 0xd2, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x01, 0x00, 0x01, 0xcb, 0x8b, 0x01, 0x3d, 0x4c, 0x42, 0x49, 0x4f, 0x74, 0x07, 0x83, 0xc1, 0x10, 0x39, 0xcb, 0x75, 0xe9, 0x39, - 0xcb, 0x0f, 0x84, 0x47, 0x01, 0x00, 0x00, 0x8b, 0x59, 0x04, 0x01, 0xcb, 0x8b, 0x49, 0x14, 0x83, + 0xcb, 0x0f, 0x84, 0x52, 0x01, 0x00, 0x00, 0x8b, 0x59, 0x04, 0x01, 0xcb, 0x8b, 0x49, 0x14, 0x83, 0x3b, 0x11, 0x75, 0x05, 0x8b, 0x4b, 0x08, 0xeb, 0xcf, 0x83, 0x3b, 0x01, 0x75, 0x70, 0x8b, 0x43, 0x04, 0x83, 0xe8, 0x08, 0xc1, 0xe8, 0x02, 0x66, 0x81, 0x3d, 0x06, 0x02, 0x09, 0x00, 0x04, 0x02, 0x7d, 0x0e, 0x3d, 0xa0, 0x00, 0x00, 0x00, 0x7e, 0x13, 0xb8, 0xa0, 0x00, 0x00, 0x00, 0xeb, 0x0c, @@ -23,7 +23,7 @@ 0x5b, 0x04, 0x49, 0x0f, 0x85, 0xf6, 0xfe, 0xff, 0xff, 0xb8, 0x00, 0x00, 0x04, 0x00, 0xc7, 0x40, 0x10, 0xff, 0xff, 0x00, 0x00, 0xc7, 0x40, 0x14, 0x00, 0x9b, 0xcf, 0x00, 0xc7, 0x40, 0x18, 0xff, 0xff, 0x00, 0x00, 0xc7, 0x40, 0x1c, 0x00, 0x93, 0xcf, 0x00, 0xc6, 0x00, 0x2b, 0x89, 0x40, 0x02, - 0x0f, 0x01, 0x10, 0xbe, 0x00, 0x00, 0x09, 0x00, 0xff, 0x25, 0x14, 0x02, 0x09, 0x00, 0xf4, 0xeb, - 0xfd + 0x0f, 0x01, 0x10, 0x0f, 0x20, 0xc0, 0x25, 0xff, 0xff, 0xff, 0x7f, 0x0f, 0x22, 0xc0, 0xbe, 0x00, + 0x00, 0x09, 0x00, 0xff, 0x25, 0x14, 0x02, 0x09, 0x00, 0xf4, 0xeb, 0xfd }; -unsigned int trampoline_len = 369; +unsigned int trampoline_len = 380;