kconfig: decouple realmode boot from CONFIG_JAIHOUSE

Add CONFIG_REALMODE item so that it's possible to configure other
x86 boards to boot from real mode.

Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
Zide Chen 2018-07-23 15:58:56 -07:00 committed by Andrew Boie
commit 98775f34c3
3 changed files with 17 additions and 7 deletions

View file

@ -42,10 +42,10 @@
GTEXT(_sys_soc_resume_from_deep_sleep) GTEXT(_sys_soc_resume_from_deep_sleep)
#endif #endif
#ifdef CONFIG_JAILHOUSE #ifdef CONFIG_REALMODE
#define JAILHOUSE_INMATE_CS32 0x8 #define RM_CODE_SEG 0x8
#define JAILHOUSE_INMATE_DS32 0x18 #define RM_DATA_SEG 0x18
#define MSR_MTRR_DEF_TYPE 0x000002ff #define MSR_MTRR_DEF_TYPE 0x000002ff
#define MTRR_ENABLE 0x00000800 #define MTRR_ENABLE 0x00000800
#define X86_CR0_PE 0x00000001 #define X86_CR0_PE 0x00000001
@ -63,7 +63,7 @@ __jh_entry:
or $X86_CR0_PE,%al or $X86_CR0_PE,%al
mov %eax,%cr0 mov %eax,%cr0
ljmpl $JAILHOUSE_INMATE_CS32,$start32 ljmpl $RM_CODE_SEG,$start32
.code32 .code32
start32: start32:
@ -86,12 +86,12 @@ start32:
or $MTRR_ENABLE,%eax or $MTRR_ENABLE,%eax
wrmsr wrmsr
mov $JAILHOUSE_INMATE_DS32,%eax mov $RM_DATA_SEG,%eax
mov %eax,%ds mov %eax,%ds
mov %eax,%es mov %eax,%es
mov %eax,%ss mov %eax,%ss
ljmp $JAILHOUSE_INMATE_CS32, $__start ljmp $RM_CODE_SEG, $__start
.global loader_gdt .global loader_gdt
loader_gdt: loader_gdt:
@ -132,7 +132,7 @@ gdt_ptr:
.align(4096) .align(4096)
.popsection .popsection
#endif /* CONFIG_JAILHOUSE */ #endif /* CONFIG_REALMODE */
/* processor is executing in 32-bit protected mode */ /* processor is executing in 32-bit protected mode */

View file

@ -20,3 +20,4 @@ CONFIG_X86_MMU=y
CONFIG_HW_STACK_PROTECTION=y CONFIG_HW_STACK_PROTECTION=y
CONFIG_USERSPACE=y CONFIG_USERSPACE=y
CONFIG_X86_PAE_MODE=y CONFIG_X86_PAE_MODE=y
CONFIG_REALMODE=y

View file

@ -355,6 +355,15 @@ config BOOTLOADER_ESP_IDF
inside the build folder. inside the build folder.
At flash time, the bootloader will be flashed with the zephyr image At flash time, the bootloader will be flashed with the zephyr image
config REALMODE
bool
prompt "boot from x86 real mode"
default n
depends on X86
help
This option enabled Zephyr to start in x86 real mode, instead of
protected mode.
config BOOTLOADER_KEXEC config BOOTLOADER_KEXEC
bool bool
prompt "Boot using Linux kexec() system call" prompt "Boot using Linux kexec() system call"