boards/x86: add Intel64 (64-bit long-mode) QEMU target board
Add qemu_x86_long board (with CONFIG_X86_LONGMODE=y) for testing. This requires adding support to soc/ia32 for long mode (trivial), and adding a quick 64- to 32-bit ELF conversion before invoking QEMU, which apparently doesn't like 64-bit kernel files. Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
parent
6244676a51
commit
640c5a5e95
8 changed files with 75 additions and 3 deletions
|
@ -6,3 +6,9 @@ config BOARD_QEMU_X86
|
|||
select QEMU_TARGET
|
||||
select CPU_HAS_FPU
|
||||
select HAS_COVERAGE_SUPPORT
|
||||
|
||||
config BOARD_QEMU_X86_LONG
|
||||
bool "QEMU x86 (64-bit long mode)"
|
||||
depends on SOC_IA32
|
||||
select QEMU_TARGET
|
||||
select X86_LONGMODE
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
if BOARD_QEMU_X86
|
||||
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
default n
|
||||
|
||||
|
@ -17,3 +16,10 @@ config FLASH_SIMULATOR
|
|||
endif
|
||||
|
||||
endif # BOARD_QEMU_X86
|
||||
|
||||
if BOARD_QEMU_X86_LONG
|
||||
|
||||
config BOARD
|
||||
default "qemu_x86_long"
|
||||
|
||||
endif # BOARD_QEMU_X86_LONG
|
||||
|
|
|
@ -6,7 +6,13 @@ if(NOT CONFIG_REBOOT)
|
|||
set(REBOOT_FLAG -no-reboot)
|
||||
endif()
|
||||
|
||||
set(QEMU_CPU_TYPE_${ARCH} qemu32,+nx,+pae)
|
||||
if(CONFIG_X86_LONGMODE)
|
||||
set(QEMU_binary_suffix x86_64)
|
||||
set(QEMU_CPU_TYPE_${ARCH} qemu64,+x2apic)
|
||||
else()
|
||||
set(QEMU_CPU_TYPE_${ARCH} qemu32,+nx,+pae)
|
||||
endif()
|
||||
|
||||
set(QEMU_FLAGS_${ARCH}
|
||||
-m 9
|
||||
-cpu ${QEMU_CPU_TYPE_${ARCH}}
|
||||
|
|
10
boards/x86/qemu_x86/qemu_x86_long.dts
Normal file
10
boards/x86/qemu_x86/qemu_x86_long.dts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Intel Corp.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "qemu_x86.dts"
|
||||
|
||||
&flash0 {
|
||||
reg = <0x00100000 DT_FLASH_SIZE>;
|
||||
};
|
13
boards/x86/qemu_x86/qemu_x86_long.yaml
Normal file
13
boards/x86/qemu_x86/qemu_x86_long.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
identifier: qemu_x86_long
|
||||
name: QEMU Emulation for X86 (long mode)
|
||||
type: qemu
|
||||
arch: x86
|
||||
toolchain:
|
||||
- zephyr
|
||||
- xtools
|
||||
simulation: qemu
|
||||
testing:
|
||||
default: true
|
||||
ignore_tags:
|
||||
- net
|
||||
- bluetooth
|
17
boards/x86/qemu_x86/qemu_x86_long_defconfig
Normal file
17
boards/x86/qemu_x86/qemu_x86_long_defconfig
Normal file
|
@ -0,0 +1,17 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
CONFIG_X86=y
|
||||
CONFIG_SOC_IA32=y
|
||||
CONFIG_BOARD_QEMU_X86_LONG=y
|
||||
CONFIG_CPU_MINUTEIA=y
|
||||
CONFIG_HPET_TIMER=y
|
||||
CONFIG_HPET_TIMER_IRQ=2
|
||||
CONFIG_PIC_DISABLE=y
|
||||
CONFIG_LOAPIC=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_UART_NS16550=y
|
||||
CONFIG_UART_CONSOLE=y
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=25000000
|
||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_DEBUG_INFO=y
|
|
@ -233,6 +233,17 @@ elseif(QEMU_NET_STACK)
|
|||
endif()
|
||||
endif(QEMU_PIPE_STACK)
|
||||
|
||||
if(CONFIG_X86_LONGMODE)
|
||||
# QEMU doesn't like 64-bit ELF files. Since we don't use any >4GB
|
||||
# addresses, converting it to 32-bit is safe enough for emulation.
|
||||
list(APPEND PRE_QEMU_COMMANDS
|
||||
COMMAND
|
||||
${CMAKE_OBJCOPY}
|
||||
-O elf32-i386
|
||||
$<TARGET_FILE:${logical_target_for_zephyr_elf}>
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CONFIG_X86_64)
|
||||
set(QEMU_KERNEL_FILE "${CMAKE_BINARY_DIR}/zephyr-qemu.elf")
|
||||
endif()
|
||||
|
|
|
@ -45,5 +45,8 @@ MEMORY
|
|||
IDT_LIST : ORIGIN = 0xFFFF1000, LENGTH = 2K
|
||||
}
|
||||
|
||||
#ifdef CONFIG_X86_LONGMODE
|
||||
#include <arch/x86/intel64/linker.ld>
|
||||
#else
|
||||
#include <arch/x86/ia32/linker.ld>
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue