blob: 8c91db6ed808845c4c5bce6816aa630697eae64a (
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
|
/* $OpenBSD: gadget.S,v 1.2 2024/03/13 11:18:42 kettenis Exp $ */
#include <sys/syscall.h>
#include <machine/asm.h>
#if !defined(_ASM_TYPE_FUNCTION)
#define _ASM_TYPE_FUNCTION @function
#endif
.section .rodata
.globl gadget_getpid
.type gadget_getpid,_ASM_TYPE_FUNCTION
gadget_getpid:
#if defined(__amd64__)
endbr64
mov $SYS_getpid, %eax
syscall
ret
#elif defined(__aarch64__)
bti c
mov x8, #SYS_getpid
svc 0
dsb nsh
isb
ret
#else
#error "Missing gadget."
#endif
.space 4096
|