mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
Make progress towards aarch64 build
This commit is contained in:
parent
08ff26c817
commit
ca2860947f
15428 changed files with 25694 additions and 23138 deletions
|
@ -67,10 +67,10 @@ noinstrument noasan int PrintBacktraceUsingSymbols(int fd,
|
|||
break;
|
||||
}
|
||||
addr = frame->addr;
|
||||
if (addr == _weakaddr("__gc")) {
|
||||
if (addr == (intptr_t)_weaken(__gc)) {
|
||||
do {
|
||||
--gi;
|
||||
} while ((addr = garbage->p[gi].ret) == _weakaddr("__gc"));
|
||||
} while ((addr = garbage->p[gi].ret) == (intptr_t)_weaken(__gc));
|
||||
}
|
||||
/*
|
||||
* we subtract one to handle the case of noreturn functions with a
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
.yoink countbranch_report
|
||||
|
||||
.section .sort.data.countbranch.1,"a",@progbits
|
||||
.align 8
|
||||
.balign 8
|
||||
.underrun
|
||||
.globl countbranch_data
|
||||
countbranch_data:
|
||||
.previous
|
||||
|
||||
.section .sort.data.countbranch.3,"a",@progbits
|
||||
.align 8
|
||||
.balign 8
|
||||
.rept 5
|
||||
.quad -1
|
||||
.endr
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
.yoink countexpr_report
|
||||
|
||||
.section .sort.data.countexpr.1,"a",@progbits
|
||||
.align 8
|
||||
.balign 8
|
||||
.globl countexpr_data
|
||||
.underrun
|
||||
countexpr_data:
|
||||
.previous
|
||||
|
||||
.section .sort.data.countexpr.3,"a",@progbits
|
||||
.align 8
|
||||
.balign 8
|
||||
.quad 0
|
||||
.overrun
|
||||
.previous
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_LOG_GDB_H_
|
||||
#define COSMOPOLITAN_LIBC_LOG_GDB_H_
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/rusage.h"
|
||||
#include "libc/calls/wait4.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/sysv/consts/nr.h"
|
||||
|
@ -41,6 +42,7 @@ int AttachDebugger(intptr_t);
|
|||
Pid; \
|
||||
})
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define __inline_wait4(PID, OPT_OUT_WSTATUS, OPTIONS, OPT_OUT_RUSAGE) \
|
||||
({ \
|
||||
int64_t WaAx; \
|
||||
|
@ -56,6 +58,9 @@ int AttachDebugger(intptr_t);
|
|||
} \
|
||||
WaAx; \
|
||||
})
|
||||
#else
|
||||
#define __inline_wait4 wait4
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -17,6 +17,15 @@ forceinline long __sysv_exit(long rc) {
|
|||
: "=a"(ax)
|
||||
: "0"(__NR_exit_group), "D"(rc)
|
||||
: "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = rc;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(94), "r"(r0)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_exit_group, rc);
|
||||
#endif
|
||||
|
@ -30,6 +39,15 @@ forceinline int __sysv_close(long fd) {
|
|||
: "=a"(ax)
|
||||
: "0"(__NR_close), "D"(fd)
|
||||
: "rdx", "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = fd;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(57), "r"(r0)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_close, fd);
|
||||
#endif
|
||||
|
@ -43,6 +61,18 @@ forceinline int __sysv_open(const char *path, long flags, long mode) {
|
|||
: "=a"(ax), "=d"(dx)
|
||||
: "0"(__NR_open), "D"(path), "S"(flags), "1"(mode)
|
||||
: "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = -100;
|
||||
register long r1 asm("x1") = (long)path;
|
||||
register long r2 asm("x2") = (long)flags;
|
||||
register long r3 asm("x3") = (long)mode;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(56), "r"(r0), "r"(r1), "r"(r2), "r"(r3)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_open, path, flags, mode);
|
||||
#endif
|
||||
|
@ -56,6 +86,17 @@ forceinline long __sysv_read(long fd, void *data, unsigned long size) {
|
|||
: "=a"(ax), "=d"(dx)
|
||||
: "0"(__NR_read), "D"(fd), "S"(data), "1"(size)
|
||||
: "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = (long)fd;
|
||||
register long r1 asm("x1") = (long)data;
|
||||
register long r2 asm("x2") = (long)size;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(63), "r"(r0), "r"(r1), "r"(r2)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_read, fd, data, size);
|
||||
#endif
|
||||
|
@ -69,6 +110,17 @@ forceinline long __sysv_write(long fd, const void *data, unsigned long size) {
|
|||
: "=a"(ax), "=d"(dx)
|
||||
: "0"(__NR_write), "D"(fd), "S"(data), "1"(size)
|
||||
: "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = (long)fd;
|
||||
register long r1 asm("x1") = (long)data;
|
||||
register long r2 asm("x2") = (long)size;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(64), "r"(r0), "r"(r1), "r"(r2)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_write, fd, data, size);
|
||||
#endif
|
||||
|
@ -82,6 +134,17 @@ forceinline long __sysv_mprotect(void *addr, size_t size, long prot) {
|
|||
: "=a"(ax), "=d"(dx)
|
||||
: "0"(__NR_mprotect), "D"(addr), "S"(size), "1"(prot)
|
||||
: "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long r0 asm("x0") = (long)addr;
|
||||
register long r1 asm("x1") = (long)size;
|
||||
register long r2 asm("x2") = (long)prot;
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(226), "r"(r0), "r"(r1), "r"(r2)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_mprotect, addr, size, prot);
|
||||
#endif
|
||||
|
@ -95,6 +158,14 @@ forceinline int __sysv_getpid(void) {
|
|||
: "=a"(ax)
|
||||
: "0"(__NR_getpid)
|
||||
: "rdx", "memory", "cc");
|
||||
#elif defined(__aarch64__)
|
||||
register long res_x0 asm("x0");
|
||||
asm volatile("mov\tx8,%1\n"
|
||||
"svc\t0"
|
||||
: "=r"(res_x0)
|
||||
: "i"(172)
|
||||
: "x8", "memory");
|
||||
ax = res_x0;
|
||||
#else
|
||||
ax = syscall(__NR_getpid);
|
||||
#endif
|
||||
|
|
|
@ -210,7 +210,7 @@ void _log_exit(int) wontreturn;
|
|||
|
||||
#define ARGS unsigned, const char *, int, FILE *, const char *
|
||||
#define ATTR paramsnonnull((5)) printfesque(5)
|
||||
#define ATTRV paramsnonnull((5, 6))
|
||||
#define ATTRV paramsnonnull((5))
|
||||
void flogf(ARGS, ...) ATTR libcesque;
|
||||
void vflogf(ARGS, va_list) ATTRV libcesque;
|
||||
void fverbosef(ARGS, ...) asm("flogf") ATTR relegated libcesque;
|
||||
|
|
|
@ -16,9 +16,11 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/initializer.internal.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
||||
FILE *__log_file;
|
||||
|
||||
INITIALIZER(401, _init_log_file, (__log_file = stderr));
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
__log_file = stderr;
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
#include "libc/macros.internal.h"
|
||||
|
||||
.bss
|
||||
.align 4
|
||||
.balign 4
|
||||
__log_level:
|
||||
.long 0
|
||||
.endobj __log_level,globl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue