diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-16 17:02:05 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-16 17:02:05 +0100 |
| commit | 90dad97fc07f049383903a166631e2c257f9b8c1 (patch) | |
| tree | 096cd247ecfda9e46598215a4f32aecedeedda90 /lib/libc/internal/arch/x86_64/longjmp.c | |
| parent | 0e832a9329cc4d4647e1ce529846073f21e66991 (diff) | |
Add support for TLS in the libc
Diffstat (limited to 'lib/libc/internal/arch/x86_64/longjmp.c')
| -rw-r--r-- | lib/libc/internal/arch/x86_64/longjmp.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/libc/internal/arch/x86_64/longjmp.c b/lib/libc/internal/arch/x86_64/longjmp.c new file mode 100644 index 00000000..dbd18632 --- /dev/null +++ b/lib/libc/internal/arch/x86_64/longjmp.c @@ -0,0 +1,20 @@ +#include "bits/setjmp.h" // for jmp_buf + +#include <setjmp.h> // for longjmp + +__attribute__((noreturn, naked, returns_twice)) void longjmp(jmp_buf env, + int val) +{ + __asm__ __volatile__("mov 0(%rdi), %rbx\n" + "mov 8(%rdi), %rbp\n" + "mov 16(%rdi), %r12\n" + "mov 24(%rdi), %r13\n" + "mov 32(%rdi), %r14\n" + "mov 40(%rdi), %r15\n" + "mov 48(%rdi), %rsp\n" + "xor %rax, %rax\n" + "cmp $0, %esi\n" + "setne %al\n" + "mov %eax, %eax\n" + "jmp *56(%rdi)\n"); +} |
