summaryrefslogtreecommitdiff
path: root/Libraries/LibC/setjmp.S
blob: b063023f56b802090f163e46ddc1803487156a54 (plain)
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
.global setjmp
setjmp:
    mov 4(%esp), %eax
    mov %ebx, 0(%eax)
    mov %esi, 4(%eax)
    mov %edi, 8(%eax)
    mov %ebp, 12(%eax)
    lea 4(%esp), %ecx
    mov %ecx, 16(%eax)
    mov (%esp), %ecx
    mov %ecx, 20(%eax)
    xor %eax, %eax
    ret

.global longjmp
longjmp:
    mov 4(%esp), %edx
    mov 8(%esp), %eax
    mov 0(%edx), %ebx
    mov 4(%edx), %esi
    mov 8(%edx), %edi
    mov 12(%edx), %ebp
    mov 16(%edx), %ecx
    mov %ecx, %esp
    mov 20(%edx), %ecx
    test %eax, %eax
    jnz  .nonzero
    mov 1, %eax
.nonzero:
    jmp *%ecx