1/*	$OpenBSD: gadgetsyscall.h,v 1.2 2020/10/20 14:40:00 kettenis Exp $	*/
2
3pid_t gadget_getpid() {
4	pid_t ans = 0;
5#if defined(__aarch64__)
6	asm("ldr x8, #0x14; svc 0; dsb nsh; isb; mov %w0, w0" : "=r"(ans) :: "x0", "x8");
7#elif defined(__amd64__)
8	asm("mov $0x14, %%eax; syscall; mov %%eax, %0;" :"=r"(ans)::"%eax", "%ecx", "%r11");
9#endif
10	return ans;
11}
12