add asm headers and linker scripts for aarch64
[lunaix-os.git] / lunaix-os / arch / aarch64 / includes / asm / abi.h
1 #ifndef __LUNAIX_AA64_ABI_H
2 #define __LUNAIX_AA64_ABI_H
3
4 #include <lunaix/types.h>
5
6 #ifndef __ASM__
7 #define align_stack(ptr) ((ptr) & stack_alignment)
8
9 static inline void must_inline noret
10 switch_context() {
11     // TODO
12     unreachable;
13 }
14
15
16 static inline ptr_t
17 abi_get_retaddr()
18 {
19     reg_t lr;
20     asm ("mov %0, lr" : "=r"(lr));
21
22     return lr;
23 }
24
25 static inline ptr_t
26 abi_get_retaddrat(ptr_t fp)
27 {
28     return ((ptr_t*)fp)[1];
29 }
30
31 #endif
32
33 #endif /* __LUNAIX_AA64_ABI_H */