mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
Make improvements
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
This commit is contained in:
parent
5655c9a4e7
commit
8f522cb702
116 changed files with 1194 additions and 1025 deletions
|
@ -217,14 +217,17 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
|||
for (j = 0; j < 4; ++j) {
|
||||
int r = 8 * j + i;
|
||||
if (j) Append(b, " ");
|
||||
Append(b, "%s%016lx%s %sr%d", ColorRegister(r),
|
||||
ctx->uc_mcontext.regs[r], reset, r == 8 || r == 9 ? " " : "",
|
||||
r);
|
||||
Append(b, "%s%016lx%s %d%s", ColorRegister(r),
|
||||
ctx->uc_mcontext.regs[r], reset, r,
|
||||
r == 8 || r == 9 ? " " : "");
|
||||
}
|
||||
Append(b, "\n");
|
||||
}
|
||||
|
||||
// PRINT CURRENT LOCATION
|
||||
//
|
||||
// We can get the address of the currently executing function by
|
||||
// simply examining the program counter.
|
||||
pc = ctx->uc_mcontext.pc;
|
||||
Append(b, " %016lx sp %lx pc", ctx->uc_mcontext.sp, pc);
|
||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||
|
@ -239,6 +242,13 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
|||
Append(b, "\n");
|
||||
|
||||
// PRINT LINKED LOCATION
|
||||
//
|
||||
// The x30 register can usually tell us the address of the parent
|
||||
// function. This can help us determine the caller in cases where
|
||||
// stack frames aren't being generated by the compiler; but if we
|
||||
// have stack frames, then we need to ensure this won't duplicate
|
||||
// the first element of the frame pointer backtrace below.
|
||||
fp = (struct StackFrame *)ctx->uc_mcontext.regs[29];
|
||||
if (IsCode((pc = ctx->uc_mcontext.regs[30]))) {
|
||||
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||
|
@ -251,10 +261,18 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
|||
}
|
||||
}
|
||||
Append(b, "\n");
|
||||
if (fp && !kisdangerous(fp) && pc == fp->addr) {
|
||||
fp = fp->next;
|
||||
}
|
||||
}
|
||||
|
||||
// PRINT FRAME POINTERS
|
||||
fp = (struct StackFrame *)ctx->uc_mcontext.regs[29];
|
||||
//
|
||||
// The prologues and epilogues of non-leaf functions should save
|
||||
// the frame pointer (x29) and return address (x30) to the stack
|
||||
// and then set x29 to sp, which is the address of the new frame
|
||||
// effectively creating a daisy chain letting us trace back into
|
||||
// the origin of execution, e.g. _start(), or sys_clone_linux().
|
||||
for (i = 0; fp; fp = fp->next) {
|
||||
if (kisdangerous(fp)) {
|
||||
Append(b, " %016lx <dangerous fp>\n", fp);
|
||||
|
@ -284,9 +302,10 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
Append(b, "got %G while crashing!\n");
|
||||
Append(b, "got %G while crashing!\n", sig);
|
||||
}
|
||||
sys_write(2, b->p, MIN(b->i, b->n));
|
||||
__print_maps();
|
||||
_Exit(128 + sig);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue