diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/rust/minidump-writer/src/linux/thread_info.rs | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/minidump-writer/src/linux/thread_info.rs')
-rw-r--r-- | third_party/rust/minidump-writer/src/linux/thread_info.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/third_party/rust/minidump-writer/src/linux/thread_info.rs b/third_party/rust/minidump-writer/src/linux/thread_info.rs index 5bb1f9e8fb..a3fbed952f 100644 --- a/third_party/rust/minidump-writer/src/linux/thread_info.rs +++ b/third_party/rust/minidump-writer/src/linux/thread_info.rs @@ -38,19 +38,17 @@ enum NT_Elf { } #[inline] -pub fn to_u128(slice: &[u32]) -> &[u128] { - unsafe { std::slice::from_raw_parts(slice.as_ptr().cast(), slice.len().saturating_div(4)) } -} - -#[inline] -pub fn copy_registers(dst: &mut [u128], src: &[u128]) { - let to_copy = std::cmp::min(dst.len(), src.len()); - dst[..to_copy].copy_from_slice(&src[..to_copy]); -} - -#[inline] pub fn copy_u32_registers(dst: &mut [u128], src: &[u32]) { - copy_registers(dst, to_u128(src)); + // SAFETY: We are copying a block of memory from ptrace as u32s to the u128 + // format of minidump-common + unsafe { + let dst: &mut [u8] = + std::slice::from_raw_parts_mut(dst.as_mut_ptr().cast(), dst.len() * 16); + let src: &[u8] = std::slice::from_raw_parts(src.as_ptr().cast(), src.len() * 4); + + let to_copy = std::cmp::min(dst.len(), src.len()); + dst[..to_copy].copy_from_slice(&src[..to_copy]); + } } trait CommonThreadInfo { |