summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-05-29 20:07:42 +0200
committerArthur Heymans <arthur@aheymans.xyz>2021-06-02 07:47:01 +0000
commit71971c9d7e3102f4568d24107dec9ac44277d073 (patch)
tree485187e929c9772336c1971ec3c1df957b5a8bf2
parent29228286a20b377d77e17249d1a968b40edf90a7 (diff)
cbfstool/linux_trampoline.S: Fix up the e820 table
The e820 type don't fully match the LB_TAG_MEMORY types, so change all unknown types to e820 to '2', reserved memory. TESTED with Linuxboot: e820 now shows the CBMEM region as reserved. Change-Id: Ie0e41c66e002919e41590327afe0f543e0037369 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55074 Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com> Reviewed-by: Rocky Phagura Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--util/cbfstool/linux_trampoline.S15
-rw-r--r--util/cbfstool/linux_trampoline.c12
2 files changed, 21 insertions, 6 deletions
diff --git a/util/cbfstool/linux_trampoline.S b/util/cbfstool/linux_trampoline.S
index f1619cfb17..726852804f 100644
--- a/util/cbfstool/linux_trampoline.S
+++ b/util/cbfstool/linux_trampoline.S
@@ -72,7 +72,20 @@ lea 8(%ebx), %esi /* e820 data source */
mov $(LINUX_PARAM_LOC + E820_OFFSET), %edi
rep movsl
xchg %eax, %ecx
-jmp .endScan
+/* e820 and LB_TAG_MEMORY type don't fully match: remap unknown type to 2, reserved memory */
+mov (LINUX_PARAM_LOC + E820_NR_OFFSET), %eax
+mov $(LINUX_PARAM_LOC + E820_OFFSET), %edi
+.test_e820_entry:
+cmp $0, %eax
+je .endScan
+cmp $12, 16(%edi) /* type */
+jng .next_e820_entry
+/* Fixup the type to 2, reserved memory */
+mov $2, 16(%edi)
+.next_e820_entry:
+dec %eax
+add $20, %edi
+jmp .test_e820_entry
.testFramebuffer:
cmp $CB_TAG_FRAMEBUFFER, (%ebx)
diff --git a/util/cbfstool/linux_trampoline.c b/util/cbfstool/linux_trampoline.c
index 17588cb930..b804c80542 100644
--- a/util/cbfstool/linux_trampoline.c
+++ b/util/cbfstool/linux_trampoline.c
@@ -3,15 +3,17 @@
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, 0x8a, 0x00, 0x00, 0x00, 0x8b, 0x59, 0x04, 0x01, 0xcb, 0x8b, 0x49, 0x14, 0x83,
- 0x3b, 0x11, 0x75, 0x05, 0x8b, 0x4b, 0x08, 0xeb, 0xcf, 0x83, 0x3b, 0x01, 0x75, 0x33, 0x8b, 0x43,
+ 0xcb, 0x0f, 0x84, 0xaa, 0x00, 0x00, 0x00, 0x8b, 0x59, 0x04, 0x01, 0xcb, 0x8b, 0x49, 0x14, 0x83,
+ 0x3b, 0x11, 0x75, 0x05, 0x8b, 0x4b, 0x08, 0xeb, 0xcf, 0x83, 0x3b, 0x01, 0x75, 0x53, 0x8b, 0x43,
0x04, 0x83, 0xe8, 0x08, 0xc1, 0xe8, 0x02, 0x3d, 0xa0, 0x00, 0x00, 0x00, 0x7e, 0x05, 0xb8, 0xa0,
0x00, 0x00, 0x00, 0x89, 0xc6, 0xbf, 0x05, 0x00, 0x00, 0x00, 0xf7, 0xf7, 0xa3, 0xe8, 0x01, 0x09,
- 0x00, 0x89, 0xf0, 0x91, 0x8d, 0x73, 0x08, 0xbf, 0xd0, 0x02, 0x09, 0x00, 0xf3, 0xa5, 0x91, 0xeb,
- 0x05, 0x83, 0x3b, 0x12, 0x75, 0x00, 0x03, 0x5b, 0x04, 0x49, 0x75, 0xb3, 0xb8, 0x00, 0x00, 0x04,
+ 0x00, 0x89, 0xf0, 0x91, 0x8d, 0x73, 0x08, 0xbf, 0xd0, 0x02, 0x09, 0x00, 0xf3, 0xa5, 0x91, 0xa1,
+ 0xe8, 0x01, 0x09, 0x00, 0xbf, 0xd0, 0x02, 0x09, 0x00, 0x83, 0xf8, 0x00, 0x74, 0x18, 0x83, 0x7f,
+ 0x10, 0x0c, 0x7e, 0x07, 0xc7, 0x47, 0x10, 0x02, 0x00, 0x00, 0x00, 0x48, 0x83, 0xc7, 0x14, 0xeb,
+ 0xe8, 0x83, 0x3b, 0x12, 0x75, 0x00, 0x03, 0x5b, 0x04, 0x49, 0x75, 0x93, 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
};
-unsigned int trampoline_len = 180;
+unsigned int trampoline_len = 212;