Make elf proghdr fields match what objdump prints
This commit is contained in:
parent
5f069dcf2f
commit
fa81545f1c
3 changed files with 7 additions and 7 deletions
|
@ -35,8 +35,8 @@ bootmain(void)
|
|||
ph = (struct proghdr*)((uchar*)elf + elf->phoff);
|
||||
eph = ph + elf->phnum;
|
||||
for(; ph < eph; ph++){
|
||||
pa = (uchar*)ph->pa;
|
||||
readseg(pa, ph->filesz, ph->offset);
|
||||
pa = (uchar*)ph->paddr;
|
||||
readseg(pa, ph->filesz, ph->off);
|
||||
if(ph->memsz > ph->filesz)
|
||||
stosb(pa + ph->filesz, 0, ph->memsz - ph->filesz);
|
||||
}
|
||||
|
|
6
elf.h
6
elf.h
|
@ -24,9 +24,9 @@ struct elfhdr {
|
|||
// Program section header
|
||||
struct proghdr {
|
||||
uint type;
|
||||
uint offset;
|
||||
uint va;
|
||||
uint pa;
|
||||
uint off;
|
||||
uint vaddr;
|
||||
uint paddr;
|
||||
uint filesz;
|
||||
uint memsz;
|
||||
uint flags;
|
||||
|
|
4
exec.c
4
exec.c
|
@ -41,9 +41,9 @@ exec(char *path, char **argv)
|
|||
continue;
|
||||
if(ph.memsz < ph.filesz)
|
||||
goto bad;
|
||||
if((sz = allocuvm(pgdir, sz, ph.va + ph.memsz)) == 0)
|
||||
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
|
||||
goto bad;
|
||||
if(loaduvm(pgdir, (char*)ph.va, ip, ph.offset, ph.filesz) < 0)
|
||||
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
|
||||
goto bad;
|
||||
}
|
||||
iunlockput(ip);
|
||||
|
|
Loading…
Reference in a new issue