diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index 2eb236a6186d..6cfe6e4419f3 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.11 2003/02/26 21:28:21 fvdl Exp $ */ +/* $NetBSD: cpu.c,v 1.12 2003/03/03 22:14:15 fvdl Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -699,7 +699,7 @@ cpu_set_tss_gates(struct cpu_info *ci) setsegment(&sd, &ci->ci_doubleflt_tss, sizeof(struct i386tss) - 1, SDT_SYS386TSS, SEL_KPL, 0, 0); ci->ci_gdt[GTRAPTSS_SEL].sd = sd; - setgate(&idt[8].gd, NULL, 0, SDT_SYSTASKGT, SEL_KPL, + setgate(&idt[8], NULL, 0, SDT_SYSTASKGT, SEL_KPL, GSEL(GTRAPTSS_SEL, SEL_KPL)); #if defined(DDB) && defined(MULTIPROCESSOR) @@ -718,7 +718,7 @@ cpu_set_tss_gates(struct cpu_info *ci) SDT_SYS386TSS, SEL_KPL, 0, 0); ci->ci_gdt[GIPITSS_SEL].sd = sd; - setgate(&idt[ddb_vec].gd, NULL, 0, SDT_SYSTASKGT, SEL_KPL, + setgate(&idt[ddb_vec], NULL, 0, SDT_SYSTASKGT, SEL_KPL, GSEL(GIPITSS_SEL, SEL_KPL)); #endif } diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index ab33450739d3..278f3aeef212 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.515 2003/03/01 16:37:53 fvdl Exp $ */ +/* $NetBSD: machdep.c,v 1.516 2003/03/03 22:14:16 fvdl Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.515 2003/03/01 16:37:53 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.516 2003/03/03 22:14:16 fvdl Exp $"); #include "opt_cputype.h" #include "opt_ddb.h" @@ -1234,7 +1234,8 @@ setregs(l, pack, stack) * Initialize segments and descriptor tables */ -union descriptor *idt, *gdt, *ldt; +union descriptor *gdt, *ldt; +struct gate_descriptor *idt; char idt_allocmap[NIDT]; struct simplelock idt_lock = SIMPLELOCK_INITIALIZER; #ifdef I586_CPU @@ -1925,7 +1926,7 @@ init386(first_avail) pmap_update(pmap_kernel()); memset((void *)idt_vaddr, 0, PAGE_SIZE); - idt = (union descriptor *)idt_vaddr; + idt = (struct gate_descriptor *)idt_vaddr; #ifdef I586_CPU pmap_enter(pmap_kernel(), pentium_idt_vaddr, idt_paddr, VM_PROT_READ, PMAP_WIRED|VM_PROT_READ); @@ -1934,7 +1935,8 @@ init386(first_avail) pmap_update(pmap_kernel()); tgdt = gdt; - gdt = idt + NIDT; + gdt = (union descriptor *) + ((char *)idt + NIDT * sizeof (struct gate_descriptor)); ldt = gdt + NGDT; memcpy(gdt, tgdt, NGDT*sizeof(*gdt)); @@ -1952,18 +1954,18 @@ init386(first_avail) /* exceptions */ for (x = 0; x < 32; x++) { - setgate(&idt[x].gd, IDTVEC(exceptions)[x], 0, SDT_SYS386TGT, + setgate(&idt[x], IDTVEC(exceptions)[x], 0, SDT_SYS386TGT, (x == 3 || x == 4) ? SEL_UPL : SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); idt_allocmap[x] = 1; } /* new-style interrupt gate for syscalls */ - setgate(&idt[128].gd, &IDTVEC(syscall), 0, SDT_SYS386TGT, SEL_UPL, + setgate(&idt[128], &IDTVEC(syscall), 0, SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); idt_allocmap[128] = 1; #ifdef COMPAT_SVR4 - setgate(&idt[0xd2].gd, &IDTVEC(svr4_fasttrap), 0, SDT_SYS386TGT, + setgate(&idt[0xd2], &IDTVEC(svr4_fasttrap), 0, SDT_SYS386TGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL)); idt_allocmap[0xd2] = 1; #endif /* COMPAT_SVR4 */ @@ -2409,7 +2411,7 @@ idt_vec_set(vec, function) * Vector should be allocated, so no locking needed. */ KASSERT(idt_allocmap[vec] == 1); - setgate(&idt[vec].gd, function, 0, SDT_SYS386IGT, SEL_KPL, + setgate(&idt[vec], function, 0, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); } @@ -2418,7 +2420,7 @@ idt_vec_free(vec) int vec; { simple_lock(&idt_lock); - unsetgate(&idt[vec].gd); + unsetgate(&idt[vec]); idt_allocmap[vec] = 0; simple_unlock(&idt_lock); } diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h index fd674d994576..5a9b38780ee0 100644 --- a/sys/arch/i386/include/segments.h +++ b/sys/arch/i386/include/segments.h @@ -1,4 +1,4 @@ -/* $NetBSD: segments.h,v 1.35 2002/10/05 21:26:24 fvdl Exp $ */ +/* $NetBSD: segments.h,v 1.36 2003/03/03 22:14:18 fvdl Exp $ */ /*- * Copyright (c) 1995, 1997 @@ -132,7 +132,8 @@ struct region_descriptor { #endif #ifdef _KERNEL -extern union descriptor *idt, *gdt, *ldt; +extern union descriptor *gdt, *ldt; +extern struct gate_descriptor *idt; void setgate __P((struct gate_descriptor *, void *, int, int, int, int)); void setregion __P((struct region_descriptor *, void *, size_t)); diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index 78d71cdb20d2..f22afd83b3a7 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,4 +1,4 @@ -/* $NetBSD: npx.c,v 1.91 2003/02/26 22:23:03 fvdl Exp $ */ +/* $NetBSD: npx.c,v 1.92 2003/03/03 22:14:18 fvdl Exp $ */ /*- * Copyright (c) 1994, 1995, 1998 Charles M. Hannum. All rights reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.91 2003/02/26 22:23:03 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.92 2003/03/03 22:14:18 fvdl Exp $"); #if 0 #define IPRINTF(x) printf x @@ -180,11 +180,11 @@ npxprobe1(bus_space_tag_t iot, bus_space_handle_t ioh, int irq) save_eflags = read_eflags(); disable_intr(); - save_idt_npxintr = idt[NRSVIDT + irq].gd; - save_idt_npxtrap = idt[16].gd; - setgate(&idt[NRSVIDT + irq].gd, probeintr, 0, SDT_SYS386IGT, SEL_KPL, + save_idt_npxintr = idt[NRSVIDT + irq]; + save_idt_npxtrap = idt[16]; + setgate(&idt[NRSVIDT + irq], probeintr, 0, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); - setgate(&idt[16].gd, probetrap, 0, SDT_SYS386TGT, SEL_KPL, + setgate(&idt[16], probetrap, 0, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); irqmask = i8259_setmask(~((1 << IRQ_SLAVE) | (1 << irq))); @@ -260,10 +260,10 @@ npxprobe1(bus_space_tag_t iot, bus_space_handle_t ioh, int irq) irqmask = i8259_setmask(irqmask); - idt[NRSVIDT + irq].gd = save_idt_npxintr; + idt[NRSVIDT + irq] = save_idt_npxintr; idt_allocmap[NRSVIDT + irq] = 1; - idt[16].gd = save_idt_npxtrap; + idt[16] = save_idt_npxtrap; write_eflags(save_eflags); if ((rv == NPX_NONE) || (rv == NPX_BROKEN)) {