From 9c44d32dd97a4b9b3d614171ace4a1522f44458d Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Fri, 27 Feb 2015 11:47:26 +0100 Subject: [PATCH] hw_x86_64: Add virt_base paramater to Tss::setup function The stack pointers (RSP) for privilege levels 0-2 must be setup using an address in the mtc region to make stack switching work for non-core threads. --- repos/base-hw/src/core/include/spec/x86/cpu.h | 2 +- repos/base-hw/src/core/include/spec/x86_64/tss.h | 4 +++- repos/base-hw/src/core/spec/x86_64/tss.cc | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/repos/base-hw/src/core/include/spec/x86/cpu.h b/repos/base-hw/src/core/include/spec/x86/cpu.h index 28d5a2061..3ab736fc1 100644 --- a/repos/base-hw/src/core/include/spec/x86/cpu.h +++ b/repos/base-hw/src/core/include/spec/x86/cpu.h @@ -58,7 +58,7 @@ class Genode::Cpu _tss->load(); } _idt->load(Cpu::exception_entry); - _tss->setup(); + _tss->setup(Cpu::exception_entry); } static constexpr addr_t exception_entry = 0x0; /* XXX */ diff --git a/repos/base-hw/src/core/include/spec/x86_64/tss.h b/repos/base-hw/src/core/include/spec/x86_64/tss.h index 48818fe92..813131047 100644 --- a/repos/base-hw/src/core/include/spec/x86_64/tss.h +++ b/repos/base-hw/src/core/include/spec/x86_64/tss.h @@ -35,8 +35,10 @@ class Genode::Tss /** * Setup TSS. + * + * \param virt_base virtual base address of mode transition pages */ - void setup(); + void setup(addr_t const virt_base); /** * Load TSS into TR. diff --git a/repos/base-hw/src/core/spec/x86_64/tss.cc b/repos/base-hw/src/core/spec/x86_64/tss.cc index bba9ca145..6fed6e7a0 100644 --- a/repos/base-hw/src/core/spec/x86_64/tss.cc +++ b/repos/base-hw/src/core/spec/x86_64/tss.cc @@ -4,7 +4,7 @@ using namespace Genode; extern char kernel_stack[]; -void Tss::setup() +void Tss::setup(addr_t const virt_base) { this->rsp0 = (addr_t)kernel_stack; this->rsp1 = (addr_t)kernel_stack;