@@ -88,17 +88,15 @@ pub fn load_elf(
88
88
page_table : & mut impl Mapper < Size4KiB > ,
89
89
frame_allocator : & mut impl FrameAllocator < Size4KiB > ,
90
90
) -> Result < ( ) , MapToError < Size4KiB > > {
91
- let file_buf = elf. input . as_ptr ( ) ;
92
-
93
- info ! ( "Loading ELF file... @ {:#x}" , file_buf as u64 ) ;
91
+ trace ! ( "Loading ELF file...{:?}" , elf. input. as_ptr( ) ) ;
94
92
95
93
for segment in elf. program_iter ( ) {
96
94
if segment. get_type ( ) . unwrap ( ) != program:: Type :: Load {
97
95
continue ;
98
96
}
99
97
100
98
load_segment (
101
- file_buf ,
99
+ elf ,
102
100
physical_offset,
103
101
& segment,
104
102
page_table,
@@ -113,7 +111,7 @@ pub fn load_elf(
113
111
///
114
112
/// load segment to new frame and set page table
115
113
fn load_segment (
116
- file_buf : * const u8 ,
114
+ elf : & ElfFile ,
117
115
physical_offset : u64 ,
118
116
segment : & program:: ProgramHeader ,
119
117
page_table : & mut impl Mapper < Size4KiB > ,
@@ -137,7 +135,7 @@ fn load_segment(
137
135
let end_page = Page :: containing_address ( virt_start_addr + file_size - 1u64 ) ;
138
136
let pages = Page :: range_inclusive ( start_page, end_page) ;
139
137
140
- let data = unsafe { file_buf . add ( file_offset as usize ) } ;
138
+ let data = unsafe { elf . input . as_ptr ( ) . add ( file_offset as usize ) } ;
141
139
142
140
for ( idx, page) in pages. enumerate ( ) {
143
141
let frame = frame_allocator
0 commit comments