aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/context_x86_64.asm
blob: 10ed1f6db4572e5a7d279ad7d3a4476d81530598 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
        [bits 64] 
 
        %define MJB_RBX    0
        %define MJB_RBP    1
        %define MJB_R12    2
        %define MJB_R13    3
        %define MJB_R14    4
        %define MJB_R15    5
        %define MJB_RSP    6
        %define MJB_PC     7
        %define MJB_SIZE (8*8) 
 
EXPORT __mylongjmp 
        mov rbx, [rdi + MJB_RBX * 8] 
        mov rbp, [rdi + MJB_RBP * 8] 
        mov r12, [rdi + MJB_R12 * 8] 
        mov r13, [rdi + MJB_R13 * 8] 
        mov r14, [rdi + MJB_R14 * 8] 
        mov r15, [rdi + MJB_R15 * 8] 
        test esi, esi 
        mov eax, 1 
        cmove esi, eax 
        mov eax, esi 
        mov rdx, [rdi + MJB_PC * 8] 
        mov rsp, [rdi + MJB_RSP * 8] 
        jmp rdx 
 
EXPORT __mysetjmp 
        mov [rdi + MJB_RBX * 8], rbx 
        mov [rdi + MJB_RBP * 8], rbp 
        mov [rdi + MJB_R12 * 8], r12 
        mov [rdi + MJB_R13 * 8], r13 
        mov [rdi + MJB_R14 * 8], r14 
        mov [rdi + MJB_R15 * 8], r15 
        lea rdx, [rsp + 8] 
        mov [rdi + MJB_RSP * 8], rdx 
        mov rax, [rsp] 
        mov [rdi + MJB_PC * 8], rax 
        mov eax, 0 
        ret