mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 10:48:29 +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
|
@ -60,7 +60,11 @@ int sys_fork(void) {
|
|||
} else if (__syslib) {
|
||||
return _sysret(__syslib->__fork());
|
||||
} else {
|
||||
return enosys();
|
||||
int ax;
|
||||
axdx_t ad;
|
||||
ad = __sys_fork();
|
||||
ax = ad.ax;
|
||||
return ax;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -87,9 +87,9 @@ vfork:
|
|||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
adrp x0,__hostos
|
||||
ldr w0,[x0,#:lo12:__hostos]
|
||||
tbz x0,3,1f // bit 3 is xnu
|
||||
adrp x8,__hostos
|
||||
ldr w8,[x8,#:lo12:__hostos]
|
||||
tbz x8,3,1f // bit 3 is xnu
|
||||
b fork // which doesn't support vfork()
|
||||
1:
|
||||
|
||||
|
@ -102,10 +102,19 @@ vfork:
|
|||
ldp x29,x30,[sp],16
|
||||
#endif
|
||||
|
||||
mov x8,#220 // __NR_clone
|
||||
tbnz w8,5,1f // bit 5 is freebsd
|
||||
|
||||
mov x8,#220 // clone (linux)
|
||||
mov x0,#0x4111 // SIGCHLD | CLONE_VM | CLONE_VFORK
|
||||
mov x1,#0
|
||||
svc 0
|
||||
b 2f
|
||||
|
||||
1: mov x8,#66 // vfork (freebsd)
|
||||
svc 0 // call kernel
|
||||
bcc 2f // jump if not carry
|
||||
neg x0,x0 // linux style errno
|
||||
2:
|
||||
|
||||
// if (!rc) {
|
||||
// __get_tls()->tib_flags |= TIB_FLAG_VFORKED;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue