<p>Hannah Williams has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25895">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">arch/x86: Relocating GDT in romstage<br><br>While in Cache as RAM, move the GDT from Flash to CAR<br><br>Change-Id: I01ded6e9b358b23e04d92bef5263bfe8c2a5ec5a<br>Signed-off-by: Hannah Williams <hannah.williams@intel.com><br>---<br>M src/arch/x86/Makefile.inc<br>M src/arch/x86/assembly_entry.S<br>A src/arch/x86/gdt_init.S<br>3 files changed, 48 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/25895/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc</span><br><span>index 07bef93..f45295c 100644</span><br><span>--- a/src/arch/x86/Makefile.inc</span><br><span>+++ b/src/arch/x86/Makefile.inc</span><br><span>@@ -206,6 +206,7 @@</span><br><span> </span><br><span> romstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c</span><br><span> romstage-y += boot.c</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-y += gdt_init.S</span><br><span> romstage-y += cbmem.c</span><br><span> romstage-y += cbfs_and_run.c</span><br><span> romstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += cpu_common.c</span><br><span>diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S</span><br><span>index e5e7d48..5a8a57e 100644</span><br><span>--- a/src/arch/x86/assembly_entry.S</span><br><span>+++ b/src/arch/x86/assembly_entry.S</span><br><span>@@ -64,6 +64,9 @@</span><br><span> #endif</span><br><span> </span><br><span>     andl    $0xfffffff0, %esp</span><br><span style="color: hsl(120, 100%, 40%);">+#if ENV_ROMSTAGE</span><br><span style="color: hsl(120, 100%, 40%);">+   call    _gdt_init</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> #if IS_ENABLED(CONFIG_IDT_IN_EVERY_STAGE)</span><br><span>       call    exception_init</span><br><span> #endif</span><br><span>diff --git a/src/arch/x86/gdt_init.S b/src/arch/x86/gdt_init.S</span><br><span>new file mode 100644</span><br><span>index 0000000..bfc5e45</span><br><span>--- /dev/null</span><br><span>+++ b/src/arch/x86/gdt_init.S</span><br><span>@@ -0,0 +1,44 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+  .code32</span><br><span style="color: hsl(120, 100%, 40%);">+       .globl _gdt_init</span><br><span style="color: hsl(120, 100%, 40%);">+_gdt_init:</span><br><span style="color: hsl(120, 100%, 40%);">+  cli</span><br><span style="color: hsl(120, 100%, 40%);">+   lgdt    %cs:gdtptr</span><br><span style="color: hsl(120, 100%, 40%);">+    ret</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ .text</span><br><span style="color: hsl(120, 100%, 40%);">+ .align  4</span><br><span style="color: hsl(120, 100%, 40%);">+.globl gdtptr</span><br><span style="color: hsl(120, 100%, 40%);">+gdt:</span><br><span style="color: hsl(120, 100%, 40%);">+gdtptr:</span><br><span style="color: hsl(120, 100%, 40%);">+       .word   gdt_end - gdt -1 /* compute the table limit */</span><br><span style="color: hsl(120, 100%, 40%);">+        .long   gdt              /* we know the offset */</span><br><span style="color: hsl(120, 100%, 40%);">+     .word   0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* selgdt 0x08, flat code segment */</span><br><span style="color: hsl(120, 100%, 40%);">+  .word   0xffff, 0x0000</span><br><span style="color: hsl(120, 100%, 40%);">+        .byte   0x00, 0x9b, 0xcf, 0x00 /* G=1 and 0x0f, So we get 4Gbytes</span><br><span style="color: hsl(120, 100%, 40%);">+                                       for limit */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      /* selgdt 0x10,flat data segment */</span><br><span style="color: hsl(120, 100%, 40%);">+   .word   0xffff, 0x0000</span><br><span style="color: hsl(120, 100%, 40%);">+        .byte   0x00, 0x93, 0xcf, 0x00</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      /* selgdt 0x18, flat code segment (64-bit) */</span><br><span style="color: hsl(120, 100%, 40%);">+ .word   0xffff, 0x0000</span><br><span style="color: hsl(120, 100%, 40%);">+        .byte   0x00, 0x9b, 0xaf, 0x00</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+gdt_end:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+.code32</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25895">change 25895</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25895"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I01ded6e9b358b23e04d92bef5263bfe8c2a5ec5a </div>
<div style="display:none"> Gerrit-Change-Number: 25895 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Hannah Williams <hannah.williams@intel.com> </div>