From: Bin Meng <bmeng.cn@gmail.com>
Date: Thu, 8 Oct 2015 03:19:09 +0000 (-0700)
Subject: x86: Initialize GDT entry 1 to be the 32-bit CS as well
X-Git-Tag: v2025.01-rc5-pxa1908~11507^2~49
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/html/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=19038e1bb629a365aaf971a65744e2f0e8866d62;p=u-boot.git

x86: Initialize GDT entry 1 to be the 32-bit CS as well

Some OS (like VxWorks) requires GDT entry 1 to be the 32-bit CS.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Jian Luo <jian.luo4@boschrexroth.de>
---

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 1b76ca117e..812c5e4e6b 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -142,7 +142,12 @@ void arch_setup_gd(gd_t *new_gd)
 
 	gdt_addr = new_gd->arch.gdt;
 
-	/* CS: code, read/execute, 4 GB, base 0 */
+	/*
+	 * CS: code, read/execute, 4 GB, base 0
+	 *
+	 * Some OS (like VxWorks) requires GDT entry 1 to be the 32-bit CS
+	 */
+	gdt_addr[X86_GDT_ENTRY_UNUSED] = GDT_ENTRY(0xc09b, 0, 0xfffff);
 	gdt_addr[X86_GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff);
 
 	/* DS: data, read/write, 4 GB, base 0 */