aboutsummaryrefslogtreecommitdiff
path: root/i386/i386at
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-01-29 23:45:38 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-29 23:49:04 +0100
commitfc0d49a3eda8b89497d1f2908b29b5476019a818 (patch)
tree51a607c61cbbc1d9b9c582c3a0afcf9dfdfb4e63 /i386/i386at
parent6ebd651d6f6244315a84b8355d801d118869f722 (diff)
downloadgnumach-fc0d49a3eda8b89497d1f2908b29b5476019a818.tar.gz
gnumach-fc0d49a3eda8b89497d1f2908b29b5476019a818.tar.bz2
gnumach-fc0d49a3eda8b89497d1f2908b29b5476019a818.zip
i386: Add AP variants of descriptor tables
Diffstat (limited to 'i386/i386at')
-rw-r--r--i386/i386at/idt.h4
-rw-r--r--i386/i386at/int_init.c41
-rw-r--r--i386/i386at/int_init.h1
-rw-r--r--i386/i386at/interrupt.S9
-rw-r--r--i386/i386at/ioapic.c6
5 files changed, 45 insertions, 16 deletions
diff --git a/i386/i386at/idt.h b/i386/i386at/idt.h
index ac065aef..f080bb12 100644
--- a/i386/i386at/idt.h
+++ b/i386/i386at/idt.h
@@ -37,10 +37,14 @@
/* IOAPIC spurious interrupt vector set to 0xff */
#define IOAPIC_SPURIOUS_BASE 0xff
+/* Currently for TLB shootdowns */
+#define CALL_SINGLE_FUNCTION_BASE 0xfb
+
#include <i386/idt-gen.h>
#ifndef __ASSEMBLER__
extern void idt_init (void);
+extern void ap_idt_init (int cpu);
#endif /* __ASSEMBLER__ */
#endif /* _I386AT_IDT_ */
diff --git a/i386/i386at/int_init.c b/i386/i386at/int_init.c
index 3fed4197..964ce1bb 100644
--- a/i386/i386at/int_init.c
+++ b/i386/i386at/int_init.c
@@ -23,29 +23,50 @@
#include <i386at/idt.h>
#include <i386at/int_init.h>
-#include <i386/gdt.h>
+#include <i386/mp_desc.h>
+#include <i386/i386asm.h>
/* defined in locore.S */
extern vm_offset_t int_entry_table[];
-void int_init(void)
+void
+int_fill(struct real_gate *myidt)
{
int i;
#ifndef APIC
- for (i = 0; i < 16; i++) {
- fill_idt_gate(PIC_INT_BASE + i,
+ int base = PIC_INT_BASE;
+ int nirq = 16;
+#else
+ int base = IOAPIC_INT_BASE;
+ int nirq = 24;
+#endif
+
+ for (i = 0; i < nirq; i++) {
+ fill_idt_gate(myidt, base + i,
int_entry_table[i], KERNEL_CS,
ACC_PL_K|ACC_INTR_GATE, 0);
}
-#else
- for (i = 0; i < 24; i++) {
- fill_idt_gate(IOAPIC_INT_BASE + i,
+ fill_idt_gate(myidt, CALL_SINGLE_FUNCTION_BASE,
int_entry_table[i], KERNEL_CS,
ACC_PL_K|ACC_INTR_GATE, 0);
- }
- fill_idt_gate(IOAPIC_SPURIOUS_BASE,
- int_entry_table[24], KERNEL_CS,
+ i++;
+#ifdef APIC
+ fill_idt_gate(myidt, IOAPIC_SPURIOUS_BASE,
+ int_entry_table[i], KERNEL_CS,
ACC_PL_K|ACC_INTR_GATE, 0);
+ i++;
#endif
}
+void
+int_init(void)
+{
+ int_fill(idt);
+}
+
+#if NCPUS > 1
+void ap_int_init(int cpu)
+{
+ int_fill(mp_desc_table[cpu]->idt);
+}
+#endif
diff --git a/i386/i386at/int_init.h b/i386/i386at/int_init.h
index f9b03b74..3c11ebce 100644
--- a/i386/i386at/int_init.h
+++ b/i386/i386at/int_init.h
@@ -29,6 +29,7 @@
#ifndef __ASSEMBLER__
extern void int_init (void);
+extern void ap_int_init (int cpu);
#endif /* __ASSEMBLER__ */
#endif /* _INT_INIT_H_ */
diff --git a/i386/i386at/interrupt.S b/i386/i386at/interrupt.S
index 16e0df10..9f1883ac 100644
--- a/i386/i386at/interrupt.S
+++ b/i386/i386at/interrupt.S
@@ -58,6 +58,9 @@ ENTRY(interrupt)
movl %eax,12(%esp) /* address of interrupted registers as 4th arg */
movl S_IRQ,%eax /* copy irq number */
+ cmpl $CALL_SINGLE_FUNCTION_BASE,%eax /* was this a SMP call single function request? */
+ je _call_single
+
shll $2,%eax /* irq * 4 */
movl EXT(iunit)(%eax),%edx /* get device unit number */
movl %edx,(%esp) /* unit number as 1st arg */
@@ -117,4 +120,10 @@ _isa_eoi:
addl $24,%esp /* pop local variables */
_no_eoi:
ret
+
+_call_single:
+ call EXT(pmap_update_interrupt) /* TODO: Allow other functions */
+ call EXT(lapic_eoi) /* lapic EOI */
+ addl $24,%esp
+ ret
END(interrupt)
diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c
index 3373aa71..c5eb3536 100644
--- a/i386/i386at/ioapic.c
+++ b/i386/i386at/ioapic.c
@@ -234,12 +234,6 @@ ioapic_toggle(int pin, int mask)
}
void
-lapic_eoi(void)
-{
- lapic->eoi.r = 0;
-}
-
-void
ioapic_irq_eoi(int pin)
{
int apic = 0;