diff options
| author | Miguel <m.i@gmx.at> | 2018-09-14 20:23:24 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-14 20:23:24 +0200 |
| commit | fdf6100721870780319bc7cc766a0bb5b4789965 (patch) | |
| tree | f30ff5b21ee557ec5dcd5ccddb7b2a1abc46db1c /fs/elf.c | |
| parent | 1195ca0bd84693fd56f6d34a9f2de3107b9820bf (diff) | |
ext2 improved , struggling with scheduler
Diffstat (limited to 'fs/elf.c')
| -rw-r--r-- | fs/elf.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -80,12 +80,10 @@ void elf_multiboot_read(multiboot_information *info) 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 +/** returns elf entry point ans et breakpoint to alloc */ uint32_t load_elf(char *name, uint32_t *alloc) { uint32_t ext2_ramimage=VMEM_EXT2_RAMIMAGE; @@ -96,18 +94,17 @@ uint32_t load_elf(char *name, uint32_t *alloc) //TODO: load ELF binary and move this to own compilation unit //load binary - //uint32_t vaddr=0x08000000; uint32_t vaddr=0x08048000; + uint32_t pos=0; klog("loading %s",name); - ext2_check(ext2_ramimage); - ext2_inode_content(ext2_ramimage,inode_nr,vaddr,0x100000); // max ignored?? + ext2_read_inode(ext2_ramimage,inode_nr,vaddr,&pos,4096*64); // max ignored?? klog("ELF File loaded to final destination."); - Elf32_Ehdr *elf; elf=vaddr; + if(elf->e_ident[0]!=0x7f||elf->e_ident[1]!='E'||elf->e_ident[2]!='L'||elf->e_ident[3]!='F') kpanic("ELF mismatch!?"); @@ -159,7 +156,6 @@ uint32_t load_elf(char *name, uint32_t *alloc) klog("p-memsz: 0x%08X",phdr->p_memsz); */ - klog("data: 0x%08X-0x%08X",phdr->p_vaddr,phdr->p_vaddr+phdr->p_filesz); klog("bss: 0x%08X-0x%08X",phdr->p_vaddr+phdr->p_filesz,phdr->p_vaddr+phdr->p_memsz); @@ -185,7 +181,6 @@ uint32_t load_elf(char *name, uint32_t *alloc) *alloc=phdr->p_vaddr+phdr->p_memsz; } - } klog("heap starts at: 0x%08X",*alloc); |
