it's a trap!

This commit is contained in:
julianb0 2019-07-09 20:02:36 +02:00
parent cc4b8724cd
commit 4d89b8656a
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
2 changed files with 14 additions and 18 deletions

View File

@ -2,23 +2,19 @@
; See the LICENSE file in the project root for more information.
TrapHandlers.prolog:
sub rsp, rbp, 56
mov q[rbp-8], r10
mov q[rbp-16], r11
mov q[rbp-24], r12
mov q[rbp-32], r13
mov q[rbp-40], r14
mov q[rbp-48], r15
sub rsp, rbp, 32
mov q[rbp-8], r11
mov q[rbp-16], r12
mov q[rbp-24], r13
cmp q[rsp], r13
crash.z
jmp rax ; go back
TrapHandlers.epilog:
mov r10, q[rbp-8]
mov r11, q[rbp-16]
mov r12, q[rbp-24]
mov r13, q[rbp-32]
mov r14, q[rbp-40]
mov r15, q[rbp-48]
mov r11, q[rbp-8]
mov r12, q[rbp-16]
mov r13, q[rbp-24]
mov ax0, r11
call IDT.DoneHandling

View File

@ -61,12 +61,12 @@ When called, a handler will receive the number of the E/I it is handling in R10,
and its own RFRAME ID in R11. (in particular, if exception #25 happens and there are no
handler for it, the handler #0 that will be called will receive '25' in R10, and '0' in R11).
R11 is the value that must be passed to the 'initdone' iocall.
The handler will also receive the previous RFRAME ID in R12, the previous RIP in R15 and the
previous RPC in R14. R13's content is meaningful only to the processor.
The handler will also receive the previous RFRAME ID in R12.
R13 is also modified but its value is meaningful only to the processor.
To return from an E/I, *after* having called 'idtdone', the handler must simply restore
R10-R15's values to what they were when the handler started executing, and then use
the 'IRET' instruction.
To return from an E/I, *after* having called 'idtdone' (using the value originally in R11),
the handler must simply restore R12's and R13's values to what they were when the handler
started executing, and then use the 'IRET' instruction.
Clearing the interrupt flag prevents (and queues) maskable hardware interrupts