Get LIBC_RUNTIME and LIBC_CALLS building on aarch64

This commit is contained in:
Justine Tunney 2023-05-09 01:56:56 -07:00
parent 7e46645193
commit e5e3cdf447
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1200 changed files with 5341 additions and 3677 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/syscall-nt.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/asmflag.h"
@ -74,21 +75,10 @@ privileged int getpriority(int which, unsigned who) {
} else {
rc = sys_getpriority_nt(which, who);
}
#elif defined(__aarch64__)
register long r0 asm("x0") = (long)which;
register long r1 asm("x1") = (long)who;
register long res_x0 asm("x0");
asm volatile("mov\tx8,%1\n\t"
"svc\t0"
: "=r"(res_x0)
: "i"(141), "r"(r0), "r"(r1)
: "x8", "memory");
rc = res_x0;
if (rc >= 0) {
#else
rc = sys_getpriority(which, who);
if (rc != -1) {
rc = NZERO - rc;
} else {
errno = -rc;
rc = -1;
}
#endif
STRACE("getpriority(%s, %u) → %d% m", DescribeWhichPrio(which), who, rc);