Skip to content

Commit 0b7a514

Browse files
committed
fix(elf): make converting elf Sections into FrameRanges cross platform
(but horrendously ugly, i should fix that eventually)
1 parent f2e70a7 commit 0b7a514

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

elf/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ unsafe fn extract_from_slice<'slice, T: Sized>( data: &'slice [u8]
240240
impl<'a, W: ElfWord> convert::Into<FrameRange> for &'a Section<W> {
241241
#[inline]
242242
fn into(self) -> FrameRange {
243-
use memory::PAddr;
244-
let start = PhysicalPage::from(PAddr::from(self.address() as u64));
245-
let end = PhysicalPage::from(PAddr::from(self.end_address() as u64));
243+
use memory::{Addr, PAddr};
244+
// TODO: refactor this disgusting type cast monstrosity hell
245+
let start = PhysicalPage::from(self.address() as <PAddr as Addr>::Repr);
246+
let end = PhysicalPage::from(self.end_address() as <PAddr as Addr>::Repr);
246247
start .. end
247248
}
248249
}

0 commit comments

Comments
 (0)