1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00
serenity/LibC/setjmp.asm
Andreas Kling 5158bee08c Don't use -mregparm=3 in userspace.
It's pretty comfy having arguments in registers in the kernel for now though.
2019-02-08 01:24:52 +01:00

33 lines
608 B
NASM

; asmsyntax=nasm
global setjmp
setjmp:
mov eax, [esp + 4]
mov [eax * 4], ebx
mov [eax + 1 * 4], esi
mov [eax + 2 * 4], edi
mov [eax + 3 * 4], ebp
lea ecx, [esp + 4]
mov [eax + 4 * 4], ecx
mov ecx, [esp]
mov [eax + 5 * 4], ecx
xor eax, eax
ret
global longjmp
longjmp:
mov edx, [esp + 4]
mov eax, [esp + 8]
mov ebx, [edx * 4]
mov esi, [edx + 1 * 4]
mov edi, [edx + 2 * 4]
mov ebp, [edx + 3 * 4]
mov ecx, [edx + 4 * 4]
mov esp, ecx
mov ecx, [edx + 5 * 4]
test eax, eax
jnz .nonzero
mov eax, 1
.nonzero:
jmp ecx