arch/x86: allow idt to be available to link in all stages

Add Kconfig IDT_IN_EVERY_STAGE to optionally specify having
the interrupt handling code available to all stages. In order
to do this the idt setup is moved to a C module. The vecX
entries are made global so that a table of references to all
the interrupt vector entry points can be used to dynamically
initialize the idt. The ramification for ramstage is that
exceptions are initialized later (lib/hardwaremain.c). Not
all stages initialize exceptions when this Kconfig variable
is selected, but bootblock for the C, stages using
assembly_entry.S, and of course ramstage do. Anything left
out just needs a call to exception_init() at the right
location.

BUG=b:72728953

Change-Id: I4146a040e5e43bed7ccc6cb0a7dc2271f1e7b7fa
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/25761
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin
2018-04-20 01:39:30 -06:00
parent e74ba1984d
commit 4b032e457f
7 changed files with 142 additions and 32 deletions

View File

@ -81,28 +81,6 @@ _start:
push $0
push $0
/* Initialize the Interrupt Descriptor table */
leal _idt, %edi
leal vec0, %ebx
movl $(0x10 << 16), %eax /* cs selector */
1: movw %bx, %ax
movl %ebx, %edx
movw $0x8E00, %dx /* Interrupt gate - dpl=0, present */
movl %eax, 0(%edi)
movl %edx, 4(%edi)
addl $6, %ebx
addl $8, %edi
cmpl $_idt_end, %edi
jne 1b
/* Load the Interrupt descriptor table */
#ifndef __x86_64__
lidt idtarg
#else
// FIXME port table to x64 - lidt idtarg
#endif
/*
* Now we are finished. Memory is up, data is copied and
* bss is cleared. Now we call the main routine and
@ -145,7 +123,7 @@ gdb_stub_breakpoint:
jmp int_hand
#endif
.globl gdt, gdt_end, idtarg
.globl gdt, gdt_end
gdtaddr:
.word gdt_end - gdt - 1
@ -227,14 +205,6 @@ gdt:
#endif
gdt_end:
idtarg:
.word _idt_end - _idt - 1 /* limit */
.long _idt
.word 0
_idt:
.fill 20, 8, 0 # idt is uninitialized
_idt_end:
.section ".text._start", "ax", @progbits
#ifdef __x86_64__
SetCodeSelector: