std.os.linux: Define ucontext_t and mcontext_t for RISC-V

Closes #24239.
This commit is contained in:
Alex Rønne Petersen 2025-06-30 06:54:45 +02:00
parent 07114e6bc6
commit fd2d4507c8
No known key found for this signature in database
2 changed files with 72 additions and 4 deletions

View File

@ -7,6 +7,8 @@ const SYS = linux.SYS;
const uid_t = std.os.linux.uid_t;
const gid_t = std.os.linux.gid_t;
const pid_t = std.os.linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const sockaddr = linux.sockaddr;
const socklen_t = linux.socklen_t;
const timespec = std.os.linux.timespec;
@ -261,8 +263,40 @@ pub const VDSO = struct {
pub const CGT_VER = "LINUX_4.15";
};
/// TODO
pub const ucontext_t = void;
pub const f_ext_state = extern struct {
f: [32]f32,
fcsr: u32,
};
pub const d_ext_state = extern struct {
f: [32]f64,
fcsr: u32,
};
pub const q_ext_state = extern struct {
f: [32]f128,
fcsr: u32,
_reserved: [3]u32,
};
pub const fpstate = extern union {
f: f_ext_state,
d: d_ext_state,
q: q_ext_state,
};
pub const mcontext_t = extern struct {
gregs: [32]u32,
fpregs: fpstate,
};
pub const ucontext_t = extern struct {
flags: c_ulong,
link: ?*ucontext_t,
stack: stack_t,
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
mcontext: mcontext_t,
};
/// TODO
pub const getcontext = {};

View File

@ -7,6 +7,8 @@ const SYS = linux.SYS;
const uid_t = std.os.linux.uid_t;
const gid_t = std.os.linux.gid_t;
const pid_t = std.os.linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const sockaddr = linux.sockaddr;
const socklen_t = linux.socklen_t;
const timespec = std.os.linux.timespec;
@ -261,8 +263,40 @@ pub const VDSO = struct {
pub const CGT_VER = "LINUX_4.15";
};
/// TODO
pub const ucontext_t = void;
pub const f_ext_state = extern struct {
f: [32]f32,
fcsr: u32,
};
pub const d_ext_state = extern struct {
f: [32]f64,
fcsr: u32,
};
pub const q_ext_state = extern struct {
f: [32]f128,
fcsr: u32,
_reserved: [3]u32,
};
pub const fpstate = extern union {
f: f_ext_state,
d: d_ext_state,
q: q_ext_state,
};
pub const mcontext_t = extern struct {
gregs: [32]u64,
fpregs: fpstate,
};
pub const ucontext_t = extern struct {
flags: c_ulong,
link: ?*ucontext_t,
stack: stack_t,
sigmask: [1024 / @bitSizeOf(c_ulong)]c_ulong, // Currently a libc-compatible (1024-bit) sigmask
mcontext: mcontext_t,
};
/// TODO
pub const getcontext = {};