2006-03-22 06:38:35

by Chris Wright

[permalink] [raw]
Subject: [RFC PATCH 07/35] Make LOAD_OFFSET defined by subarch

Change LOAD_OFFSET so that the kernel has virtual addresses in the elf header fields.

Unlike bare metal kernels, Xen kernels start with virtual address
management turned on and thus the addresses to load to should be
virtual addresses.

Signed-off-by: Ian Pratt <[email protected]>
Signed-off-by: Christian Limpach <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
---
arch/i386/kernel/vmlinux.lds.S | 2 +-
include/asm-i386/mach-default/mach_vmlinux.lds.h | 6 ++++++
include/asm-i386/mach-xen/mach_vmlinux.lds.h | 6 ++++++
3 files changed, 13 insertions(+), 1 deletion(-)

--- xen-subarch-2.6.orig/arch/i386/kernel/vmlinux.lds.S
+++ xen-subarch-2.6/arch/i386/kernel/vmlinux.lds.S
@@ -2,7 +2,7 @@
* Written by Martin Mares <[email protected]>;
*/

-#define LOAD_OFFSET __PAGE_OFFSET
+#include "mach_vmlinux.lds.h"

#include <asm-generic/vmlinux.lds.h>
#include <asm/thread_info.h>
--- /dev/null
+++ xen-subarch-2.6/include/asm-i386/mach-default/mach_vmlinux.lds.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_MACH_VMLINUX_LDS_H
+#define __ASM_MACH_VMLINUX_LDS_H
+
+#define LOAD_OFFSET __PAGE_OFFSET
+
+#endif /* __ASM_MACH_VMLINUX_LDS_H */
--- /dev/null
+++ xen-subarch-2.6/include/asm-i386/mach-xen/mach_vmlinux.lds.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_MACH_VMLINUX_LDS_H
+#define __ASM_MACH_VMLINUX_LDS_H
+
+#define LOAD_OFFSET 0
+
+#endif /* __ASM_MACH_VMLINUX_LDS_H */

--


2006-03-22 22:57:55

by Dan Hecht

[permalink] [raw]
Subject: Re: [RFC PATCH 07/35] Make LOAD_OFFSET defined by subarch

Chris Wright wrote:
> Change LOAD_OFFSET so that the kernel has virtual addresses in the elf header fields.
>
> Unlike bare metal kernels, Xen kernels start with virtual address
> management turned on and thus the addresses to load to should be
> virtual addresses.
>

Rather than changing LOAD_OFFSET in Linux, why not leave this alone and
change the Xen domain builder to properly interpret the ELF program
header fields?

i.e. with this change, we'd have

p_paddr = __PAGE_OFFSET + segment_offset
p_vaddr = __PAGE_OFFSET + segment_offset
VIRT_BASE = __PAGE_OFFSET

where, the VA mapping p_paddr -> (p_paddr-VIRT_BASE) is established by
the domain builder.

Instead, why not drop this patch, and the VIRT_BASE portion of the
__xen_guest section, and instead change Xen's domain builder to treat
p_paddr and p_vaddr in a more standard way? Since Xen starts the domain
with virtual address management enabled, it makes sense for it to use
p_vaddr to determine the virtual address to load the kernel to. Then,
p_paddr could be used to determine which pseudo-physical pages back that
virtual address range.

i.e. use, just like vanilla linux:

p_paddr = segment_offset
p_vaddr = __PAGE_OFFSET + segment_offset

so these two fields directly indicate the same mapping as before, but
now in terms of p_vaddr -> p_paddr, which makes sense, and no need for
the extra VIRT_BASE attribute in the __xen_guest section.

Dan

2006-03-27 08:16:49

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [RFC PATCH 07/35] Make LOAD_OFFSET defined by subarch

Hi,

> Rather than changing LOAD_OFFSET in Linux, why not leave this alone and
> change the Xen domain builder to properly interpret the ELF program
> header fields?

I've a patch in the queue which does exactly that ;)
Planned to submit just after xen 3.0.2 release ...

cheers,

Gerd

--
Gerd 'just married' Hoffmann <[email protected]>
I'm the hacker formerly known as Gerd Knorr.
http://www.suse.de/~kraxel/just-married.jpeg