From bd5969fc876a10b18613302db7087ef3c40f18e1 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:00 -0500 Subject: lib: Add mlibc Signed-off-by: Ian Moffett --- lib/mlibc/options/internal/include/bits/machine.h | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 lib/mlibc/options/internal/include/bits/machine.h (limited to 'lib/mlibc/options/internal/include/bits/machine.h') diff --git a/lib/mlibc/options/internal/include/bits/machine.h b/lib/mlibc/options/internal/include/bits/machine.h new file mode 100644 index 0000000..371a94b --- /dev/null +++ b/lib/mlibc/options/internal/include/bits/machine.h @@ -0,0 +1,86 @@ + +#ifndef MLIBC_MACHINE_H +#define MLIBC_MACHINE_H + +#include + +#if defined (__i386__) +struct __mlibc_jmpbuf_register_state { + uint32_t ebx; + uint32_t ebp; + uint32_t esi; + uint32_t edi; + uint32_t esp; + uint32_t eip; +}; +#elif defined (__x86_64__) +struct __mlibc_jmpbuf_register_state { + uint64_t rbx; + uint64_t rbp; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rsp; + uint64_t rip; +}; +#elif defined (__aarch64__) +struct __mlibc_jmpbuf_register_state { + uint64_t x19; + uint64_t x20; + uint64_t x21; + uint64_t x22; + uint64_t x23; + uint64_t x24; + uint64_t x25; + uint64_t x26; + uint64_t x27; + uint64_t x28; + uint64_t x29; + uint64_t x30; + uint64_t sp; + uint64_t pad; + uint64_t d8; + uint64_t d9; + uint64_t d10; + uint64_t d11; + uint64_t d12; + uint64_t d13; + uint64_t d14; + uint64_t d15; +}; +#elif defined (__riscv) && __riscv_xlen == 64 +struct __mlibc_jmpbuf_register_state { + uint64_t ra; + uint64_t s0; + uint64_t s1; + uint64_t s2; + uint64_t s3; + uint64_t s4; + uint64_t s5; + uint64_t s6; + uint64_t s7; + uint64_t s8; + uint64_t s9; + uint64_t s10; + uint64_t s11; + uint64_t sp; + double fs0; + double fs1; + double fs2; + double fs3; + double fs4; + double fs5; + double fs6; + double fs7; + double fs8; + double fs9; + double fs10; + double fs11; +}; +#else +# error "Missing architecture specific code" +#endif + +#endif // MLIBC_MACHINE_H + -- cgit v1.2.3