Capture base pointer in fault handler

This commit is contained in:
Baptiste Wicht 2016-10-03 21:54:48 +02:00
parent 7f574e8117
commit b4426249da
No known key found for this signature in database
GPG Key ID: C5566B6C7F884532
2 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@ constexpr const size_t SYSCALL_FIRST = 50;
constexpr const size_t SYSCALL_MAX = 10;
struct fault_regs {
uint64_t rbp;
uint64_t error_no;
uint64_t error_code;
uint64_t rip;

View File

@ -13,6 +13,7 @@
.global _isr\number
_isr\number:
push \number
push rbp
jmp isr_common_handler
.endm
@ -24,6 +25,7 @@ _isr\number:
push 0 // Dummy error code
push \number
push rbp
jmp isr_common_handler
.endm
@ -69,6 +71,6 @@ isr_common_handler:
// TODO At this point, it is absolutely not safe to return since most
// registers will get trashed the fault handler must hang
add rsp, 8 // Cleans the pushed error number
add rsp, 16 // Cleans the pushed base pointer and error number
iretq // iret will clean the other automatically pushed stuff