qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Target map while loading elf binary


From: Boyapati, Anitha
Subject: [Qemu-devel] Target map while loading elf binary
Date: Mon, 16 Nov 2009 15:35:29 +0100

Can someone try with better explanation for offset calculation that is passed 
to target_mmap() ? More specifically, I am facing an "invalid argument" error 
while trying to load a simple elf binary. When debugged, it turned out that the 
check "if(offset & ~TARGET_PAGE_MASK)" throws this error - looks like because 
of some sort of disagreement over alignment.

The method is called from load_elf_binary() as:
target_mmap (start=0, len=3800, prot=5, flags=2066, fd=7, offset=1024).

The caller does some math that I don't understand.

//Partially preprocessed code
target_mmap(((load_bias + elf_ppnt->p_vaddr) & ~(unsigned 
long)(TARGET_PAGE_SIZE-1)),(elf_ppnt->p_filesz +                              
((elf_ppnt->p_vaddr) & (TARGET_PAGE_SIZE-1))), elf_prot,                        
    (0x10 | 0x02 | 0x00800),bprm->fd,
(elf_ppnt->p_offset -((elf_ppnt->p_vaddr) & (TARGET_PAGE_SIZE-1))));

Given that I am aware of elf32 structures, what I don't get is the significance 
of last parameter (offset - (v_addr & target_page_size -1)). In my case, 
TARGET_PAGE_SIZE is (1<<12)

Anitha




reply via email to

[Prev in Thread] Current Thread [Next in Thread]