diff options
| author | Miguel <m.i@gmx.at> | 2018-09-11 00:33:28 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-11 00:33:28 +0200 |
| commit | 75f0977e41004511bd475ee75a24fd04db4ddc39 (patch) | |
| tree | f0062b01f1f57c31be007c2c01b580a2081e399b /fs | |
| parent | a7ca82133bcb8139bb9d11aa717657ef42ab6cfe (diff) | |
little cleanup vmem, parse kernel section headers
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/elf.c | 19 | ||||
| -rw-r--r-- | fs/elf.h | 2 |
2 files changed, 21 insertions, 0 deletions
@@ -65,6 +65,25 @@ typedef struct { } Elf32_Phdr; +void elf_multiboot_read(multiboot_information *info) +{ + uint32_t num=info->syms[0]; + uint32_t addr=info->syms[2]; + uint32_t stridx=info->syms[3]; + + klog("ELF Kernel Sections:"); + // iterate over section headers. + Elf32_Shdr *shdr=addr; + for(int i=0;i<num;i++) + { + uint32_t nameidx=shdr[i].sh_name; + char *name=shdr[stridx].sh_addr+nameidx; + klog("section %d: %s addr: 0x%08X offset: 0x%08X size: 0x%08X",i,name,shdr[i].sh_addr,shdr[i].sh_offset,shdr[i].sh_size); + + + } +} + // returns elf entry point uint32_t load_elf(char *name, uint32_t *alloc) { @@ -1 +1,3 @@ +//https://docs.oracle.com/cd/E19455-01/806-3773/elf-2/index.html uint32_t load_elf(char *name, uint32_t *alloc); +void elf_multiboot_read(multiboot_information *info); |
