summaryrefslogtreecommitdiff
path: root/src/arch/x86/gdt_init.S
diff options
context:
space:
mode:
authorHannah Williams <hannah.williams@intel.com>2018-04-27 09:09:04 -0700
committerAaron Durbin <adurbin@chromium.org>2018-05-03 04:40:58 +0000
commitd3c0c0c318d2e2b5a3d6276bb0fdd732170756d3 (patch)
treebed0302a3bb8c7223cf41c9cf538c27aaeb83098 /src/arch/x86/gdt_init.S
parent0f9af5500e7bc524debe3affd1a9cb406102ab9a (diff)
downloadcoreboot-d3c0c0c318d2e2b5a3d6276bb0fdd732170756d3.tar.xz
arch/x86: Relocate GDT in verstage, romstage, and postcar
In each stage keep GDT in the code region. This accommodates platforms, such as glk, that are executing out of CAR. The gdt is small and loading it is trivial so just do it unconditionally instead of introducing another Kconfig. BUG=b:78656686 Change-Id: I01ded6e9b358b23e04d92bef5263bfe8c2a5ec5a Signed-off-by: Hannah Williams <hannah.williams@intel.com> Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/25895 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'src/arch/x86/gdt_init.S')
-rw-r--r--src/arch/x86/gdt_init.S43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/arch/x86/gdt_init.S b/src/arch/x86/gdt_init.S
new file mode 100644
index 0000000000..6aa2a79b48
--- /dev/null
+++ b/src/arch/x86/gdt_init.S
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+.code32
+.section ".text._gdt_", "ax", @progbits
+
+ .globl gdt_init
+gdt_init:
+ lgdt %cs:gdtptr
+ ret
+
+.previous
+ .align 4
+.globl gdtptr
+gdt:
+gdtptr:
+ .word gdt_end - gdt -1 /* compute the table limit */
+ .long gdt /* we know the offset */
+ .word 0
+
+ /* selgdt 0x08, flat code segment */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes
+ for limit */
+
+ /* selgdt 0x10,flat data segment */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x93, 0xcf, 0x00
+
+ /* selgdt 0x18, flat code segment (64-bit) */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x9b, 0xaf, 0x00
+
+gdt_end: