mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Introduce FreeBSD ARM64 support
It's 100% passing test fleet. Solid as a rock.
This commit is contained in:
parent
43fe5956ad
commit
83107f78ed
455 changed files with 778 additions and 551 deletions
|
@ -74,13 +74,27 @@ wontreturn void _Exit1(int rc) {
|
|||
}
|
||||
notpossible;
|
||||
#elif defined(__aarch64__)
|
||||
if (IsLinux()) {
|
||||
register long r0 asm("x0") = rc;
|
||||
asm volatile("mov\tx8,%0\n\t"
|
||||
"svc\t0"
|
||||
: /* no outputs */
|
||||
: "i"(93), "r"(r0)
|
||||
: "x8", "memory");
|
||||
if (IsLinux() || IsFreebsd()) {
|
||||
register int x0 asm("x0") = rc;
|
||||
register int x8 asm("x8");
|
||||
if (IsLinux()) {
|
||||
x8 = 93; // exit
|
||||
} else if (IsFreebsd()) {
|
||||
x8 = 431; // thr_exit
|
||||
} else {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
asm volatile("svc\t0" : "+r"(x0) : "r"(x8) : "memory");
|
||||
if (SupportsFreebsd()) {
|
||||
// On FreeBSD, thr_exit() fails if the current thread is orphaned.
|
||||
// In that case we're really better off just calling plain _exit()
|
||||
x0 = rc;
|
||||
asm volatile("mov\tx8,#1\n\t"
|
||||
"svc\t0"
|
||||
: /* no outputs */
|
||||
: "r"(x0)
|
||||
: "memory");
|
||||
}
|
||||
} else if (IsXnu()) {
|
||||
__syslib->__pthread_exit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue