diff --git a/layout.ld b/layout.ld index be09730f..447e26b9 100644 --- a/layout.ld +++ b/layout.ld @@ -2,6 +2,7 @@ ENTRY(ram64_start) PHDRS { + notes PT_NOTE ; rodata PT_LOAD FILEHDR PHDRS ; data PT_LOAD ; text PT_LOAD ; @@ -23,6 +24,7 @@ SECTIONS . = ram_min; . += SIZEOF_HEADERS; + .notes : { *(.note .note.* .notes) } :rodata :notes .rodata : { *(.rodata .rodata.*) } :rodata .data : { *(.data .data.*) *(.bss .bss.*) } :data .text : { diff --git a/src/asm/notes.s b/src/asm/notes.s new file mode 100644 index 00000000..657e18bb --- /dev/null +++ b/src/asm/notes.s @@ -0,0 +1,20 @@ +.section .notes, "a" + +# From xen/include/public/elfnote.h, "Physical entry point into the kernel." +XEN_ELFNOTE_PHYS32_ENTRY = 18 + +# We don't bother defining an ELFNOTE macro, as we only have one note. +# This is equialent to the kernel's: +# ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY, .long ram32_start) +.align 4 + .long name_end - name_start # namesz + .long desc_end - desc_start # descsz + .long XEN_ELFNOTE_PHYS32_ENTRY # type +name_start: + .asciz "Xen" +name_end: +.align 4 +desc_start: + .long ram32_start +desc_end: +.align 4 diff --git a/src/main.rs b/src/main.rs index 9dec14d9..d56f96b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,8 @@ mod virtio; #[cfg(all(not(test), feature = "rom"))] global_asm!(include_str!("asm/rom.s")); #[cfg(not(test))] +global_asm!(include_str!("asm/notes.s")); +#[cfg(not(test))] global_asm!(include_str!("asm/ram32.s")); #[cfg(not(test))] global_asm!(include_str!("asm/ram64.s"));