summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/machdep.c1
-rw-r--r--sys/arch/amd64/amd64/trap.S10
-rw-r--r--sys/arch/amd64/amd64/trap.c10
3 files changed, 19 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 6342aab..e5fe83e 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -78,6 +78,7 @@ interrupts_init(void)
idt_set_desc(0x8, IDT_TRAP_GATE_FLAGS, ISR(double_fault), 0);
idt_set_desc(0xA, IDT_TRAP_GATE_FLAGS, ISR(invl_tss), 0);
idt_set_desc(0xB, IDT_TRAP_GATE_FLAGS, ISR(segnp), 0);
+ idt_set_desc(0xC, IDT_TRAP_GATE_FLAGS, ISR(ss_fault), 0);
idt_set_desc(0xD, IDT_TRAP_GATE_FLAGS, ISR(general_prot), 0);
idt_set_desc(0xE, IDT_TRAP_GATE_FLAGS, ISR(page_fault), 0);
idt_load();
diff --git a/sys/arch/amd64/amd64/trap.S b/sys/arch/amd64/amd64/trap.S
index 5a77955..66dd2a9 100644
--- a/sys/arch/amd64/amd64/trap.S
+++ b/sys/arch/amd64/amd64/trap.S
@@ -144,3 +144,13 @@ nmi:
/* TODO */
cli
hlt
+
+.globl ss_fault
+ss_fault:
+ push_trapframe_ec $TRAP_SS
+
+ handle_trap
+
+ /* TODO */
+ cli
+ hlt
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index b73048d..c1cff56 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -44,7 +44,8 @@ static const char *trap_type[] = {
[TRAP_SEGNP] = "segment not present",
[TRAP_PROTFLT] = "general protection",
[TRAP_PAGEFLT] = "page fault",
- [TRAP_NMI] = "non-maskable interrupt"
+ [TRAP_NMI] = "non-maskable interrupt",
+ [TRAP_SS] = "stack-segment fault"
};
static const int TRAP_COUNT = __ARRAY_COUNT(trap_type);
@@ -54,12 +55,17 @@ dbg_errcode(struct trapframe *tf)
{
uint64_t ec = tf->error_code;
- if (tf->trapno == TRAP_PAGEFLT) {
+ switch (tf->trapno) {
+ case TRAP_PAGEFLT:
kprintf("bits (pwui): %c%c%c%c\n",
__TEST(ec, __BIT(0)) ? 'p' : '-',
__TEST(ec, __BIT(1)) ? 'w' : '-',
__TEST(ec, __BIT(2)) ? 'u' : '-',
__TEST(ec, __BIT(4)) ? 'i' : '-');
+ break;
+ case TRAP_SS:
+ kprintf("ss: 0x%x\n", ec);
+ break;
}
}