Browse files

Make elf proghdr fields match what objdump prints

  • Loading branch information...
1 parent 5f069dc commit fa81545f1c15630573dc1d312fa75f261f82b9f1 Frans Kaashoek committed Aug 17, 2011
Showing with 7 additions and 7 deletions.
  1. +2 −2 bootmain.c
  2. +3 −3 elf.h
  3. +2 −2 exec.c
View
4 bootmain.c
@@ -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);
}
View
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;
View
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);

0 comments on commit fa81545

Please sign in to comment.