7f8d83d545563075799cacee0f7a52b65b92324c
[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) & ~15)
8
9 static inline void must_inline noret
10 switch_context() {
11     // TODO
12     asm ("b _aa64_switch_task");
13     unreachable;
14 }
15
16
17 static inline ptr_t
18 abi_get_retaddr()
19 {
20     reg_t lr;
21     asm ("mov %0, lr" : "=r"(lr));
22
23     return lr;
24 }
25
26 static inline ptr_t
27 abi_get_retaddrat(ptr_t fp)
28 {
29     return ((ptr_t*)fp)[1];
30 }
31
32 #endif
33
34 #endif /* __LUNAIX_AA64_ABI_H */