interrupt: make LoadIDT/GDT() inline

This commit is contained in:
Edgaru089 2021-10-14 14:45:57 +08:00
parent f241551d64
commit ebdc816d82
2 changed files with 9 additions and 20 deletions

View File

@ -51,10 +51,17 @@ SYSV_ABI void interrupt_MapHandler(void *handler, int interrupt);
SYSV_ABI void interrupt_Handler(int vec, int errcode, uint64_t rip, uint64_t rax, uint64_t rbx, uint64_t rcx, uint64_t rdx, uint64_t rsi, uint64_t rdi, uint64_t rbp, uint64_t rsp, uint64_t r8, uint64_t r9, uint64_t r10, uint64_t r11, uint64_t r12, uint64_t r13, uint64_t r14, uint64_t r15); SYSV_ABI void interrupt_Handler(int vec, int errcode, uint64_t rip, uint64_t rax, uint64_t rbx, uint64_t rcx, uint64_t rdx, uint64_t rsi, uint64_t rdi, uint64_t rbp, uint64_t rsp, uint64_t r8, uint64_t r9, uint64_t r10, uint64_t r11, uint64_t r12, uint64_t r13, uint64_t r14, uint64_t r15);
// defined in assembly // defined in assembly
SYSV_ABI void interrupt_LoadGDT(void *gdtr);
SYSV_ABI void interrupt_LoadIDT(void *idtr);
SYSV_ABI void interrupt_ReloadSegments(); SYSV_ABI void interrupt_ReloadSegments();
inline void interrupt_LoadGDT(interrupt_DescriptorTableReference *gdtr) {
asm volatile("lgdt %0"
: "=m"(*gdtr));
}
inline void interrupt_LoadIDT(interrupt_DescriptorTableReference *idtr) {
asm volatile("lidt %0"
: "=m"(*idtr));
}
#define INTERRUPT_DISABLE \ #define INTERRUPT_DISABLE \
uintptr_t __interrupt_flags; \ uintptr_t __interrupt_flags; \

View File

@ -1,20 +1,10 @@
format elf64 format elf64
public interrupt_ReloadSegments public interrupt_ReloadSegments
public interrupt_LoadGDT
public interrupt_LoadIDT
section '.text' executable section '.text' executable
; sysvx64call void interrupt_LoadGDT(void* gdtr)
;
; Input: (void* rdi)
; Clobbers: none
interrupt_LoadGDT:
lgdt [rdi]
ret
; sysvx64call void interrupt_ReloadSegments() ; sysvx64call void interrupt_ReloadSegments()
; ;
; Clobbers: rax ; Clobbers: rax
@ -35,11 +25,3 @@ interrupt_ReloadSegments:
push rax push rax
retfq retfq
; sysvx64call void interrupt_LoadIDT(void* idtr)
;
; Input: (void* rdi)
; Clobbers: none
interrupt_LoadIDT:
lidt [rdi]
ret