mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
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:
parent
6843150e0c
commit
7e0a09feec
510 changed files with 1783 additions and 1483 deletions
|
@ -34,7 +34,7 @@ ssize_t __zipos_find(struct Zipos *zipos, const struct ZiposUri *name) {
|
|||
c = GetZipCdirOffset(zipos->cdir);
|
||||
n = GetZipCdirRecords(zipos->cdir);
|
||||
for (i = 0; i < n; ++i, c += ZIP_CFILE_HDRSIZE(zipos->map + c)) {
|
||||
_npassert(ZIP_CFILE_MAGIC(zipos->map + c) == kZipCfileHdrMagic);
|
||||
npassert(ZIP_CFILE_MAGIC(zipos->map + c) == kZipCfileHdrMagic);
|
||||
zname = ZIP_CFILE_NAME(zipos->map + c);
|
||||
znamesize = ZIP_CFILE_NAMESIZE(zipos->map + c);
|
||||
if ((name->len == znamesize && !memcmp(name->path, zname, name->len)) ||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "libc/zipos/zipos.internal.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
STATIC_YOINK(APE_COM_NAME);
|
||||
__static_yoink(APE_COM_NAME);
|
||||
#endif
|
||||
|
||||
static uint64_t __zipos_get_min_offset(const uint8_t *base,
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
* it does not need to be 64kb aligned.
|
||||
* @return virtual base address of new mapping, or MAP_FAILED w/ errno
|
||||
*/
|
||||
noasan void *__zipos_Mmap(void *addr, size_t size, int prot, int flags,
|
||||
struct ZiposHandle *h, int64_t off) {
|
||||
dontasan void *__zipos_Mmap(void *addr, size_t size, int prot, int flags,
|
||||
struct ZiposHandle *h, int64_t off) {
|
||||
if (!(flags & MAP_PRIVATE) ||
|
||||
(flags & ~(MAP_PRIVATE | MAP_FILE | MAP_FIXED | MAP_FIXED_NOREPLACE)) ||
|
||||
(!!(flags & MAP_FIXED) ^ !!(flags & MAP_FIXED_NOREPLACE))) {
|
||||
|
|
|
@ -50,7 +50,7 @@ static size_t maptotal;
|
|||
static void *__zipos_mmap_space(size_t mapsize) {
|
||||
char *start;
|
||||
size_t offset;
|
||||
_unassert(mapsize);
|
||||
unassert(mapsize);
|
||||
offset = maptotal;
|
||||
maptotal += mapsize;
|
||||
start = (char *)kMemtrackZiposStart;
|
||||
|
@ -135,7 +135,7 @@ static int __zipos_load(struct Zipos *zipos, size_t cf, unsigned flags,
|
|||
int rc, fd, minfd;
|
||||
struct ZiposHandle *h;
|
||||
lf = GetZipCfileOffset(zipos->map + cf);
|
||||
_npassert((ZIP_LFILE_MAGIC(zipos->map + lf) == kZipLfileHdrMagic));
|
||||
npassert((ZIP_LFILE_MAGIC(zipos->map + lf) == kZipLfileHdrMagic));
|
||||
size = GetZipLfileUncompressedSize(zipos->map + lf);
|
||||
switch (ZIP_LFILE_COMPRESSIONMETHOD(zipos->map + lf)) {
|
||||
case kZipCompressionNone:
|
||||
|
|
|
@ -37,6 +37,6 @@
|
|||
// TODO(jart): why does corruption happen when zip has no assets?
|
||||
.yoink .cosmo
|
||||
|
||||
// deprecated: use STATIC_YOINK("zipos")
|
||||
// deprecated: use __static_yoink("zipos")
|
||||
zip_uri_support = 0
|
||||
.globl zip_uri_support
|
||||
|
|
|
@ -50,8 +50,8 @@ ssize_t __zipos_write(struct ZiposHandle *, const struct iovec *, size_t,
|
|||
int64_t __zipos_lseek(struct ZiposHandle *, int64_t, unsigned);
|
||||
int __zipos_fcntl(int, int, uintptr_t);
|
||||
int __zipos_notat(int, const char *);
|
||||
noasan void *__zipos_Mmap(void *, uint64_t, int32_t, int32_t,
|
||||
struct ZiposHandle *, int64_t);
|
||||
void *__zipos_Mmap(void *, uint64_t, int32_t, int32_t, struct ZiposHandle *,
|
||||
int64_t) dontasan;
|
||||
|
||||
#ifdef _NOPL0
|
||||
#define __zipos_lock() _NOPL0("__threadcalls", __zipos_lock)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue