Skip to content

Commit aaaa9d4

Browse files
committed
Fix loongarch64 bindings
1 parent e06d905 commit aaaa9d4

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ s! {
1717

1818
#[repr(align(16))]
1919
pub struct mcontext_t {
20-
pub sc_pc: ::c_ulonglong,
21-
pub sc_regs: [::c_ulonglong; 32],
22-
pub sc_flags: ::c_ulong,
23-
pub sc_extcontext: [u64; 0],
20+
pub __pc: ::c_ulonglong,
21+
pub __gregs: [::c_ulonglong; 32],
22+
pub __flags: ::c_uint,
23+
pub __extcontext: [::c_ulonglong; 0],
2424
}
2525

2626
#[repr(align(8))]

src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ s! {
189189
__unused4: ::c_ulong,
190190
__unused5: ::c_ulong
191191
}
192+
193+
pub struct user_regs_struct {
194+
pub regs: [u64; 32],
195+
pub orig_a0: u64,
196+
pub csr_era: u64,
197+
pub csr_badv: u64,
198+
pub reserved: [u64; 10],
199+
200+
}
201+
202+
pub struct user_fp_struct {
203+
pub fpr: [u64; 32],
204+
pub fcc: u64,
205+
pub fcsr: u32,
206+
}
192207
}
193208

194209
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
@@ -549,7 +564,7 @@ pub const SYS_landlock_add_rule: ::c_long = 445;
549564
pub const SYS_landlock_restrict_self: ::c_long = 446;
550565
pub const SYS_process_mrelease: ::c_long = 448;
551566
pub const SYS_futex_waitv: ::c_long = 449;
552-
//pub const SYS_set_mempolicy_home_node: ::c_long = 450;
567+
pub const SYS_set_mempolicy_home_node: ::c_long = 450;
553568

554569
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
555570
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
@@ -684,6 +699,8 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
684699
pub const ERFKILL: ::c_int = 132;
685700
pub const EHWPOISON: ::c_int = 133;
686701

702+
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
703+
687704
pub const MAP_NORESERVE: ::c_int = 0x4000;
688705
pub const MAP_ANONYMOUS: ::c_int = 0x0020;
689706
pub const MAP_ANON: ::c_int = 0x0020;
@@ -695,6 +712,7 @@ pub const MAP_POPULATE: ::c_int = 0x8000;
695712
pub const MAP_NONBLOCK: ::c_int = 0x10000;
696713
pub const MAP_STACK: ::c_int = 0x20000;
697714
pub const MAP_HUGETLB: ::c_int = 0x40000;
715+
pub const MAP_SYNC: ::c_int = 0x080000;
698716
pub const MCL_CURRENT: ::c_int = 0x0001;
699717
pub const MCL_FUTURE: ::c_int = 0x0002;
700718
pub const MCL_ONFAULT: ::c_int = 0x0004;
@@ -746,6 +764,8 @@ pub const PTRACE_GETFPXREGS: ::c_uint = 18;
746764
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
747765
pub const PTRACE_GETREGS: ::c_uint = 12;
748766
pub const PTRACE_SETREGS: ::c_uint = 13;
767+
pub const PTRACE_SYSEMU: ::c_uint = 31;
768+
pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
749769

750770
pub const RTLD_DEEPBIND: ::c_int = 0x8;
751771
pub const RTLD_GLOBAL: ::c_int = 0x100;
@@ -846,6 +866,7 @@ pub const ECHOPRT: ::tcflag_t = 0x00000400;
846866
pub const ECHOCTL: ::tcflag_t = 0x00000200;
847867
pub const ISIG: ::tcflag_t = 0x00000001;
848868
pub const ICANON: ::tcflag_t = 0x00000002;
869+
pub const XCASE: ::tcflag_t = 0x00000004;
849870
pub const PENDIN: ::tcflag_t = 0x00004000;
850871
pub const NOFLSH: ::tcflag_t = 0x00000080;
851872

0 commit comments

Comments
 (0)