Re: [PATCH 3/4 gnumach] xen: Fix elfnotes so xen attempts boot on both 32b and 64b

Damien Zammit <[email protected]> Fri, 10 Jul 2026 02:00:26 +0000
Newsgroups gmane.os.hurd.bugs
Message-ID <[email protected]>
Hi,

 From my limited understanding, the current functionality of booting xen 
relies on the old-style elfnote:
__xen_guest section.  When I remove the old style elf note so it tries 
the new style ones, it fails to boot.

hypcalls is an absolute address, not a page number, so the new style 
macro is already wrong.
I changed it to 0x2 so it matches the old booting elfnote.

Thanks,
Damien

On 10/7/26 8:00 am, Samuel Thibault wrote:
> Bradley Morgan, le sam. 04 juil. 2026 15:11:53 +0100, a ecrit:
>> On July 4, 2026 4:58:52 AM GMT+01:00, Damien Zammit <[email protected]>
>> wrote:
>>> Bump the version of gnumach xen, and also fix 64b booting.
>>> ---
>>> i386/xen/xen_boothdr.S |  6 +++---
>>> x86_64/xen_boothdr.S   | 11 ++++++-----
>>> 2 files changed, 9 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/i386/xen/xen_boothdr.S b/i386/xen/xen_boothdr.S
>>> index 4704c66f..6cc9e3d9 100644
>>> --- a/i386/xen/xen_boothdr.S
>>> +++ b/i386/xen/xen_boothdr.S
>>> @@ -20,7 +20,7 @@
>>>
>>> .section __xen_guest
>>> 	.ascii	"GUEST_OS=GNU Mach"
>>> -	.ascii  ",GUEST_VERSION=1.3"
>>> +	.ascii  ",GUEST_VERSION=1.8"
>>> 	.ascii	",XEN_VER=xen-3.0"
>>> 	.ascii  ",VIRT_BASE=0xC0000000"
>>> 	.ascii  ",ELF_PADDR_OFFSET=0xC0000000"
>>> @@ -61,12 +61,12 @@
>>> .popsection				;
>>>
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,		.asciz, "GNU Mach")
>>> -	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,		.asciz, "1.3")
>>> +	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,		.asciz, "1.8")
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,		.asciz, "xen-3.0")
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,		.long,  _START)
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,		.long,  _START)
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,			.long,  start)
>>> -	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE,	.long,  hypcalls)
>>> +	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE,	.long,  0x2)
>> Why? This could break boot if xen tries to write stubs to 0x2..
> Yes, I'm completely surprised by this.
>
> The XEN_ELFNOTE_HYPERCALL_PAGE macro happens to be 2, but that's just a
> convention. We are really supposed to tell the hypervisor which page we
> use for hypercall.
>
>>> #if PAE
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,		.asciz, "yes[extended-cr3]")
>>> #else
>>> diff --git a/x86_64/xen_boothdr.S b/x86_64/xen_boothdr.S
>>> index da40a5c0..0924aa20 100644
>>> --- a/x86_64/xen_boothdr.S
>>> +++ b/x86_64/xen_boothdr.S
>>> @@ -20,11 +20,12 @@
>>>
>>> .section __xen_guest
>>> 	.ascii	"GUEST_OS=GNU Mach"
>>> -	.ascii  ",GUEST_VERSION=1.3"
>>> +	.ascii  ",GUEST_VERSION=1.8"
>>> 	.ascii	",XEN_VER=xen-3.0"
>>> -	.ascii  ",VIRT_BASE=0x40000000"
>>> -	.ascii  ",ELF_PADDR_OFFSET=0x40000000"
>>> +	.ascii  ",VIRT_BASE=0xffffffff80000000"
>>> +	.ascii  ",ELF_PADDR_OFFSET=0xffffffff80000000"
>>> 	.ascii	",HYPERCALL_PAGE=0x2"
>>> +	.ascii	",ENTRY=0xffffffff80000000"
>>> 	.ascii	",LOADER=generic"
>>> #ifndef	MACH_PSEUDO_PHYS
>>> 	.ascii	",FEATURES=!auto_translated_physmap"
>>> @@ -51,12 +52,12 @@
>>> .popsection				;
>>>
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,		.asciz, "GNU Mach")
>>> -	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,		.asciz, "1.3")
>>> +	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,		.asciz, "1.8")
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,		.asciz, "xen-3.0")
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,		.quad,  _START)
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,		.quad,  _START)
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,			.quad,  start)
>>> -	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE,	.quad,  hypcalls)
>>> +	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE,	.quad,  0x2)
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,		.asciz, "generic")
>>> 	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,              .asciz, ""
>>> #ifndef MACH_PSEUDO_PHYS
>>>
>> Thanks!
>>