mirror of
https://github.com/Noratrieb/portability.git
synced 2026-01-15 16:25:02 +01:00
stuff
This commit is contained in:
parent
00afbbfea3
commit
d8c08d9359
3 changed files with 20 additions and 2 deletions
11
src/lib.rs
11
src/lib.rs
|
|
@ -253,6 +253,8 @@ pub fn execute(file: File, pe: &[u8]) {
|
|||
// just some arbitrary offset that probably won't collide with anything
|
||||
let base = optional_header.image_base as usize + 0xFFFFFF0000;
|
||||
|
||||
assert_eq!(base & (4096 - 1), 0);
|
||||
|
||||
let map = unsafe { crate::mmap::map(file).unwrap() };
|
||||
|
||||
// allocate the sections.
|
||||
|
|
@ -274,7 +276,14 @@ pub fn execute(file: File, pe: &[u8]) {
|
|||
} else {
|
||||
crate::mmap::Mode::Read
|
||||
};
|
||||
let address = std::ptr::with_exposed_provenance(base + section.virtual_address as usize);
|
||||
let address =
|
||||
std::ptr::with_exposed_provenance::<()>(base + section.virtual_address as usize);
|
||||
dbg!(section);
|
||||
|
||||
// assert stuff is aligned (yes 4096 as a hardcoded page is bad)
|
||||
//assert_eq!(section.pointer_to_raw_data & (4096 - 1), 0);
|
||||
assert_eq!(address.addr() & (4096 - 1), 0);
|
||||
|
||||
unsafe {
|
||||
map.view(
|
||||
mode,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue