From 408cec32f521bc4b2b10ac52746846d48f17fb9f Mon Sep 17 00:00:00 2001 From: Adrian-Ken Rueegsegger Date: Sat, 21 Feb 2015 01:24:00 +0100 Subject: [PATCH] base: Add errcode to x86_64 Cpu_state The new errcode field is used to store the error code that some interrupts provide (e.g. #PF). Rework mode transition reserved space and offset constants to match the new CPU_state layout. --- .../src/core/spec/x86_64/mode_transition.s | 13 +++--- repos/base/include/x86_64/cpu/cpu_state.h | 41 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/repos/base-hw/src/core/spec/x86_64/mode_transition.s b/repos/base-hw/src/core/spec/x86_64/mode_transition.s index 25c57e8a65..656123dab2 100644 --- a/repos/base-hw/src/core/spec/x86_64/mode_transition.s +++ b/repos/base-hw/src/core/spec/x86_64/mode_transition.s @@ -21,11 +21,12 @@ .set BUFFER_SIZE, 6 * 8 /* offsets of the member variables in a CPU context */ -.set SP_OFFSET, 1 * 8 -.set R8_OFFSET, 2 * 8 -.set RAX_OFFSET, 10 * 8 -.set FLAGS_OFFSET, 18 * 8 -.set CR3_OFFSET, 20 * 8 +.set SP_OFFSET, 1 * 8 +.set R8_OFFSET, 2 * 8 +.set RAX_OFFSET, 10 * 8 +.set ERRCODE_OFFSET, 17 * 8 +.set FLAGS_OFFSET, 18 * 8 +.set CR3_OFFSET, 21 * 8 .section .text @@ -48,7 +49,7 @@ _mt_master_context_begin: /* space must be at least as large as 'Cpu_state' */ - .space 21*8 + .space 22*8 .global _mt_master_context_end _mt_master_context_end: diff --git a/repos/base/include/x86_64/cpu/cpu_state.h b/repos/base/include/x86_64/cpu/cpu_state.h index 1b7eb9ef8d..abe1da2739 100644 --- a/repos/base/include/x86_64/cpu/cpu_state.h +++ b/repos/base/include/x86_64/cpu/cpu_state.h @@ -23,26 +23,27 @@ namespace Genode { struct Cpu_state; } struct Genode::Cpu_state { - addr_t ip = 0; - addr_t sp = 0; - addr_t r8 = 0; - addr_t r9 = 0; - addr_t r10 = 0; - addr_t r11 = 0; - addr_t r12 = 0; - addr_t r13 = 0; - addr_t r14 = 0; - addr_t r15 = 0; - addr_t rax = 0; - addr_t rbx = 0; - addr_t rcx = 0; - addr_t rdx = 0; - addr_t rdi = 0; - addr_t rsi = 0; - addr_t rbp = 0; - addr_t ss = 0; - addr_t eflags = 0; - addr_t trapno = 0; + addr_t ip = 0; + addr_t sp = 0; + addr_t r8 = 0; + addr_t r9 = 0; + addr_t r10 = 0; + addr_t r11 = 0; + addr_t r12 = 0; + addr_t r13 = 0; + addr_t r14 = 0; + addr_t r15 = 0; + addr_t rax = 0; + addr_t rbx = 0; + addr_t rcx = 0; + addr_t rdx = 0; + addr_t rdi = 0; + addr_t rsi = 0; + addr_t rbp = 0; + addr_t errcode = 0; + addr_t eflags = 0; + addr_t trapno = 0; + addr_t ss = 0; }; #endif /* _INCLUDE__X86_64__CPU__CPU_STATE_H_ */