Skip to content

Commit baaa0ca

Browse files
committed
also add for pe32
1 parent 17952d5 commit baaa0ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/libmwemu/src/emu/loaders.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ impl Emu {
106106
log::info!("base: 0x{:x}", base);
107107
}
108108

109+
let sec_allign = pe32.opt.section_alignment;
109110
// 4. map pe and then sections
110111
let pemap = self
111112
.maps
112113
.create_map(
113114
&format!("{}.pe", filename2),
114115
base.into(),
115-
pe32.opt.size_of_headers.into(),
116+
align_up!(pe32.opt.size_of_headers, sec_allign) as u64,
116117
Permission::READ_WRITE,
117118
)
118119
.expect("cannot create pe map");
@@ -152,7 +153,7 @@ impl Emu {
152153
let map = match self.maps.create_map(
153154
&format!("{}{}", filename2, sect_name),
154155
base as u64 + sect.virtual_address as u64,
155-
sz,
156+
align_up!(sz, sec_allign as u64),
156157
permission,
157158
) {
158159
Ok(m) => m,

0 commit comments

Comments
 (0)