From 70e2e5ecf571e386dd6f25670d0c978ded8916ee Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 8 Dec 2023 22:54:05 +0000 Subject: [PATCH] netbsd arm* registers and reorder per architecture. --- libc-test/semver/netbsd-aarch64.txt | 57 ++++++++++++++++++++++ libc-test/semver/netbsd-x86_64.txt | 24 +++++++++ src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 59 +++++++++++++++++++++++ src/unix/bsd/netbsdlike/netbsd/arm.rs | 59 +++++++++++++++++++++++ src/unix/bsd/netbsdlike/netbsd/mod.rs | 27 ----------- src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 27 +++++++++++ 6 files changed, 226 insertions(+), 27 deletions(-) diff --git a/libc-test/semver/netbsd-aarch64.txt b/libc-test/semver/netbsd-aarch64.txt index e48c529a96c72..e1cdec5d0af24 100644 --- a/libc-test/semver/netbsd-aarch64.txt +++ b/libc-test/semver/netbsd-aarch64.txt @@ -1,3 +1,60 @@ +_REG_CPSR +_REG_ELR +_REG_FP +_REG_LR +_REG_PC +_REG_R0 +_REG_R1 +_REG_R10 +_REG_R11 +_REG_R12 +_REG_R13 +_REG_R14 +_REG_R15 +_REG_R2 +_REG_R3 +_REG_R4 +_REG_R5 +_REG_R6 +_REG_R7 +_REG_R8 +_REG_R9 +_REG_RV +_REG_SP +_REG_SPSR +_REG_TIPDR +_REG_X0 +_REG_X1 +_REG_X2 +_REG_X3 +_REG_X4 +_REG_X5 +_REG_X6 +_REG_X7 +_REG_X8 +_REG_X9 +_REG_X10 +_REG_X11 +_REG_X12 +_REG_X13 +_REG_X14 +_REG_X15 +_REG_X16 +_REG_X17 +_REG_X18 +_REG_X19 +_REG_X20 +_REG_X21 +_REG_X22 +_REG_X23 +_REG_X24 +_REG_X25 +_REG_X26 +_REG_X27 +_REG_X28 +_REG_X29 +_REG_X30 +_REG_X31 PT_GETFPREGS PT_GETREGS PT_SETFPREGS diff --git a/libc-test/semver/netbsd-x86_64.txt b/libc-test/semver/netbsd-x86_64.txt index 573099c8bb69b..0931370eeaecd 100644 --- a/libc-test/semver/netbsd-x86_64.txt +++ b/libc-test/semver/netbsd-x86_64.txt @@ -1,4 +1,28 @@ Aux64Info +_REG_DS +_REG_ERR +_REG_ES +_REG_FS +_REG_GS +_REG_R10 +_REG_R11 +_REG_R12 +_REG_R13 +_REG_R14 +_REG_R15 +_REG_R8 +_REG_R9 +_REG_RAX +_REG_RBP +_REG_RBX +_REG_RCX +_REG_RDI +_REG_RFLAGS +_REG_RIP +_REG_RSI +_REG_RSP +_REG_SS +_REG_TRAPNO PT_GETFPREGS PT_GETREGS PT_SETFPREGS diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index 7b895f63238d0..45bca4778c20c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -101,3 +101,62 @@ pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3; + +pub const _REG_R0: ::c_int = 0; +pub const _REG_R1: ::c_int = 1; +pub const _REG_R2: ::c_int = 2; +pub const _REG_R3: ::c_int = 3; +pub const _REG_R4: ::c_int = 4; +pub const _REG_R5: ::c_int = 5; +pub const _REG_R6: ::c_int = 6; +pub const _REG_R7: ::c_int = 7; +pub const _REG_R8: ::c_int = 8; +pub const _REG_R9: ::c_int = 9; +pub const _REG_R10: ::c_int = 10; +pub const _REG_R11: ::c_int = 11; +pub const _REG_R12: ::c_int = 12; +pub const _REG_R13: ::c_int = 13; +pub const _REG_R14: ::c_int = 14; +pub const _REG_R15: ::c_int = 15; +pub const _REG_CPSR: ::c_int = 16; +pub const _REG_X0: ::c_int = 0; +pub const _REG_X1: ::c_int = 1; +pub const _REG_X2: ::c_int = 2; +pub const _REG_X3: ::c_int = 3; +pub const _REG_X4: ::c_int = 4; +pub const _REG_X5: ::c_int = 5; +pub const _REG_X6: ::c_int = 6; +pub const _REG_X7: ::c_int = 7; +pub const _REG_X8: ::c_int = 8; +pub const _REG_X9: ::c_int = 9; +pub const _REG_X10: ::c_int = 10; +pub const _REG_X11: ::c_int = 11; +pub const _REG_X12: ::c_int = 12; +pub const _REG_X13: ::c_int = 13; +pub const _REG_X14: ::c_int = 14; +pub const _REG_X15: ::c_int = 15; +pub const _REG_X16: ::c_int = 16; +pub const _REG_X17: ::c_int = 17; +pub const _REG_X18: ::c_int = 18; +pub const _REG_X19: ::c_int = 19; +pub const _REG_X20: ::c_int = 20; +pub const _REG_X21: ::c_int = 21; +pub const _REG_X22: ::c_int = 22; +pub const _REG_X23: ::c_int = 23; +pub const _REG_X24: ::c_int = 24; +pub const _REG_X25: ::c_int = 25; +pub const _REG_X26: ::c_int = 26; +pub const _REG_X27: ::c_int = 27; +pub const _REG_X28: ::c_int = 28; +pub const _REG_X29: ::c_int = 29; +pub const _REG_X30: ::c_int = 30; +pub const _REG_X31: ::c_int = 31; +pub const _REG_ELR: ::c_int = 32; +pub const _REG_SPSR: ::c_int = 33; +pub const _REG_TIPDR: ::c_int = 34; + +pub const _REG_RV: ::c_int = _REG_X0; +pub const _REG_FP: ::c_int = _REG_X29; +pub const _REG_LR: ::c_int = _REG_X30; +pub const _REG_SP: ::c_int = _REG_X31; +pub const _REG_PC: ::c_int = _REG_ELR; diff --git a/src/unix/bsd/netbsdlike/netbsd/arm.rs b/src/unix/bsd/netbsdlike/netbsd/arm.rs index 4bf3ccd02b2c4..b5000d34d66fb 100644 --- a/src/unix/bsd/netbsdlike/netbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -20,3 +20,62 @@ pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; + +pub const _REG_R0: ::c_int = 0; +pub const _REG_R1: ::c_int = 1; +pub const _REG_R2: ::c_int = 2; +pub const _REG_R3: ::c_int = 3; +pub const _REG_R4: ::c_int = 4; +pub const _REG_R5: ::c_int = 5; +pub const _REG_R6: ::c_int = 6; +pub const _REG_R7: ::c_int = 7; +pub const _REG_R8: ::c_int = 8; +pub const _REG_R9: ::c_int = 9; +pub const _REG_R10: ::c_int = 10; +pub const _REG_R11: ::c_int = 11; +pub const _REG_R12: ::c_int = 12; +pub const _REG_R13: ::c_int = 13; +pub const _REG_R14: ::c_int = 14; +pub const _REG_R15: ::c_int = 15; +pub const _REG_CPSR: ::c_int = 16; +pub const _REG_X0: ::c_int = 0; +pub const _REG_X1: ::c_int = 1; +pub const _REG_X2: ::c_int = 2; +pub const _REG_X3: ::c_int = 3; +pub const _REG_X4: ::c_int = 4; +pub const _REG_X5: ::c_int = 5; +pub const _REG_X6: ::c_int = 6; +pub const _REG_X7: ::c_int = 7; +pub const _REG_X8: ::c_int = 8; +pub const _REG_X9: ::c_int = 9; +pub const _REG_X10: ::c_int = 10; +pub const _REG_X11: ::c_int = 11; +pub const _REG_X12: ::c_int = 12; +pub const _REG_X13: ::c_int = 13; +pub const _REG_X14: ::c_int = 14; +pub const _REG_X15: ::c_int = 15; +pub const _REG_X16: ::c_int = 16; +pub const _REG_X17: ::c_int = 17; +pub const _REG_X18: ::c_int = 18; +pub const _REG_X19: ::c_int = 19; +pub const _REG_X20: ::c_int = 20; +pub const _REG_X21: ::c_int = 21; +pub const _REG_X22: ::c_int = 22; +pub const _REG_X23: ::c_int = 23; +pub const _REG_X24: ::c_int = 24; +pub const _REG_X25: ::c_int = 25; +pub const _REG_X26: ::c_int = 26; +pub const _REG_X27: ::c_int = 27; +pub const _REG_X28: ::c_int = 28; +pub const _REG_X29: ::c_int = 29; +pub const _REG_X30: ::c_int = 30; +pub const _REG_X31: ::c_int = 31; +pub const _REG_ELR: ::c_int = 32; +pub const _REG_SPSR: ::c_int = 33; +pub const _REG_TIPDR: ::c_int = 34; + +pub const _REG_RV: ::c_int = _REG_R0; +pub const _REG_FP: ::c_int = _REG_R11; +pub const _REG_LR: ::c_int = _REG_R13; +pub const _REG_SP: ::c_int = _REG_R14; +pub const _REG_PC: ::c_int = _REG_R15; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index a65035d348f9b..c057d31212493 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -2396,33 +2396,6 @@ pub const LSZOMB: ::c_int = 5; pub const LSONPROC: ::c_int = 7; pub const LSSUSPENDED: ::c_int = 8; -pub const _REG_RDI: ::c_int = 0; -pub const _REG_RSI: ::c_int = 1; -pub const _REG_RDX: ::c_int = 2; -pub const _REG_RCX: ::c_int = 3; -pub const _REG_R8: ::c_int = 4; -pub const _REG_R9: ::c_int = 5; -pub const _REG_R10: ::c_int = 6; -pub const _REG_R11: ::c_int = 7; -pub const _REG_R12: ::c_int = 8; -pub const _REG_R13: ::c_int = 9; -pub const _REG_R14: ::c_int = 10; -pub const _REG_R15: ::c_int = 11; -pub const _REG_RBP: ::c_int = 12; -pub const _REG_RBX: ::c_int = 13; -pub const _REG_RAX: ::c_int = 14; -pub const _REG_GS: ::c_int = 15; -pub const _REG_FS: ::c_int = 16; -pub const _REG_ES: ::c_int = 17; -pub const _REG_DS: ::c_int = 18; -pub const _REG_TRAPNO: ::c_int = 19; -pub const _REG_ERR: ::c_int = 20; -pub const _REG_RIP: ::c_int = 21; -pub const _REG_CS: ::c_int = 22; -pub const _REG_RFLAGS: ::c_int = 23; -pub const _REG_RSP: ::c_int = 24; -pub const _REG_SS: ::c_int = 25; - // sys/xattr.h pub const XATTR_CREATE: ::c_int = 0x01; pub const XATTR_REPLACE: ::c_int = 0x02; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs index 2f6e4454577a0..ba259074f6129 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -38,3 +38,30 @@ pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; + +pub const _REG_RDI: ::c_int = 0; +pub const _REG_RSI: ::c_int = 1; +pub const _REG_RDX: ::c_int = 2; +pub const _REG_RCX: ::c_int = 3; +pub const _REG_R8: ::c_int = 4; +pub const _REG_R9: ::c_int = 5; +pub const _REG_R10: ::c_int = 6; +pub const _REG_R11: ::c_int = 7; +pub const _REG_R12: ::c_int = 8; +pub const _REG_R13: ::c_int = 9; +pub const _REG_R14: ::c_int = 10; +pub const _REG_R15: ::c_int = 11; +pub const _REG_RBP: ::c_int = 12; +pub const _REG_RBX: ::c_int = 13; +pub const _REG_RAX: ::c_int = 14; +pub const _REG_GS: ::c_int = 15; +pub const _REG_FS: ::c_int = 16; +pub const _REG_ES: ::c_int = 17; +pub const _REG_DS: ::c_int = 18; +pub const _REG_TRAPNO: ::c_int = 19; +pub const _REG_ERR: ::c_int = 20; +pub const _REG_RIP: ::c_int = 21; +pub const _REG_CS: ::c_int = 22; +pub const _REG_RFLAGS: ::c_int = 23; +pub const _REG_RSP: ::c_int = 24; +pub const _REG_SS: ::c_int = 25;