hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 427a6415e8d9efca788943b9ab0c5fd43a07e552
parent 3370d5374b4bf7f9f0e76d3d406f0e61f0d5df5f
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  2 Jan 2024 13:25:17 +0100

rt: add ucontext structures for +freebsd

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mrt/+freebsd/+aarch64.ha | 33+++++++++++++++++++++++++++++++++
Mrt/+freebsd/+riscv64.ha | 35+++++++++++++++++++++++++++++++++++
Mrt/+freebsd/+x86_64.ha | 40++++++++++++++++++++++++++++++++++++++++
3 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/rt/+freebsd/+aarch64.ha b/rt/+freebsd/+aarch64.ha @@ -31,3 +31,36 @@ export type siginfo = struct { }, }; +export type ucontext = struct { + uc_sigmask: sigset, + uc_mcontext: mcontext, + uc_link: *ucontext, + uc_stack: stack_t, + uc_flags: int, + __spare__: [4]int, +}; + +export type mcontext = struct { + mc_gpregs: gpregs, + mc_fpregs: fpregs, + mc_flags: int, + mc_pad: int, + mc_spare: [8]u64, +}; + +export type gpregs = struct { + gp_x: [30]u64, + gp_lr: u64, + gp_sp: u64, + gp_elr: u64, + gp_spsr: u64, + gp_pad: int, +}; + +export type fpregs = struct { + fp_q: [64]u64, // XXX: Contains 32 128-bit integers + fp_sr: u32, + fp_cr: u32, + fp_flags: int, + fp_pad: int, +}; diff --git a/rt/+freebsd/+riscv64.ha b/rt/+freebsd/+riscv64.ha @@ -31,3 +31,38 @@ export type siginfo = struct { }, }; +export type ucontext = struct { + uc_sigmask: sigset, + uc_mcontext: mcontext, + uc_link: *ucontext, + uc_stack: stack_t, + uc_flags: int, + __spare__: [4]int, +}; + +export type mcontext = struct { + mc_gpregs: gpregs, + mc_fpregs: fpregs, + mc_flags: int, + mc_pad: int, + mc_spare: [8]u64, +}; + +export type gpregs = struct { + gp_ra: u64, + gp_sp: u64, + gp_gp: u64, + gp_tp: u64, + gp_t: [7]u64, + gp_s: [12]u64, + gp_a: [8]u64, + gp_sepc: u64, + gp_sstatus: u64, +}; + +export type fpregs = struct { + fp_x: [32][2]u64, + fp_fcsr: u64, + fp_flags: int, + pad: int, +}; diff --git a/rt/+freebsd/+x86_64.ha b/rt/+freebsd/+x86_64.ha @@ -31,3 +31,43 @@ export type siginfo = struct { }, }; +export type ucontext = struct { + uc_sigmask: sigset, + uc_mcontext: mcontext, + uc_link: *ucontext, + uc_stack: stack_t, + uc_flags: int, + __spare__: [4]int, +}; + +export type mcontext = struct { + mc_onstack: u64, + mc_rdi: u64, + mc_rsi: u64, + mc_rdx: u64, + mc_rcx: u64, + mc_r8: u64, + mc_r9: u64, + mc_rax: u64, + mc_rbx: u64, + mc_rbp: u64, + mc_r10: u64, + mc_r11: u64, + mc_r12: u64, + mc_r13: u64, + mc_r14: u64, + mc_r15: u64, + mc_trapno: u32, + mc_fs: u16, + mc_gs: u16, + mc_addr: u64, + mc_flags: u32, + mc_es: u16, + mc_ds: u16, + mc_err: u64, + mc_rip: u64, + mc_cs: u64, + mc_rflags: u64, + mc_rsp: u64, + mc_ss: u64, +};