MFi386 by jhb: use symbolic constants for the IDT entries.
This commit is contained in:
parent
48603e64b0
commit
59e5f21ece
@ -1172,26 +1172,25 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
/* exceptions */
|
||||
for (x = 0; x < NIDT; x++)
|
||||
setidt(x, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(0, &IDTVEC(div), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(1, &IDTVEC(dbg), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(2, &IDTVEC(nmi), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(3, &IDTVEC(bpt), SDT_SYSIGT, SEL_UPL, 0);
|
||||
setidt(4, &IDTVEC(ofl), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(5, &IDTVEC(bnd), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(6, &IDTVEC(ill), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(7, &IDTVEC(dna), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(8, &IDTVEC(dblfault), SDT_SYSIGT, SEL_KPL, 1);
|
||||
setidt(9, &IDTVEC(fpusegm), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(10, &IDTVEC(tss), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(11, &IDTVEC(missing), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(12, &IDTVEC(stk), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(13, &IDTVEC(prot), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(14, &IDTVEC(page), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(15, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(16, &IDTVEC(fpu), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(17, &IDTVEC(align), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(18, &IDTVEC(mchk), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(19, &IDTVEC(xmm), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_DE, &IDTVEC(div), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_DB, &IDTVEC(dbg), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_NMI, &IDTVEC(nmi), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_BPT, &IDTVEC(bpt), SDT_SYSIGT, SEL_UPL, 0);
|
||||
setidt(IDT_OF, &IDTVEC(ofl), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_BR, &IDTVEC(bnd), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_UD, &IDTVEC(ill), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_NM, &IDTVEC(dna), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_DF, &IDTVEC(dblfault), SDT_SYSIGT, SEL_KPL, 1);
|
||||
setidt(IDT_FPUGP, &IDTVEC(fpusegm), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_TS, &IDTVEC(tss), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_NP, &IDTVEC(missing), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_SS, &IDTVEC(stk), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_GP, &IDTVEC(prot), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_PF, &IDTVEC(page), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_MF, &IDTVEC(fpu), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_AC, &IDTVEC(align), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_MC, &IDTVEC(mchk), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_XF, &IDTVEC(xmm), SDT_SYSIGT, SEL_KPL, 0);
|
||||
|
||||
r_idt.rd_limit = sizeof(idt0) - 1;
|
||||
r_idt.rd_base = (long) idt;
|
||||
|
@ -263,14 +263,14 @@ static void
|
||||
ia32_syscall_enable(void *dummy)
|
||||
{
|
||||
|
||||
setidt(0x80, &IDTVEC(int0x80_syscall), SDT_SYSIGT, SEL_UPL, 0);
|
||||
setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYSIGT, SEL_UPL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
ia32_syscall_disable(void *dummy)
|
||||
{
|
||||
|
||||
setidt(0x80, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
|
||||
setidt(IDT_SYSCALL, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
|
||||
}
|
||||
|
||||
SYSINIT(ia32_syscall, SI_SUB_EXEC, SI_ORDER_ANY, ia32_syscall_enable, NULL);
|
||||
|
@ -169,6 +169,30 @@ struct region_descriptor {
|
||||
#define NIDT 256 /* 32 reserved, 16 h/w, 0 s/w, linux's 0x80 */
|
||||
#define NRSVIDT 32 /* reserved entries for cpu exceptions */
|
||||
|
||||
/*
|
||||
* Entries in the Interrupt Descriptor Table (IDT)
|
||||
*/
|
||||
#define IDT_DE 0 /* #DE: Divide Error */
|
||||
#define IDT_DB 1 /* #DB: Debug */
|
||||
#define IDT_NMI 2 /* Nonmaskable External Interrupt */
|
||||
#define IDT_BP 3 /* #BP: Breakpoint */
|
||||
#define IDT_OF 4 /* #OF: Overflow */
|
||||
#define IDT_BR 5 /* #BR: Bound Range Exceeded */
|
||||
#define IDT_UD 6 /* #UD: Undefined/Invalid Opcode */
|
||||
#define IDT_NM 7 /* #NM: No Math Coprocessor */
|
||||
#define IDT_DF 8 /* #DF: Double Fault */
|
||||
#define IDT_FPUGP 9 /* Coprocessor Segment Overrun */
|
||||
#define IDT_TS 10 /* #TS: Invalid TSS */
|
||||
#define IDT_NP 11 /* #NP: Segment Not Present */
|
||||
#define IDT_SS 12 /* #SS: Stack Segment Fault */
|
||||
#define IDT_GP 13 /* #GP: General Protection Fault */
|
||||
#define IDT_PF 14 /* #PF: Page Fault */
|
||||
#define IDT_MF 16 /* #MF: FPU Floating-Point Error */
|
||||
#define IDT_AC 17 /* #AC: Alignment Check */
|
||||
#define IDT_MC 18 /* #MC: Machine Check */
|
||||
#define IDT_XF 19 /* #XF: SIMD Floating-Point Exception */
|
||||
#define IDT_SYSCALL 0x80 /* System Call Interrupt Vector */
|
||||
|
||||
/*
|
||||
* Entries in the Global Descriptor Table (GDT)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user