Skip to content

Commit

Permalink
Move win arm shim to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbai committed Jan 6, 2025
1 parent 41f921d commit 9e23660
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 58 deletions.
61 changes: 3 additions & 58 deletions src/windows_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,64 +246,6 @@ pub struct CONTEXT {
pub ExtendedRegisters: [u8; 512],
}

cfg_if::cfg_if! {
if #[cfg(target_arch = "arm")] {
pub const ARM_MAX_BREAKPOINTS: usize = 8;
pub const ARM_MAX_WATCHPOINTS: usize = 1;

#[repr(C)]
#[derive(Clone, Copy)]
pub struct NEON128 {
pub Low: u64,
pub High: i64,
}

#[repr(C)]
#[derive(Clone, Copy)]
pub union CONTEXT_FloatRegs{
pub Q: [NEON128; 16],
pub D: [u64; 32],
pub S: [u32; 32],
}

#[repr(C)]
#[derive(Clone, Copy)]
pub struct CONTEXT {
pub ContextFlags: u32,
pub R0: u32,
pub R1: u32,
pub R2: u32,
pub R3: u32,
pub R4: u32,
pub R5: u32,
pub R6: u32,
pub R7: u32,
pub R8: u32,
pub R9: u32,
pub R10: u32,
pub R11: u32,
pub R12: u32,
// Control registers
pub Sp: u32,
pub Lr: u32,
pub Pc: u32,
pub Cpsr: u32,
// Floating-point registers
pub Fpsrc: u32,
pub Padding: u32,
pub u: CONTEXT_FloatRegs,
// Debug registers
pub Bvr: [u32; ARM_MAX_BREAKPOINTS],
pub Bcr: [u32; ARM_MAX_BREAKPOINTS],
pub Wvr: [u32; ARM_MAX_WATCHPOINTS],
pub Wcr: [u32; ARM_MAX_WATCHPOINTS],
pub Padding2: [u32; 2],
}

pub const IMAGE_FILE_MACHINE_ARMNT: IMAGE_FILE_MACHINE = 0x01c4;
}
}

pub type CONTEXT_FLAGS = u32;
pub const CP_UTF8: u32 = 65001u32;
pub type CREATE_TOOLHELP_SNAPSHOT_FLAGS = u32;
Expand Down Expand Up @@ -721,3 +663,6 @@ pub struct XSAVE_FORMAT {
pub XmmRegisters: [M128A; 8],
pub Reserved4: [u8; 224],
}

#[cfg(target_arch = "arm")]
include!("./windows_sys_arm32_shim.rs");
53 changes: 53 additions & 0 deletions src/windows_sys_arm32_shim.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
pub const ARM_MAX_BREAKPOINTS: usize = 8;
pub const ARM_MAX_WATCHPOINTS: usize = 1;

#[repr(C)]
#[derive(Clone, Copy)]
pub struct NEON128 {
pub Low: u64,
pub High: i64,
}

#[repr(C)]
#[derive(Clone, Copy)]
pub union CONTEXT_FloatRegs {
pub Q: [NEON128; 16],
pub D: [u64; 32],
pub S: [u32; 32],
}

#[repr(C)]
#[derive(Clone, Copy)]
pub struct CONTEXT {
pub ContextFlags: u32,
pub R0: u32,
pub R1: u32,
pub R2: u32,
pub R3: u32,
pub R4: u32,
pub R5: u32,
pub R6: u32,
pub R7: u32,
pub R8: u32,
pub R9: u32,
pub R10: u32,
pub R11: u32,
pub R12: u32,
// Control registers
pub Sp: u32,
pub Lr: u32,
pub Pc: u32,
pub Cpsr: u32,
// Floating-point registers
pub Fpsrc: u32,
pub Padding: u32,
pub u: CONTEXT_FloatRegs,
// Debug registers
pub Bvr: [u32; ARM_MAX_BREAKPOINTS],
pub Bcr: [u32; ARM_MAX_BREAKPOINTS],
pub Wvr: [u32; ARM_MAX_WATCHPOINTS],
pub Wcr: [u32; ARM_MAX_WATCHPOINTS],
pub Padding2: [u32; 2],
}

pub const IMAGE_FILE_MACHINE_ARMNT: IMAGE_FILE_MACHINE = 0x01c4;

0 comments on commit 9e23660

Please sign in to comment.