ptos/amd64+hal: Add interrupt handling + P1 KPCR init

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
2026-07-11 04:46:00 +00:00
parent 0f2d2b9ea5
commit 7cb153f98c
7 changed files with 335 additions and 3 deletions
+145
View File
@@ -0,0 +1,145 @@
/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: AMD64 interrupt vectors
* Author: Chloe M.
*/
#include <machine/frameasm.h>
.text
.globl TrapDivError
TrapDivError:
INTR_ENTRY($0x00)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapDebugException
TrapDebugException:
INTR_ENTRY($0x01)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapNmi
TrapNmi:
INTR_ENTRY($0x02)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapBreakPoint
TrapBreakPoint:
INTR_ENTRY($0x03)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapOverflow
TrapOverflow:
INTR_ENTRY($0x04)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapBoundRange
TrapBoundRange:
INTR_ENTRY($0x05)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapInvalidOpcode
TrapInvalidOpcode:
INTR_ENTRY($0x06)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapNoCoprocessor
TrapNoCoprocessor:
INTR_ENTRY($0x07)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapDoubleFault
TrapDoubleFault:
INTR_ENTRY_EC($0x08)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapReserved
TrapReserved:
INTR_ENTRY($0x09)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapInvalidTss
TrapInvalidTss:
INTR_ENTRY_EC($0x0A)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapSegNotPresent
TrapSegNotPresent:
INTR_ENTRY_EC($0x0B)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapStackSegmentFault
TrapStackSegmentFault:
INTR_ENTRY_EC($0x0C)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapGeneralProtection
TrapGeneralProtection:
INTR_ENTRY_EC($0x0D)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b
.globl TrapPageFault
TrapPageFault:
INTR_ENTRY_EC($0x0E)
mov %rsp, %rdi
call MdTrapDispatch
1: cli
hlt
jmp 1b