summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2018-04-21 00:10:10 -0600
committerAaron Durbin <adurbin@chromium.org>2018-04-26 15:18:41 +0000
commitaae73d763e4119b9881643de7fc782aade16dd30 (patch)
treecc767b51ddf90001a960b7bc26295f40b065366b /src
parent4b032e457f1377fc06d12214b0450eae48653565 (diff)
downloadcoreboot-aae73d763e4119b9881643de7fc782aade16dd30.tar.xz
arch/x86: print cr2 value on every exception
Even though most x86 systems don't run with paging on, it's helpful to always print it out for the ones that do without making a more complicated handler. New dump will look like the following: Unexpected Exception: 6 @ 10:7ab84be2 - Halting Code: 0 eflags: 00010006 cr2: 00000000 eax: 7abb80ec ebx: deadbeef ecx: 00000000 edx: 00000002 edi: 7abb3000 esi: 00000004 ebp: 7abb2fd8 esp: 7abb2fb0 7ab84ba0: 00 01 00 83 ec 0c 6a 39 7ab84ba8: e8 8a 02 01 00 e8 e1 08 7ab84bb0: 00 00 e8 4e 3d 00 00 59 7ab84bb8: 5b 52 50 e8 f5 3c 00 00 7ab84bc0: c7 04 24 0a 00 00 00 e8 7ab84bc8: 3c 3d 00 00 c7 04 24 80 7ab84bd0: 00 00 00 e8 5f 02 01 00 7ab84bd8: e8 1e 38 01 00 e8 7e 50 7ab84be0: 01 00 0f 0b bb 98 ec ba 7ab84be8: 7a 83 c4 10 8b 03 85 c0 7ab84bf0: 0f 84 be 00 00 00 83 78 7ab84bf8: 04 00 8d 50 08 75 0c 56 7ab84c00: 56 ff 30 52 e8 f8 fe ff 7ab84c08: ff eb 0a 51 51 ff 30 52 7ab84c10: e8 2e ff ff ff 83 c4 10 7ab84c18: 83 c3 04 eb cf 89 d8 e8 BUG=b:72728953 Change-Id: I0e87bbe776f77623ad8297f5d80167998daec6ed Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/25762 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/exception.c5
-rw-r--r--src/include/cpu/x86/cr.h12
2 files changed, 15 insertions, 2 deletions
diff --git a/src/arch/x86/exception.c b/src/arch/x86/exception.c
index 5a5dfd2831..c89371ee7f 100644
--- a/src/arch/x86/exception.c
+++ b/src/arch/x86/exception.c
@@ -17,6 +17,7 @@
#include <compiler.h>
#include <console/console.h>
#include <console/streams.h>
+#include <cpu/x86/cr.h>
#include <rules.h>
#include <stdint.h>
#include <string.h>
@@ -503,11 +504,11 @@ void x86_exception(struct eregs *info)
#define MDUMP_SIZE 0x80
printk(BIOS_EMERG,
"Unexpected Exception: %d @ %02x:%08x - Halting\n"
- "Code: %d eflags: %08x\n"
+ "Code: %d eflags: %08x cr2: %08x\n"
"eax: %08x ebx: %08x ecx: %08x edx: %08x\n"
"edi: %08x esi: %08x ebp: %08x esp: %08x\n",
info->vector, info->cs, info->eip,
- info->error_code, info->eflags,
+ info->error_code, info->eflags, read_cr2(),
info->eax, info->ebx, info->ecx, info->edx,
info->edi, info->esi, info->ebp, info->esp);
u8 *code = (u8 *)((uintptr_t)info->eip - (MDUMP_SIZE >> 1));
diff --git a/src/include/cpu/x86/cr.h b/src/include/cpu/x86/cr.h
index 9eb94022f5..5183c77f89 100644
--- a/src/include/cpu/x86/cr.h
+++ b/src/include/cpu/x86/cr.h
@@ -59,6 +59,18 @@ static alwaysinline void write_cr0(CRx_TYPE data)
);
}
+static alwaysinline CRx_TYPE read_cr2(void)
+{
+ CRx_TYPE value;
+ __asm__ __volatile__ (
+ "mov %%cr2, %0"
+ : CRx_RET(value)
+ :
+ : COMPILER_BARRIER
+ );
+ return value;
+}
+
static alwaysinline CRx_TYPE read_cr3(void)
{
CRx_TYPE value;