What do you think about this change to use the p_paddr (physical address)
instead of p_vaddr (virtual address) field in the ELF program header?
Setting p_paddr is the obvious thing to do, and the thing made easy to do
by ld, for a multiboot ELF kernel that uses non-direct virtual to physical
mapping memory mapping (as e.g. newer linux kernels do).  (Obviously the
kernel has to deal with being loaded at the requested physical address with
paging off, and is responsible itself for setting up its virtual mapping.)


1999-10-16  Roland McGrath  <[EMAIL PROTECTED]>

        * stage2/boot.c (load_image): If p_paddr is nonzero, use it instead
        of p_vaddr as physical load address.

Index: boot.c
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/stage2/boot.c,v
retrieving revision 1.3
diff -u -b -p -r1.3 boot.c
--- boot.c      1999/07/13 15:46:26     1.3
+++ boot.c      1999/10/16 05:21:53
@@ -403,7 +403,8 @@ load_image (void)
              /* offset into file */
              filepos = phdr->p_offset;
              filesiz = phdr->p_filesz;
-             memaddr = RAW_ADDR (phdr->p_vaddr);
+             memaddr = RAW_ADDR (phdr->p_paddr != 0
+                                 ? phdr->p_paddr : phdr->p_vaddr);
              memsiz = phdr->p_memsz;
              if (memaddr < RAW_ADDR (0x100000))
                errnum = ERR_BELOW_1MB;

Reply via email to