search for: p_vaddr

Displaying 20 results from an estimated 50 matches for "p_vaddr".

Did you mean: p_paddr
2015 Oct 10
3
[PATCH] Extend Multiboot1 with support for ELF64 file format
...overridden further down... */ + + ph64 = (Elf64_Phdr *) (cptr + eh64->e_phoff); + + for (i = 0; i < eh64->e_phnum; i++) { + if (ph64->p_type == PT_LOAD || ph64->p_type == PT_PHDR) { + /* + * This loads at p_paddr, which matches Grub. However, if + * e_entry falls within the p_vaddr range of this PHDR, then + * adjust it to match the p_paddr range... this is how Grub + * behaves, so it's by definition correct (it doesn't have to + * make sense...) + */ + addr_t addr = ph64->p_paddr; + addr_t msize = ph64->p_memsz; + addr_t dsize = min(msize, ph64->p...
2009 Apr 03
0
PATCH: Handle virtual entry point in mboot.c32
.../* If the entry point is within this program header, set the real + * entry point to the correct physical address. See GRUB's stage2 + * (line 620) for a similar calculation. */ + if( + (ehdr->e_entry >= phdr[i].p_vaddr) + && + (ehdr->e_entry < (phdr[i].p_vaddr + run_size)) + ) { + realEntry = (ehdr->e_entry + phdr[i].p_paddr) - phdr[i].p_vaddr; + } + /* Place the segment where it wants to be...
2007 Apr 18
1
[PATCH] Unified lguest launcher
This is a new version of the unified lguest launcher that applies to the current tree. According to rusty's suggestion, I'm bothering less to be able to load 32 bit kernels on 64-bit machines: changing the launcher for such case would be the easy part! In the absence of further objections, I'll commit it. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> -- =
2007 Apr 18
1
[PATCH] Unified lguest launcher
This is a new version of the unified lguest launcher that applies to the current tree. According to rusty's suggestion, I'm bothering less to be able to load 32 bit kernels on 64-bit machines: changing the launcher for such case would be the easy part! In the absence of further objections, I'll commit it. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> -- =
2020 Aug 13
2
Adding sections in a binary
...ALLOC section is not part of the memory image and not used by the program (unless for some rare introspection use cases) * adding a SHF_ALLOC section is difficult. You likely need to fix the containing PT_LOAD segment. llvm-objcopy only does the base p_offset fix. You need to take care p_vaddr/p_paddr/p_filesz/p_memsz by your self. + adding a section smaller than the known lowest address (ET_EXEC with a non-zero image base) or larger than the known largest address: The PT_LOAD fixes are doable. + adding a section within the existing address ranges: this is very difficult...
2007 May 06
1
[PATCH 1/3] lguest: 2.6.21-mm1 update: lguest-remove-unnecessary-gdt-load.patch
Andrew did a great job of merging in the PDA->percpu changes and lguest code for 2.6.21-mm1, but the load_gdt is now unnecessary. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/lguest/lguest.c | 4 ---- 1 file changed, 4 deletions(-) =================================================================== --- a/drivers/lguest/lguest.c +++ b/drivers/lguest/lguest.c @@
2007 May 06
1
[PATCH 1/3] lguest: 2.6.21-mm1 update: lguest-remove-unnecessary-gdt-load.patch
Andrew did a great job of merging in the PDA->percpu changes and lguest code for 2.6.21-mm1, but the load_gdt is now unnecessary. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/lguest/lguest.c | 4 ---- 1 file changed, 4 deletions(-) =================================================================== --- a/drivers/lguest/lguest.c +++ b/drivers/lguest/lguest.c @@
2007 Apr 18
1
[PATCH 0/2] Use a single loader for i386 and x86_64
...i, phdr[i].p_memsz, (void *)phdr[i].p_paddr); + /* We map everything private, writable. */ + if (phdr[i].p_paddr + phdr[i].p_memsz > mem) + errx(1, "Segment %i overlaps end of memory", i); + + /* We expect linear address space. */ + if (!*page_offset) + *page_offset = phdr[i].p_vaddr - phdr[i].p_paddr; + else if ((*page_offset != phdr[i].p_vaddr - phdr[i].p_paddr) && + phdr[i].p_vaddr != VSYSCALL_START) + errx(1, "Page offset of section %i different (got %lx, expected %lx)", + i, (phdr[i].p_vaddr - phdr[i].p_paddr), *page_offset); + + /* Recent l...
2007 Apr 18
1
[PATCH 0/2] Use a single loader for i386 and x86_64
...i, phdr[i].p_memsz, (void *)phdr[i].p_paddr); + /* We map everything private, writable. */ + if (phdr[i].p_paddr + phdr[i].p_memsz > mem) + errx(1, "Segment %i overlaps end of memory", i); + + /* We expect linear address space. */ + if (!*page_offset) + *page_offset = phdr[i].p_vaddr - phdr[i].p_paddr; + else if ((*page_offset != phdr[i].p_vaddr - phdr[i].p_paddr) && + phdr[i].p_vaddr != VSYSCALL_START) + errx(1, "Page offset of section %i different (got %lx, expected %lx)", + i, (phdr[i].p_vaddr - phdr[i].p_paddr), *page_offset); + + /* Recent l...
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
...ON(ehdr->e_ehsize < sizeof(*ehdr)); + ehdr->e_entry += new_base - old_base; + BUG_ON(ehdr->e_phentsize < sizeof(Elf32_Phdr)); + for (i = 0; i < ehdr->e_phnum; ++i) { + Elf32_Phdr *phdr = (void *)((unsigned long)ehdr + ehdr->e_phoff + i * ehdr->e_phentsize); + + phdr->p_vaddr += new_base - old_base; + switch(phdr->p_type) { + case PT_LOAD: + case PT_NOTE: + break; + case PT_DYNAMIC: { + Elf32_Dyn *dyn = (void *)(phdr->p_vaddr - new_base + (unsigned long)ehdr); + unsigned j; + + for(j = 0; dyn[j].d_tag != DT_NULL; ++j) { + switch(dyn[j].d_tag) {...
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
...ON(ehdr->e_ehsize < sizeof(*ehdr)); + ehdr->e_entry += new_base - old_base; + BUG_ON(ehdr->e_phentsize < sizeof(Elf32_Phdr)); + for (i = 0; i < ehdr->e_phnum; ++i) { + Elf32_Phdr *phdr = (void *)((unsigned long)ehdr + ehdr->e_phoff + i * ehdr->e_phentsize); + + phdr->p_vaddr += new_base - old_base; + switch(phdr->p_type) { + case PT_LOAD: + case PT_NOTE: + break; + case PT_DYNAMIC: { + Elf32_Dyn *dyn = (void *)(phdr->p_vaddr - new_base + (unsigned long)ehdr); + unsigned j; + + for(j = 0; dyn[j].d_tag != DT_NULL; ++j) { + switch(dyn[j].d_tag) {...
2007 Mar 05
7
[PATCH 2/10] linux 2.6.18: COMPAT_VDSO
...ON(ehdr->e_ehsize < sizeof(*ehdr)); + ehdr->e_entry += new_base - old_base; + BUG_ON(ehdr->e_phentsize < sizeof(Elf32_Phdr)); + for (i = 0; i < ehdr->e_phnum; ++i) { + Elf32_Phdr *phdr = (void *)((unsigned long)ehdr + ehdr->e_phoff + i * ehdr->e_phentsize); + + phdr->p_vaddr += new_base - old_base; + switch(phdr->p_type) { + case PT_LOAD: + case PT_NOTE: + break; + case PT_DYNAMIC: { + Elf32_Dyn *dyn = (void *)(phdr->p_vaddr - new_base + (unsigned long)ehdr); + unsigned j; + + for(j = 0; dyn[j].d_tag != DT_NULL; ++j) { + switch(dyn[j].d_tag) {...
2007 May 31
1
[patch rfc wip] first cut of ELF bzImage
...- phdr)/(e_phdr1 - phdr) # e_phnum + .word 40 # e_shentsize + .word 0 # e_shnum + .word 0 # e_shstrndx +e_ehdr: + + .org 71 +normalize: # Normalize the start address ljmp $BOOTSEG, $start2 + + .org 80 +phdr: + .int PT_LOAD # p_type + .int _text # p_offset + .int 0x8000 # p_vaddr + .int 0x8000 # p_paddr + .int _filesz # p_filesz + .int _memsz # p_memsz + .int PF_R | PF_W | PF_X # p_flags + .int 4 # p_align +e_phdr1: + .int PT_LOAD # p_type + .int kernel - bootsect_start # p_offset + .int LOAD_PHYSICAL_ADDR # p_vaddr + .int LOAD_PHYSICAL_ADDR...
2007 May 31
1
[patch rfc wip] first cut of ELF bzImage
...- phdr)/(e_phdr1 - phdr) # e_phnum + .word 40 # e_shentsize + .word 0 # e_shnum + .word 0 # e_shstrndx +e_ehdr: + + .org 71 +normalize: # Normalize the start address ljmp $BOOTSEG, $start2 + + .org 80 +phdr: + .int PT_LOAD # p_type + .int _text # p_offset + .int 0x8000 # p_vaddr + .int 0x8000 # p_paddr + .int _filesz # p_filesz + .int _memsz # p_memsz + .int PF_R | PF_W | PF_X # p_flags + .int 4 # p_align +e_phdr1: + .int PT_LOAD # p_type + .int kernel - bootsect_start # p_offset + .int LOAD_PHYSICAL_ADDR # p_vaddr + .int LOAD_PHYSICAL_ADDR...
2020 Aug 13
2
Adding sections in a binary
Hey, LLVM has logic to parse ELF and PE binaries using `llvm::object::createBinary`. I tried to search in the codebase to see if there's a possibility to add/remove sections after parsing a binary and re-write the binary to another location. Basically, like what llvm-objcopy does. Can you point me to the right classes to look into, if this is something that LLVM has? Many thanks Joseph
2012 Jul 05
10
[PATCH] kexec-tools: Read always one vmcoreinfo file
...UNC(struct kexec_info *info, dbgprintf_phdr("vmcoreinfo header", phdr); } - if (has_vmcoreinfo_xen) { - phdr = (PHDR *) bufp; - bufp += sizeof(PHDR); - phdr->p_type = PT_NOTE; - phdr->p_flags = 0; - phdr->p_offset = phdr->p_paddr = vmcoreinfo_addr_xen; - phdr->p_vaddr = 0; - phdr->p_filesz = phdr->p_memsz = vmcoreinfo_len_xen; - /* Do we need any alignment of segments? */ - phdr->p_align = 0; - - (elf->e_phnum)++; - dbgprintf_phdr("vmcoreinfo_xen header", phdr); - } - /* Setup an PT_LOAD type program header for the region where...
2007 Jun 06
7
[PATCH RFC 0/7] proposed updates to boot protocol and paravirt booting
This series: 1. Updates the boot protocol to version 2.07 2. Clean up the existing build process, to get rid of tools/build and make the linker do more heavy lifting 3. Make the bzImage payload an ELF file. The bootloader can extract this as a naked ELF file by skipping over boot_params.setup_sects worth of 16-bit setup code. 4. Update the boot_params to 2.07, and update the
2007 Jun 06
7
[PATCH RFC 0/7] proposed updates to boot protocol and paravirt booting
This series: 1. Updates the boot protocol to version 2.07 2. Clean up the existing build process, to get rid of tools/build and make the linker do more heavy lifting 3. Make the bzImage payload an ELF file. The bootloader can extract this as a naked ELF file by skipping over boot_params.setup_sects worth of 16-bit setup code. 4. Update the boot_params to 2.07, and update the
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 07/13] lguest64 loader
...i, phdr[i].p_memsz, (void *)phdr[i].p_paddr); + /* We map everything private, writable. */ + if (phdr[i].p_paddr + phdr[i].p_memsz > mem) + errx(1, "Segment %i overlaps end of memory", i); + + /* We expect linear address space. */ + if (!*page_offset) + *page_offset = phdr[i].p_vaddr - phdr[i].p_paddr; + else if (*page_offset != phdr[i].p_vaddr - phdr[i].p_paddr) + errx(1, "Page offset of section %i different", i); + + /* Recent ld versions don't page align any more. */ + if (phdr[i].p_paddr % getpagesize()) { + phdr[i].p_filesz += (phdr[i].p_paddr % getpag...
2007 Apr 18
0
[RFC/PATCH LGUEST X86_64 07/13] lguest64 loader
...i, phdr[i].p_memsz, (void *)phdr[i].p_paddr); + /* We map everything private, writable. */ + if (phdr[i].p_paddr + phdr[i].p_memsz > mem) + errx(1, "Segment %i overlaps end of memory", i); + + /* We expect linear address space. */ + if (!*page_offset) + *page_offset = phdr[i].p_vaddr - phdr[i].p_paddr; + else if (*page_offset != phdr[i].p_vaddr - phdr[i].p_paddr) + errx(1, "Page offset of section %i different", i); + + /* Recent ld versions don't page align any more. */ + if (phdr[i].p_paddr % getpagesize()) { + phdr[i].p_filesz += (phdr[i].p_paddr % getpag...