Skip to content
Snippets Groups Projects
Commit f77a8c32 authored by Pekka Enberg's avatar Pekka Enberg
Browse files

x64: Use constants for CR0 and CR4 values


Replace magic numbers with constants for CR0 and CR4 control register
values in arch/x86/boot.S.

Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 67703fb4
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
# This work is open source software, licensed under the terms of the
# BSD license as described in the LICENSE file in the top-level directory.
#include "processor-flags.h"
.text
.code32
......@@ -52,6 +53,18 @@ interrupt_stack_top = .
.text
#define BOOT_CR0 ( X86_CR0_PE \
| X86_CR0_WP \
| X86_CR0_PG )
#define BOOT_CR4 ( X86_CR4_DE \
| X86_CR4_PSE \
| X86_CR4_PAE \
| X86_CR4_PGE \
| X86_CR4_PCE \
| X86_CR4_OSFXSR \
| X86_CR4_OSXMMEXCPT )
.globl start32
start32:
mov %eax, %ebp
......@@ -65,7 +78,7 @@ start32:
ljmp $0x18, $1f
1:
and $~7, %esp
mov $0x000007b8, %eax
mov $BOOT_CR4, %eax
mov %eax, %cr4
lea ident_pt_l4, %eax
mov %eax, %cr3
......@@ -73,7 +86,7 @@ start32:
mov $0x00000900, %eax
xor %edx, %edx
wrmsr
mov $0x80010001, %eax
mov $BOOT_CR0, %eax
mov %eax, %cr0
ljmpl $8, $start64
.code64
......
#ifndef OSV_X64_PROCESSOR_FLAGS_H
#define OSV_X64_PROCESSOR_FLAGS_H
#define X86_CR0_PE (1 << 0)
#define X86_CR0_MP (1 << 1)
#define X86_CR0_EM (1 << 2)
#define X86_CR0_TS (1 << 3)
#define X86_CR0_ET (1 << 4)
#define X86_CR0_NE (1 << 5)
#define X86_CR0_WP (1 << 16)
#define X86_CR0_AM (1 << 18)
#define X86_CR0_NW (1 << 29)
#define X86_CR0_CD (1 << 30)
#define X86_CR0_PG (1 << 31)
#define X86_CR4_VME (1 << 0)
#define X86_CR4_PVI (1 << 1)
#define X86_CR4_TSD (1 << 2)
#define X86_CR4_DE (1 << 3)
#define X86_CR4_PSE (1 << 4)
#define X86_CR4_PAE (1 << 5)
#define X86_CR4_MCE (1 << 6)
#define X86_CR4_PGE (1 << 7)
#define X86_CR4_PCE (1 << 8)
#define X86_CR4_OSFXSR (1 << 9)
#define X86_CR4_OSXMMEXCPT (1 << 10)
#define X86_CR4_VMXE (1 << 13)
#define X86_CR4_SMXE (1 << 14)
#define X86_CR4_FSGSBASE (1 << 16)
#define X86_CR4_PCIDE (1 << 17)
#define X86_CR4_OSXSAVE (1 << 18)
#define X86_CR4_SMEP (1 << 20)
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment