mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 18:00:28 +00:00
aarch64 loader os detection
Merge branches 'pass-os' and 'cosmo-os' into aarch64-os
This commit is contained in:
commit
c5a05f22a2
2 changed files with 20 additions and 10 deletions
|
@ -127,7 +127,7 @@ _start:
|
|||
|
||||
#if SupportsFreebsd()
|
||||
// save first arg
|
||||
mov x3,x0
|
||||
mov x4,x0
|
||||
#endif
|
||||
|
||||
// save original stack pointer
|
||||
|
|
|
@ -79,7 +79,7 @@ static const char *DecodeMagnum(const char *p, long *r) {
|
|||
}
|
||||
|
||||
wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename,
|
||||
long *is_freebsd) {
|
||||
int os, long *is_freebsd) {
|
||||
|
||||
// get startup timestamp as early as possible
|
||||
// its used by --strace and also kprintf() %T
|
||||
|
@ -117,17 +117,27 @@ wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename,
|
|||
__program_executable_name = exename;
|
||||
program_invocation_name = argv[0];
|
||||
__oldstack = (intptr_t)sp;
|
||||
|
||||
// detect apple m1 environment
|
||||
const char *magnums;
|
||||
if (!(hostos = os)) {
|
||||
if (SupportsFreebsd() && is_freebsd) {
|
||||
hostos = _HOSTFREEBSD;
|
||||
magnums = syscon_freebsd;
|
||||
} else if (SupportsXnu() && (__syslib = m1)) {
|
||||
} else if (SupportsXnu() && m1) {
|
||||
hostos = _HOSTXNU;
|
||||
magnums = syscon_xnu;
|
||||
} else if (SupportsLinux()) {
|
||||
hostos = _HOSTLINUX;
|
||||
} else {
|
||||
notpossible;
|
||||
}
|
||||
}
|
||||
|
||||
const char *magnums;
|
||||
if (IsFreebsd()) {
|
||||
magnums = syscon_freebsd;
|
||||
} else if (IsXnu()) {
|
||||
if (!(__syslib = m1)) {
|
||||
notpossible;
|
||||
}
|
||||
magnums = syscon_xnu;
|
||||
} else if (IsLinux()) {
|
||||
magnums = syscon_linux;
|
||||
} else {
|
||||
notpossible;
|
||||
|
@ -139,7 +149,7 @@ wontreturn textstartup void cosmo(long *sp, struct Syslib *m1, char *exename,
|
|||
}
|
||||
|
||||
// check system call abi compatibility
|
||||
if (SupportsXnu() && __syslib && __syslib->__version < SYSLIB_VERSION) {
|
||||
if (IsXnu() && __syslib->__version < SYSLIB_VERSION) {
|
||||
sys_write(2, "need newer ape loader\n", 22);
|
||||
_Exit(127);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue