forked from ariadne/libucontext
riscv64: add freestanding port
parent
50bb9432c8
commit
0c6077854a
|
@ -24,7 +24,7 @@ Adding support for new architectures is easy, but you need to know assembly lang
|
||||||
| mips64 | ✓ | | |
|
| mips64 | ✓ | | |
|
||||||
| ppc | ✓ | ✓ | |
|
| ppc | ✓ | ✓ | |
|
||||||
| ppc64 | ✓ | ✓ | |
|
| ppc64 | ✓ | ✓ | |
|
||||||
| riscv64 | ✓ | | |
|
| riscv64 | ✓ | | ✓ |
|
||||||
| s390x | ✓ | | ✓ |
|
| s390x | ✓ | | ✓ |
|
||||||
| x86 | ✓ | | ✓ |
|
| x86 | ✓ | | ✓ |
|
||||||
| x86_64 | ✓ | | ✓ |
|
| x86_64 | ✓ | | ✓ |
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
#ifndef LIBUCONTEXT_BITS_H
|
||||||
|
#define LIBUCONTEXT_BITS_H
|
||||||
|
|
||||||
|
typedef unsigned long libucontext_greg_t;
|
||||||
|
typedef unsigned long libucontext__riscv_mc_gp_state[32];
|
||||||
|
|
||||||
|
struct libucontext__riscv_mc_f_ext_state {
|
||||||
|
unsigned int __f[32];
|
||||||
|
unsigned int __fcsr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct libucontext__riscv_mc_d_ext_state {
|
||||||
|
unsigned long long __f[32];
|
||||||
|
unsigned int __fcsr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct libucontext__riscv_mc_q_ext_state {
|
||||||
|
unsigned long long __f[64] __attribute__((aligned(16)));
|
||||||
|
unsigned int __fcsr;
|
||||||
|
unsigned int __reserved[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
union libucontext__riscv_mc_fp_state {
|
||||||
|
struct libucontext__riscv_mc_f_ext_state __f;
|
||||||
|
struct libucontext__riscv_mc_d_ext_state __d;
|
||||||
|
struct libucontext__riscv_mc_q_ext_state __q;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct libucontext_mcontext {
|
||||||
|
libucontext__riscv_mc_gp_state __gregs;
|
||||||
|
union libucontext__riscv_mc_fp_state __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;
|
||||||
|
unsigned char __pad[128];
|
||||||
|
libucontext_mcontext_t uc_mcontext;
|
||||||
|
} libucontext_ucontext_t;
|
||||||
|
|
||||||
|
#endif
|
|
@ -23,7 +23,7 @@ extern void libucontext_trampoline(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
libucontext_makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||||
{
|
{
|
||||||
libucontext_greg_t *sp, *regp;
|
libucontext_greg_t *sp, *regp;
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
Loading…
Reference in New Issue