Skip to content

Commit 77b44dd

Browse files
author
Marek
committed
Add a few more ELF stubs
1 parent 5dab8c1 commit 77b44dd

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎arm/elf.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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
* */
1929
void relocate_elf(UInt32 *img, UInt32 size)
2030
{
31+
struct elf32_hdr *ehdr = img;
32+
2133
for(;;);
2234
}

‎include/elf.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
4556
int test_elf(UInt32 *img);
4657
void relocate_elf(UInt32 *kernel, UInt32 size);

0 commit comments

Comments
 (0)