From 9e01a0be89f685e7f74392564ebdeaaf78359a50 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 16 Jun 2017 14:12:55 -0500 Subject: [PATCH] cpu/x86/smm: use macros for CR0 flags Use the existing macros for CR0 to set the flags in the SMM stub. Change-Id: I0f02fd6b0c14cee35ec33be2cac51057d18b82c0 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/20242 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/cpu/x86/smm/smm_stub.S | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S index d1fe7c1146..e1f6e5f9f2 100644 --- a/src/cpu/x86/smm/smm_stub.S +++ b/src/cpu/x86/smm/smm_stub.S @@ -23,6 +23,8 @@ * found in smm.h. */ +#include + .code32 .section ".module_parameters", "aw", @progbits stub_entry_params: @@ -53,6 +55,10 @@ fallback_stack_bottom: .skip 128 fallback_stack_top: +#define CR0_CLEAR_FLAGS \ + (CR0_CD | CR0_NW | CR0_PG | CR0_AM | CR0_WP | \ + CR0_NE | CR0_TS | CR0_EM | CR0_MP) + .text .code16 .global _start @@ -61,8 +67,8 @@ _start: data32 lgdt (%ebx) movl %cr0, %eax - andl $0x1FFAFFD1, %eax /* CD,NW,PG,AM,WP,NE,TS,EM,MP = 0 */ - orl $0x1, %eax /* PE = 1 */ + andl $~CR0_CLEAR_FLAGS, %eax + orl $CR0_PE, %eax movl %eax, %cr0 /* Enable protected mode */