2019-07-09 19:51:03 +02:00
|
|
|
; The OS/K Team licenses this file to you under the MIT license.
|
|
|
|
; See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
|
TrapHandlers.prolog:
|
2019-07-17 22:25:50 +02:00
|
|
|
mov rbp, rsp
|
|
|
|
sub rsp, rsp, 24
|
2019-07-09 20:02:36 +02:00
|
|
|
mov q[rbp-8], r11
|
|
|
|
mov q[rbp-16], r12
|
|
|
|
mov q[rbp-24], r13
|
2019-07-10 20:11:35 +02:00
|
|
|
|
|
|
|
mov rdx, cr2
|
2019-07-09 19:51:03 +02:00
|
|
|
|
2019-07-10 17:17:45 +02:00
|
|
|
; nx0 = caller's cr2
|
|
|
|
mov ax0, r12
|
|
|
|
mov ax1, $cr2
|
|
|
|
iocall CPUDEV, RFS.LoadReg.slot
|
2019-07-10 20:11:35 +02:00
|
|
|
|
2019-07-10 17:17:45 +02:00
|
|
|
mov nx0, cr2
|
2019-07-10 20:11:35 +02:00
|
|
|
mov cr2, rdx
|
2019-07-17 22:25:50 +02:00
|
|
|
mov rdx, zero
|
2019-07-10 17:17:45 +02:00
|
|
|
|
2019-07-10 20:11:35 +02:00
|
|
|
jmp rcx
|
2019-07-09 19:51:03 +02:00
|
|
|
|
|
|
|
TrapHandlers.epilog:
|
2019-07-09 20:02:36 +02:00
|
|
|
mov r13, q[rbp-24]
|
2019-07-09 20:16:35 +02:00
|
|
|
mov r12, q[rbp-16]
|
|
|
|
mov r11, q[rbp-8]
|
2019-07-09 19:51:03 +02:00
|
|
|
|
2019-07-10 12:26:15 +02:00
|
|
|
; TRAP return values: RAX-RDX
|
|
|
|
|
|
|
|
mov ax0, r12
|
|
|
|
mov ax1, $rax
|
|
|
|
mov ax2, rax
|
|
|
|
call RFS.StoreReg
|
2019-07-10 12:28:20 +02:00
|
|
|
|
2019-07-10 12:26:15 +02:00
|
|
|
mov ax1, $rdx
|
|
|
|
mov ax2, rdx
|
|
|
|
call RFS.StoreReg
|
|
|
|
|
2019-07-09 19:51:03 +02:00
|
|
|
mov ax0, r11
|
|
|
|
call IDT.DoneHandling
|
2019-07-10 20:11:35 +02:00
|
|
|
|
2019-07-09 19:51:03 +02:00
|
|
|
iret
|
|
|
|
|