File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,11 +12,23 @@ int test_elf(UInt32* img)
1212 return (img [0 ] == elfmagic );
1313}
1414
15+ /* WIP ... this will go into fn below */
16+ int mytest (UInt32 * img ) {
17+ struct elf32_hdr * ehdr = img ;
18+ struct elf32_phdr * phdr ;
19+
20+ phdr = img + ((ehdr -> e_phoff + (ehdr -> e_phentsize * 0 )) >> 2 );
21+
22+ return phdr -> p_vaddr ;
23+ }
24+
1525/* relocate_elf()
1626 *
1727 * Relocate the ELF file in memory ... ToDo
1828 * */
1929void relocate_elf (UInt32 * img , UInt32 size )
2030{
31+ struct elf32_hdr * ehdr = img ;
32+
2133 for (;;);
2234}
Original file line number Diff line number Diff line change @@ -42,5 +42,16 @@ struct elf32_hdr {
4242 UInt16 e_shstrndx ;
4343};
4444
45+ struct elf32_phdr {
46+ UInt32 p_type ;
47+ UInt32 p_offset ;
48+ UInt32 p_vaddr ;
49+ UInt32 p_paddr ;
50+ UInt32 p_filesz ;
51+ UInt32 p_memsz ;
52+ UInt32 p_flags ;
53+ UInt32 p_align ;
54+ };
55+
4556int test_elf (UInt32 * img );
4657void relocate_elf (UInt32 * kernel , UInt32 size );
You can’t perform that action at this time.
0 commit comments