Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix ARM32 Windows #685

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/windows_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ pub struct CONTEXT {
pub SegSs: u32,
pub ExtendedRegisters: [u8; 512],
}

pub type CONTEXT_FLAGS = u32;
pub const CP_UTF8: u32 = 65001u32;
pub type CREATE_TOOLHELP_SNAPSHOT_FLAGS = u32;
Expand Down Expand Up @@ -662,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;
Loading