ia64/xen-unstable

changeset 3723:5612c06cde33

bitkeeper revision 1.1159.251.1 (4208dde2yO5a2hmuPJlwJg0U4vM8yA)

Use p_paddr when loading Elf program segments; not p_vaddr.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Tue Feb 08 15:42:26 2005 +0000 (2005-02-08)
parents 9f7935ea4606
children 9db7fbdf56b6
files tools/libxc/xc_linux_build.c tools/libxc/xc_vmx_build.c xen/common/elf.c
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Tue Feb 08 15:13:51 2005 +0000
     1.2 +++ b/tools/libxc/xc_linux_build.c	Tue Feb 08 15:42:26 2005 +0000
     1.3 @@ -558,10 +558,10 @@ static int parseelfimage(char *elfbase,
     1.4          phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
     1.5          if ( !is_loadable_phdr(phdr) )
     1.6              continue;
     1.7 -        if ( phdr->p_vaddr < kernstart )
     1.8 -            kernstart = phdr->p_vaddr;
     1.9 -        if ( (phdr->p_vaddr + phdr->p_memsz) > kernend )
    1.10 -            kernend = phdr->p_vaddr + phdr->p_memsz;
    1.11 +        if ( phdr->p_paddr < kernstart )
    1.12 +            kernstart = phdr->p_paddr;
    1.13 +        if ( (phdr->p_paddr + phdr->p_memsz) > kernend )
    1.14 +            kernend = phdr->p_paddr + phdr->p_memsz;
    1.15      }
    1.16  
    1.17      if ( (kernstart > kernend) || 
    1.18 @@ -611,7 +611,7 @@ loadelfimage(
    1.19          
    1.20          for ( done = 0; done < phdr->p_filesz; done += chunksz )
    1.21          {
    1.22 -            pa = (phdr->p_vaddr + done) - vstart;
    1.23 +            pa = (phdr->p_paddr + done) - vstart;
    1.24              va = xc_map_foreign_range(
    1.25                  xch, dom, PAGE_SIZE, PROT_WRITE, parray[pa>>PAGE_SHIFT]);
    1.26              chunksz = phdr->p_filesz - done;
    1.27 @@ -624,7 +624,7 @@ loadelfimage(
    1.28  
    1.29          for ( ; done < phdr->p_memsz; done += chunksz )
    1.30          {
    1.31 -            pa = (phdr->p_vaddr + done) - vstart;
    1.32 +            pa = (phdr->p_paddr + done) - vstart;
    1.33              va = xc_map_foreign_range(
    1.34                  xch, dom, PAGE_SIZE, PROT_WRITE, parray[pa>>PAGE_SHIFT]);
    1.35              chunksz = phdr->p_memsz - done;
     2.1 --- a/tools/libxc/xc_vmx_build.c	Tue Feb 08 15:13:51 2005 +0000
     2.2 +++ b/tools/libxc/xc_vmx_build.c	Tue Feb 08 15:42:26 2005 +0000
     2.3 @@ -629,10 +629,10 @@ static int parseelfimage(char *elfbase,
     2.4          phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
     2.5          if ( !is_loadable_phdr(phdr) )
     2.6              continue;
     2.7 -        if ( phdr->p_vaddr < kernstart )
     2.8 -            kernstart = phdr->p_vaddr;
     2.9 -        if ( (phdr->p_vaddr + phdr->p_memsz) > kernend )
    2.10 -            kernend = phdr->p_vaddr + phdr->p_memsz;
    2.11 +        if ( phdr->p_paddr < kernstart )
    2.12 +            kernstart = phdr->p_paddr;
    2.13 +        if ( (phdr->p_paddr + phdr->p_memsz) > kernend )
    2.14 +            kernend = phdr->p_paddr + phdr->p_memsz;
    2.15      }
    2.16  
    2.17      if ( (kernstart > kernend) || 
    2.18 @@ -676,7 +676,7 @@ loadelfimage(
    2.19          
    2.20          for ( done = 0; done < phdr->p_filesz; done += chunksz )
    2.21          {
    2.22 -            pa = (phdr->p_vaddr + done) - vstart - LINUX_PAGE_OFFSET;
    2.23 +            pa = (phdr->p_paddr + done) - vstart - LINUX_PAGE_OFFSET;
    2.24              va = xc_map_foreign_range(
    2.25                  xch, dom, PAGE_SIZE, PROT_WRITE, parray[pa>>PAGE_SHIFT]);
    2.26              chunksz = phdr->p_filesz - done;
    2.27 @@ -689,7 +689,7 @@ loadelfimage(
    2.28  
    2.29          for ( ; done < phdr->p_memsz; done += chunksz )
    2.30          {
    2.31 -            pa = (phdr->p_vaddr + done) - vstart - LINUX_PAGE_OFFSET;
    2.32 +            pa = (phdr->p_paddr + done) - vstart - LINUX_PAGE_OFFSET;
    2.33              va = xc_map_foreign_range(
    2.34                  xch, dom, PAGE_SIZE, PROT_WRITE, parray[pa>>PAGE_SHIFT]);
    2.35              chunksz = phdr->p_memsz - done;
     3.1 --- a/xen/common/elf.c	Tue Feb 08 15:13:51 2005 +0000
     3.2 +++ b/xen/common/elf.c	Tue Feb 08 15:42:26 2005 +0000
     3.3 @@ -13,10 +13,8 @@
     3.4  
     3.5  #ifdef CONFIG_X86
     3.6  #define FORCE_XENELF_IMAGE 1
     3.7 -#define ELF_ADDR           p_vaddr
     3.8  #elif defined(__ia64__)
     3.9  #define FORCE_XENELF_IMAGE 0
    3.10 -#define ELF_ADDR           p_paddr
    3.11  #endif
    3.12  
    3.13  static inline int is_loadable_phdr(Elf_Phdr *phdr)
    3.14 @@ -100,10 +98,10 @@ int parseelfimage(char *elfbase,
    3.15          phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize));
    3.16          if ( !is_loadable_phdr(phdr) )
    3.17              continue;
    3.18 -        if ( phdr->ELF_ADDR < kernstart )
    3.19 -            kernstart = phdr->ELF_ADDR;
    3.20 -        if ( (phdr->ELF_ADDR + phdr->p_memsz) > kernend )
    3.21 -            kernend = phdr->ELF_ADDR + phdr->p_memsz;
    3.22 +        if ( phdr->p_paddr < kernstart )
    3.23 +            kernstart = phdr->p_paddr;
    3.24 +        if ( (phdr->p_paddr + phdr->p_memsz) > kernend )
    3.25 +            kernend = phdr->p_paddr + phdr->p_memsz;
    3.26      }
    3.27  
    3.28      if ( (kernstart > kernend) || 
    3.29 @@ -144,10 +142,10 @@ int loadelfimage(char *elfbase)
    3.30          if ( !is_loadable_phdr(phdr) )
    3.31              continue;
    3.32          if ( phdr->p_filesz != 0 )
    3.33 -            memcpy((char *)phdr->ELF_ADDR, elfbase + phdr->p_offset, 
    3.34 +            memcpy((char *)phdr->p_paddr, elfbase + phdr->p_offset, 
    3.35                     phdr->p_filesz);
    3.36          if ( phdr->p_memsz > phdr->p_filesz )
    3.37 -            memset((char *)phdr->ELF_ADDR + phdr->p_filesz, 0, 
    3.38 +            memset((char *)phdr->p_paddr + phdr->p_filesz, 0, 
    3.39                     phdr->p_memsz - phdr->p_filesz);
    3.40      }
    3.41