Make considerably more progress on AARCH64

- Utilities like pledge.com now build
- kprintf() will no longer balk at 48-bit addresses
- There's a new aarch64-dbg build mode that should work
- gc() and defer() are mostly pacified; avoid using them on aarch64
- THIRD_PART_STB now has Arm Neon intrinsics for fast image handling
This commit is contained in:
Justine Tunney 2023-05-12 22:42:57 -07:00
parent 1bfb3aab1b
commit fd34ef732d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
91 changed files with 1288 additions and 1192 deletions

View file

@ -22,6 +22,8 @@
//
// This function crashes if called with a misaligned stack.
CheckStackIsAligned:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
@ -35,4 +37,14 @@ CheckStackIsAligned:
leave
ret
#elif defined(__aarch64__)
// TODO: support me
mov x0,#1
ret
#else
#error "unsupported architecture"
#endif
.endfn CheckStackIsAligned,globl

View file

@ -31,6 +31,7 @@
// @threadsafe
// @noreturn
_gclongjmp:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp
.profilable
@ -59,4 +60,9 @@ _gclongjmp:
2: pop %rsi
pop %rdi
jmp 0b
#elif defined(__aarch64__)
b longjmp
#else
#error "unsupported architecture"
#endif /* __x86_64__ */
.endfn _gclongjmp,globl

View file

@ -17,10 +17,10 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.real
// Function Profiling Hook.
// cc -pg adds this to the start of global functions.
mcount: ret
.endfn mcount,weak
.endfn mcount,globl,weak
.alias mcount,_mcount // aarch64 weirdness?
.alias mcount,.mcount // freebsd weirdness?

View file

@ -42,10 +42,22 @@ $(LIBC_NEXGEN32E_A).pkg: \
$(LIBC_NEXGEN32E_A_OBJS) \
$(foreach x,$(LIBC_NEXGEN32E_A_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/libc/nexgen32e/argc2.o \
o/$(MODE)/libc/nexgen32e/argv2.o \
o/$(MODE)/libc/nexgen32e/auxv2.o \
o/$(MODE)/libc/nexgen32e/cescapec.o \
o/$(MODE)/libc/nexgen32e/crc32init.o \
o/$(MODE)/libc/nexgen32e/environ2.o \
o/$(MODE)/libc/nexgen32e/envp2.o \
o/$(MODE)/libc/nexgen32e/kbase36.o \
o/$(MODE)/libc/nexgen32e/ktens.o \
o/$(MODE)/libc/nexgen32e/ktolower.o \
o/$(MODE)/libc/nexgen32e/ktoupper.o \
o/$(MODE)/libc/nexgen32e/pid.o \
o/$(MODE)/libc/nexgen32e/program_invocation_name2.o \
o/$(MODE)/libc/nexgen32e/threaded.o: private \
OVERRIDE_CFLAGS += \
$(NO_MAGIC) \
-fno-sanitize=all
$(NO_MAGIC)
# these assembly files are safe to build on aarch64
o/$(MODE)/libc/nexgen32e/zip.o: libc/nexgen32e/zip.S
@ -70,6 +82,10 @@ o/$(MODE)/libc/nexgen32e/missingno.o: libc/nexgen32e/missingno.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/nexgen32e/khalfcache3.o: libc/nexgen32e/khalfcache3.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/nexgen32e/gclongjmp.o: libc/nexgen32e/gclongjmp.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/nexgen32e/checkstackalign.o: libc/nexgen32e/checkstackalign.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
LIBC_NEXGEN32E_LIBS = $(foreach x,$(LIBC_NEXGEN32E_ARTIFACTS),$($(x)))
LIBC_NEXGEN32E_SRCS = $(foreach x,$(LIBC_NEXGEN32E_ARTIFACTS),$($(x)_SRCS))

View file

@ -18,4 +18,8 @@
*/
#include "libc/runtime/runtime.h"
#ifndef __x86_64__
char *program_invocation_name;
#endif /* __x86_64__ */