liblinux++

A hosted C++ runtime without any libc.
git clone git://henryandlizzy.uk/liblinux++
Log | Files | Refs

aarch64.S (619B)


      1 # Syscall numbers https://www.chromium.org/chromium-os/developer-library/reference/linux-constants/syscalls/#arm64-64-bit
      2 
      3 #include "NR_aarch64.h"
      4 
      5 .macro extern_alias, name
      6 .global \name
      7 \name:
      8 .endm
      9 
     10 .macro extern, name
     11 .section .text.\name
     12 extern_alias \name
     13 .endm
     14 
     15 // start is the entry point known to the linker
     16 extern start
     17 	ldr	x0,	[sp]		// get argc from the stack
     18 	add	x1,	sp,	#8	// take the address of argv from the stack
     19 	add	x2,	sp,	#16	// take the address of envp from the stack
     20 	bl	main
     21 	b	exit
     22 
     23 .macro syscall, num
     24 	mov	w8,	#\num
     25 	svc	#0
     26 	ret
     27 .endm
     28 
     29 #define SYS(x) syscall __NR_##x
     30 
     31 #include "syscalls.h"