@@ -88,17 +88,15 @@ pub fn load_elf(
8888 page_table : & mut impl Mapper < Size4KiB > ,
8989 frame_allocator : & mut impl FrameAllocator < Size4KiB > ,
9090) -> 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( ) ) ;
9492
9593 for segment in elf. program_iter ( ) {
9694 if segment. get_type ( ) . unwrap ( ) != program:: Type :: Load {
9795 continue ;
9896 }
9997
10098 load_segment (
101- file_buf ,
99+ elf ,
102100 physical_offset,
103101 & segment,
104102 page_table,
@@ -113,7 +111,7 @@ pub fn load_elf(
113111///
114112/// load segment to new frame and set page table
115113fn load_segment (
116- file_buf : * const u8 ,
114+ elf : & ElfFile ,
117115 physical_offset : u64 ,
118116 segment : & program:: ProgramHeader ,
119117 page_table : & mut impl Mapper < Size4KiB > ,
@@ -137,7 +135,7 @@ fn load_segment(
137135 let end_page = Page :: containing_address ( virt_start_addr + file_size - 1u64 ) ;
138136 let pages = Page :: range_inclusive ( start_page, end_page) ;
139137
140- let data = unsafe { file_buf . add ( file_offset as usize ) } ;
138+ let data = unsafe { elf . input . as_ptr ( ) . add ( file_offset as usize ) } ;
141139
142140 for ( idx, page) in pages. enumerate ( ) {
143141 let frame = frame_allocator
0 commit comments