mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
8f522cb702
This change progresses our AARCH64 support: - The AARCH64 build and tests are now passing - Add 128-bit floating-point support to printf() - Fix clone() so it initializes cosmo's x28 TLS register - Fix TLS memory layout issue with aarch64 _Alignas vars - Revamp microbenchmarking tools so they work on aarch64 - Make some subtle improvements to aarch64 crash reporting - Make kisdangerous() memory checks more accurate on aarch64 - Remove sys_open() since it's not available on Linux AARCH64 This change makes general improvements to Cosmo and Redbean: - Introduce GetHostIsa() function in Redbean - You can now feature check using pledge(0, 0) - You can now feature check using unveil("",0) - Refactor some more x86-specific asm comments - Refactor and write docs for some libm functions - Make the mmap() API behave more similar to Linux - Fix WIFSIGNALED() which wrongly returned true for zero - Rename some obscure cosmo keywords from noFOO to dontFOO
38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
#ifndef COSMOPOLITAN_LIBC_CALLS_PRCTL_INTERNAL_H_
|
|
#define COSMOPOLITAN_LIBC_CALLS_PRCTL_INTERNAL_H_
|
|
#include "libc/dce.h"
|
|
#include "libc/sysv/consts/nrlinux.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
COSMOPOLITAN_C_START_
|
|
|
|
forceinline int sys_prctl(int op, long a, long b, long c, long d) {
|
|
int rc;
|
|
#ifdef __x86_64__
|
|
register long r10 asm("r10") = c;
|
|
register long r8 asm("r8") = d;
|
|
asm volatile("syscall"
|
|
: "=a"(rc)
|
|
: "0"(__NR_linux_prctl), "D"(op), "S"(a), "d"(b), "r"(r10),
|
|
"r"(r8)
|
|
: "rcx", "r11", "memory");
|
|
#elif defined(__aarch64__)
|
|
register long r0 asm("x0") = op;
|
|
register long r1 asm("x1") = a;
|
|
register long r2 asm("x2") = b;
|
|
register long r3 asm("x3") = c;
|
|
register long r4 asm("x4") = d;
|
|
register long res_x0 asm("x0");
|
|
asm volatile("mov\tx8,%1\n\t"
|
|
"svc\t0"
|
|
: "=r"(res_x0)
|
|
: "i"(__NR_linux_prctl), "r"(r0), "r"(r1), "r"(r2), "r"(r3),
|
|
"r"(r4)
|
|
: "x8", "memory");
|
|
rc = res_x0;
|
|
#endif
|
|
return rc;
|
|
}
|
|
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_PRCTL_INTERNAL_H_ */
|