Improve aarch64 native support some more

This change introduces partial support for automating remote testing of
aarch64 binaries on Raspberry Pi and Apple Silicon.
This commit is contained in:
Justine Tunney 2023-06-04 08:19:45 -07:00
parent fc34ba2596
commit 4aa1d09b9e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
20 changed files with 185 additions and 82 deletions

View file

@ -19,6 +19,7 @@
#include "ape/sections.internal.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/aarch64.h"
#include "libc/calls/struct/rusage.internal.h"
#include "libc/calls/struct/siginfo.h"
#include "libc/calls/struct/sigset.h"
@ -44,6 +45,7 @@ STATIC_YOINK("strerror_wr"); // for kprintf %m
STATIC_YOINK("strsignal_r"); // for kprintf %G
#define RESET "\e[0m"
#define BOLD "\e[1m"
#define STRONG "\e[30;101m"
#define RED "\e[31;1m"
#define GREEN "\e[32;1m"
@ -203,6 +205,7 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
const char *addr2line;
struct StackFrame *fp;
struct SymbolTable *st;
struct fpsimd_context *vc;
st = GetSymbolTable();
debugbin = FindDebugBinary();
addr2line = GetAddr2linePath();
@ -217,13 +220,30 @@ 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 %d%s", ColorRegister(r),
Append(b, "%s%016lx%s x%d%s", ColorRegister(r),
ctx->uc_mcontext.regs[r], reset, r,
r == 8 || r == 9 ? " " : "");
}
Append(b, "\n");
}
// PRINT VECTORS
vc = (struct fpsimd_context *)ctx->uc_mcontext.__reserved;
if (vc->head.magic == FPSIMD_MAGIC) {
int n = 16;
while (n && !vc->vregs[n - 1] && !vc->vregs[n - 2]) n -= 2;
for (i = 0; i * 2 < n; ++i) {
Append(b, " ");
for (j = 0; j < 2; ++j) {
int r = j + 2 * i;
if (j) Append(b, " ");
Append(b, "%016lx ..%s %016lx v%d%s", (long)(vc->vregs[r] >> 64),
!j ? "" : ".", (long)vc->vregs[r], r, r < 10 ? " " : "");
}
Append(b, "\n");
}
}
// PRINT CURRENT LOCATION
//
// We can get the address of the currently executing function by