[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxc/arm: Correctly handle the difference between virtual and physical address
On 12/10/2013 05:44 PM, Ian Campbell wrote: > On Tue, 2013-12-10 at 17:36 +0000, Julien Grall wrote: >> xc_dom_alloc_page deals with virtual address not physical address. When >> an ELF is loaded, virtual address and physical address may be different. > > Can you give an example of the program headers of an ELF file (readelf > -l) which causes this? How was it constructed? This is the beginning of readelf -l for a FreeBSD ARM binary: Elf file type is EXEC (Executable file) Entry point 0xc0100100 There are 5 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align EXIDX 0x2f6e54 0xc03f6e54 0xc03f6e54 0x0df90 0x0df90 R 0x4 PHDR 0x000034 0xc0100034 0xc0100034 0x000a0 0x000a0 R E 0x4 INTERP 0x2b67f0 0xc03b67f0 0xc03b67f0 0x0000d 0x0000d R 0x1 [Requesting program interpreter: /red/herring] LOAD 0x000000 0xc0100000 0xc0100000 0x32dadc 0x3538d8 RWE 0x8000 DYNAMIC 0x32da74 0xc042da74 0xc042da74 0x00068 0x00068 RW 0x4 FreeBSD will build the kernel with: - kernel physical address: 0x80100000 - kernel virtual address: 0xC0100000 And the ELF will be linked with the virtual address. > When we are building the guest the MMU is disabled so virt == phys. Right, but ELF loader is based on virtual address not physical address. Guest creation will fail when libxc is trying to allocate segment for the device tree (see xc_dom_alloc_segment). As it's allocate after the kernel, virt_alloc_end will contains a virtual address. But device tree address is generated with a physical address... Therefore, the function will fail with "segment start too low ...". > If the ELF has virt != phys then how do we know whether it expects to be > launched with the MMU on or off? We can only really launch with the MMU > off, so do we require that the initial ELF entry point be PIC and know > how to enable the MMU? This issue is when as virt == phys, build ELF with virt != phys is very difficult. I took a couple of hours without any success. In any case, FreeBSD is building its ELF with virt = phys. When the guest is creating, the ELF should loaded like zImage at the specific physical address. Then the guest will start will MMU turn off, and during the first instructions it will use fixup to get the right address. -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |