Mint APE Loader v1.5

This change ports APE Loader to Linux AARCH64, so that Raspberry Pi
users can run programs like redbean, without the executable needing
to modify itself. Progress has also slipped into this change on the
issue of making progress better conforming to user expectations and
industry standards regarding which symbols we're allowed to declare
This commit is contained in:
Justine Tunney 2023-07-26 13:54:49 -07:00
parent 6843150e0c
commit 7e0a09feec
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
510 changed files with 1783 additions and 1483 deletions

View file

@ -55,11 +55,13 @@
#include "libc/nt/struct/openfilename.h"
#include "libc/nt/windows.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/sysconf.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/stdio/rand.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/str/strwidth.h"
#include "libc/sysv/consts/auxv.h"
#include "libc/sysv/consts/ex.h"
#include "libc/sysv/consts/exit.h"
#include "libc/sysv/consts/poll.h"
@ -481,17 +483,17 @@ static void *NewBoard(size_t *out_size) {
char *p;
size_t s, n, k;
s = (byn * bxn) >> 3;
k = APE_GUARDSIZE + ROUNDUP(s, APE_GUARDSIZE);
n = ROUNDUP(k + APE_GUARDSIZE, FRAMESIZE);
k = getauxval(AT_PAGESZ) + ROUNDUP(s, getauxval(AT_PAGESZ));
n = ROUNDUP(k + getauxval(AT_PAGESZ), sysconf(_SC_PAGESIZE));
p = _mapanon(n);
mprotect(p, APE_GUARDSIZE, 0);
mprotect(p, getauxval(AT_PAGESZ), 0);
mprotect(p + k, n - k, 0);
if (out_size) *out_size = n;
return p + APE_GUARDSIZE;
return p + getauxval(AT_PAGESZ);
}
static void FreeBoard(void *p, size_t n) {
munmap((char *)p - APE_GUARDSIZE, n);
munmap((char *)p - getauxval(AT_PAGESZ), n);
}
static void AllocateBoardsWithHardwareAcceleratedMemorySafety(void) {

View file

@ -45,7 +45,7 @@
#include "third_party/stb/stb_image.h"
#include "tool/viz/lib/graphic.h"
STATIC_YOINK("__zipos_get");
__static_yoink("__zipos_get");
static struct Flags {
const char *out;

View file

@ -82,7 +82,7 @@ const struct IdName kNtStartfFlagNames[] = {
{0, 0},
};
noasan void PrintStartupInfo(void) {
dontasan void PrintStartupInfo(void) {
#if 0
printf("\n\
\n\
@ -161,7 +161,7 @@ void PrintStdioInfo(void) {
ft2str(GetFileType(g_fds.p[2].handle)));
}
noasan void PrintTeb(void) {
dontasan void PrintTeb(void) {
GetCurrentProcessId();
SetLastError(0x1234);
printf("\n\