From 01ef3dd9c5fa7a56aa370f244dd08e05c73010f5 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 10 Mar 2015 21:18:41 +0000 Subject: add aarch64 port This adds complete aarch64 target support including bigendian subarch. Some of the long double math functions are known to be broken otherwise interfaces should be fully functional, but at this point consider this port experimental. Initial work on this port was done by Sireesh Tripurari and Kevin Bortis. --- src/thread/aarch64/__set_thread_area.s | 6 ++++++ src/thread/aarch64/__unmapself.s | 7 +++++++ src/thread/aarch64/clone.s | 29 +++++++++++++++++++++++++++++ src/thread/aarch64/syscall_cp.s | 27 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 src/thread/aarch64/__set_thread_area.s create mode 100644 src/thread/aarch64/__unmapself.s create mode 100644 src/thread/aarch64/clone.s create mode 100644 src/thread/aarch64/syscall_cp.s (limited to 'src/thread') diff --git a/src/thread/aarch64/__set_thread_area.s b/src/thread/aarch64/__set_thread_area.s new file mode 100644 index 00000000..97a80acc --- /dev/null +++ b/src/thread/aarch64/__set_thread_area.s @@ -0,0 +1,6 @@ +.global __set_thread_area +.type __set_thread_area,@function +__set_thread_area: + msr tpidr_el0,x0 + mov w0,#0 + ret diff --git a/src/thread/aarch64/__unmapself.s b/src/thread/aarch64/__unmapself.s new file mode 100644 index 00000000..2c5d254f --- /dev/null +++ b/src/thread/aarch64/__unmapself.s @@ -0,0 +1,7 @@ +.global __unmapself +.type __unmapself,%function +__unmapself: + mov x8,#215 // SYS_munmap + svc 0 + mov x8,#93 // SYS_exit + svc 0 diff --git a/src/thread/aarch64/clone.s b/src/thread/aarch64/clone.s new file mode 100644 index 00000000..50af913c --- /dev/null +++ b/src/thread/aarch64/clone.s @@ -0,0 +1,29 @@ +// __clone(func, stack, flags, arg, ptid, tls, ctid) +// x0, x1, w2, x3, x4, x5, x6 + +// syscall(SYS_clone, flags, stack, ptid, tls, ctid) +// x8, x0, x1, x2, x3, x4 + +.global __clone +.type __clone,%function +__clone: + // align stack and save func,arg + and x1,x1,#-16 + stp x0,x3,[x1,#-16]! + + // syscall + uxtw x0,w2 + mov x2,x4 + mov x3,x5 + mov x4,x6 + mov x8,#220 // SYS_clone + svc #0 + + cbz x0,1f + // parent + ret + // child +1: ldp x1,x0,[sp],#16 + blr x1 + mov x8,#93 // SYS_exit + svc #0 diff --git a/src/thread/aarch64/syscall_cp.s b/src/thread/aarch64/syscall_cp.s new file mode 100644 index 00000000..6302a0bd --- /dev/null +++ b/src/thread/aarch64/syscall_cp.s @@ -0,0 +1,27 @@ +// __syscall_cp_asm(&self->cancel, nr, u, v, w, x, y, z) +// x0 x1 x2 x3 x4 x5 x6 x7 + +// syscall(nr, u, v, w, x, y, z) +// x8 x0 x1 x2 x3 x4 x5 + +.global __syscall_cp_asm +.type __syscall_cp_asm,%function +__syscall_cp_asm: +.global __cp_begin +__cp_begin: + ldr w0,[x0] + cbnz w0,1f + mov x8,x1 + mov x0,x2 + mov x1,x3 + mov x2,x4 + mov x3,x5 + mov x4,x6 + mov x5,x7 + svc 0 +.global __cp_end +__cp_end: + ret + + // cbnz might not be able to jump far enough +1: b __cancel -- cgit v1.2.1