summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/linux_trampoline.S
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2018-07-18 07:19:30 -0700
committerRonald G. Minnich <rminnich@gmail.com>2018-07-18 21:32:26 +0000
commiteeb83b6b53fc72fda60dea31fc7e0cf155ccdecf (patch)
tree2ae9b80f8db0df49df53fa415a0a6e35a819a14d /util/cbfstool/linux_trampoline.S
parentebde6595035a960e25ab74bdcfffaed45d16e7a6 (diff)
downloadcoreboot-eeb83b6b53fc72fda60dea31fc7e0cf155ccdecf.tar.gz
coreboot-eeb83b6b53fc72fda60dea31fc7e0cf155ccdecf.tar.bz2
coreboot-eeb83b6b53fc72fda60dea31fc7e0cf155ccdecf.zip
linux_trampoline: use trampoline RAM for the GDT
The linux trampoline was modifying the existing GDT to add the 0x10 and 0x18 descriptors for Linux. This will not work when the existing GDT is in ROM. Change the code to set up a new GDT in what we know to be RAM. Tested by booting a linux payload. The main reason this works is that Linux almost immediately loads its own GDT and then segment registers. This GDT is a very temporary bridge. Note that none of this change used to be necessary; the coreboot GDT was originally compatible with Linux (ca 2000); then Linux changed. Change-Id: I13990052fbfd6a500adab8a2db8f7aead1d24fa6 Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: https://review.coreboot.org/27529 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool/linux_trampoline.S')
-rw-r--r--util/cbfstool/linux_trampoline.S15
1 files changed, 7 insertions, 8 deletions
diff --git a/util/cbfstool/linux_trampoline.S b/util/cbfstool/linux_trampoline.S
index 65819e948b2d..3b4e730b3347 100644
--- a/util/cbfstool/linux_trampoline.S
+++ b/util/cbfstool/linux_trampoline.S
@@ -31,7 +31,6 @@
#define E820_OFFSET 0x2d0
.trampoline_start:
-
cld
xor %edx, %edx
mov $0, %ecx
@@ -114,12 +113,13 @@ jnz .tableScan
** Use TRAMPOLINE_ENTRY_LOC as a scratchpad.
*/
mov $TRAMPOLINE_ENTRY_LOC, %eax
-sgdt (%eax)
-mov 2(%eax), %ebx
-movl $0x0000ffff, 16(%ebx)
-movl $0x00cf9b00, 20(%ebx)
-movl $0x0000ffff, 24(%ebx)
-movl $0x00cf9300, 28(%ebx)
+movl $0x0000ffff, 16(%eax) // Set up the 2 new descriptors
+movl $0x00cf9b00, 20(%eax)
+movl $0x0000ffff, 24(%eax)
+movl $0x00cf9300, 28(%eax)
+movb $0x2b, 0(%eax) // Set the size
+movl %eax, 2(%eax) // Set pointer to new GDT
+lgdt (%eax) // Load it
/* finally: jump to kernel */
mov $LINUX_PARAM_LOC, %esi
@@ -129,5 +129,4 @@ jmp *(LINUX_PARAM_LOC + LINUX_ENTRY_OFFSET)
2:
hlt
jmp 2b
-
.trampoline_end: