From f3f52fc17c99358aac599ea7ada9f34503ec12c0 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 6 Dec 2020 13:42:38 +0000 Subject: [PATCH] arm: add freestanding port --- README.md | 2 +- arch/arm/freestanding/bits.h | 28 ++++++++++++++++++++++++++++ arch/arm/makecontext.c | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 arch/arm/freestanding/bits.h diff --git a/README.md b/README.md index 20b8577..832f5e4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Adding support for new architectures is easy, but you need to know assembly lang | Architecture | Works on musl | Syscall | Supports FREESTANDING | |--------------|---------------|---------|-----------------------| | aarch64 | ✓ | | | -| arm | ✓ | | | +| arm | ✓ | | ✓ | | m68k | ✓ | | ✓ | | mips | ✓ | | ✓ | | mips64 | ✓ | | ✓ | diff --git a/arch/arm/freestanding/bits.h b/arch/arm/freestanding/bits.h new file mode 100644 index 0000000..dc5c379 --- /dev/null +++ b/arch/arm/freestanding/bits.h @@ -0,0 +1,28 @@ +#ifndef LIBUCONTEXT_BITS_H +#define LIBUCONTEXT_BITS_H + +typedef int libucontext_greg_t, libucontext_gregset_t[18]; + +typedef struct { + unsigned long trap_no, error_code, oldmask; + unsigned long arm_r0, arm_r1, arm_r2, arm_r3; + unsigned long arm_r4, arm_r5, arm_r6, arm_r7; + unsigned long arm_r8, arm_r9, arm_r10, arm_fp; + unsigned long arm_ip, arm_sp, arm_lr, arm_pc; + unsigned long arm_cpsr, fault_address; +} libucontext_mcontext_t; + +typedef struct { + void *ss_sp; + int ss_flags; + size_t ss_size; +} libucontext_stack_t; + +typedef struct libucontext_ucontext { + unsigned long uc_flags; + struct libucontext_ucontext *uc_link; + libucontext_stack_t uc_stack; + libucontext_mcontext_t uc_mcontext; +} libucontext_ucontext_t; + +#endif diff --git a/arch/arm/makecontext.c b/arch/arm/makecontext.c index ae09a9a..9d1ba8d 100644 --- a/arch/arm/makecontext.c +++ b/arch/arm/makecontext.c @@ -25,7 +25,7 @@ extern void libucontext_trampoline(void); void -libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) +libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int argc, ...) { unsigned long *sp; unsigned long *regp;