Skip to content

Commit f6e4ab2

Browse files
Fix-Pointxiaoxiang781216
authored andcommitted
arch/x86_64: Support QEMU PVH ELF loader
Enabling CONFIG_ARCH_CHIP_INTEL64_PVH_BOOT will allow nuttx.elf loaded by QEMU -kernel parameter. Signed-off-by: ouyangxiangzhen <[email protected]>
1 parent dc92dee commit f6e4ab2

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

arch/x86_64/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,10 @@ config MULTBOOT2_FB_TERM
124124

125125
endif # ARCH_MULTIBOOT2
126126

127+
config ARCH_PVHBOOT
128+
bool "Append Xen PVH ELF Note"
129+
default y
130+
---help---
131+
This allow x86 QEMU -kernel boot.
132+
127133
endif # ARCH_X86_64

arch/x86_64/src/intel64/intel64_head.S

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ loader_gdt_ptr:
164164

165165
.size __reset_entry, . - __reset_entry
166166

167-
bsp_done:
168-
.long 0
169-
170167
#ifdef CONFIG_SMP
171168
/****************************************************************************
172169
* Name: __ap_entry
@@ -477,6 +474,9 @@ __enable_pcid:
477474

478475
.section ".loader.data", "ax"
479476

477+
bsp_done:
478+
.long 0
479+
480480
/* TSS (IST) for 64 bit long mode will be filled in up_irq. */
481481
.align(16)
482482
g_ist64_low:
@@ -539,3 +539,17 @@ g_pt_low:
539539
.fill X86_NUM_PAGE_ENTRY * X86_NUM_PAGE_ENTRY, X86_PAGE_ENTRY_SIZE, 0
540540
.fill X86_NUM_PAGE_ENTRY * X86_NUM_PAGE_ENTRY, X86_PAGE_ENTRY_SIZE, 0
541541
.fill X86_NUM_PAGE_ENTRY * X86_NUM_PAGE_ENTRY, X86_PAGE_ENTRY_SIZE, 0
542+
543+
#ifdef CONFIG_ARCH_PVHBOOT
544+
/* PVH Header with pvh_start_addr = start32 */
545+
.pushsection .note.nuttx, "a", @note
546+
.align 4
547+
.long 2f - 1f
548+
.long 4f - 3f
549+
.long 18
550+
1:.asciz "nuttx"
551+
2:.align 4
552+
3:.long start32
553+
4:.align 4
554+
.popsection
555+
#endif

0 commit comments

Comments
 (0)