From 50bb9432c83966604cc158bd6971c0311133dc6d Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sun, 6 Dec 2020 12:36:27 +0000 Subject: [PATCH] s390x: add freestanding port --- README.md | 2 +- arch/s390x/freestanding/bits.h | 41 ++++++++++++++++++++++++++++++++++ arch/s390x/makecontext.c | 2 +- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 arch/s390x/freestanding/bits.h diff --git a/README.md b/README.md index 1377fe9..c91e0a3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Adding support for new architectures is easy, but you need to know assembly lang | ppc | ✓ | ✓ | | | ppc64 | ✓ | ✓ | | | riscv64 | ✓ | | | -| s390x | ✓ | | | +| s390x | ✓ | | ✓ | | x86 | ✓ | | ✓ | | x86_64 | ✓ | | ✓ | diff --git a/arch/s390x/freestanding/bits.h b/arch/s390x/freestanding/bits.h new file mode 100644 index 0000000..bce841c --- /dev/null +++ b/arch/s390x/freestanding/bits.h @@ -0,0 +1,41 @@ +#ifndef LIBUCONTEXT_BITS_H +#define LIBUCONTEXT_BITS_H + +typedef unsigned long libucontext_greg_t, libucontext_gregset_t[27]; + +typedef struct { + unsigned long mask; + unsigned long addr; +} libucontext_psw_t; + +typedef union { + double d; + float f; +} libucontext_fpreg_t; + +typedef struct { + unsigned fpc; + libucontext_fpreg_t fprs[16]; +} libucontext_fpregset_t; + +typedef struct { + libucontext_psw_t psw; + unsigned long gregs[16]; + unsigned aregs[16]; + libucontext_fpregset_t fpregs; +} 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/s390x/makecontext.c b/arch/s390x/makecontext.c index 726bd9c..e74c6f3 100644 --- a/arch/s390x/makecontext.c +++ b/arch/s390x/makecontext.c @@ -21,7 +21,7 @@ extern void libucontext_trampoline(void); -extern int libucontext_setcontext(const ucontext_t *ucp); +extern int libucontext_setcontext(const libucontext_ucontext_t *ucp); void