hw_x86_64: Create Tss instance in mtc region

Use the _mt_tss label and the placement new operator to create the
Tss class instance in the mtc region. Update the hard-coded
TSS base address to use the virtual mtc address.
This commit is contained in:
Reto Buerki 2015-02-27 09:38:24 +01:00 committed by Christian Helmuth
parent b9fe4a8d48
commit 00921e4a5c
2 changed files with 8 additions and 6 deletions

View File

@ -22,6 +22,7 @@
#include <tss.h> #include <tss.h>
extern int _mt_idt; extern int _mt_idt;
extern int _mt_tss;
namespace Genode namespace Genode
{ {
@ -42,20 +43,21 @@ class Genode::Cpu
{ {
private: private:
Idt *_idt; Idt *_idt;
Tss _tss; Tss *_tss;
public: public:
Cpu() Cpu()
{ {
/* Setup IDT only once */
if (primary_id() == executing_id()) { if (primary_id() == executing_id()) {
_idt = new (&_mt_idt) Idt(); _idt = new (&_mt_idt) Idt();
_idt->setup(); _idt->setup();
_tss.load();
_tss = new (&_mt_tss) Tss();
_tss->load();
} }
_idt->load(Cpu::exception_entry); _idt->load(Cpu::exception_entry);
_tss.setup(); _tss->setup();
} }
static constexpr addr_t exception_entry = 0x0; /* XXX */ static constexpr addr_t exception_entry = 0x0; /* XXX */

View File

@ -291,9 +291,9 @@
/* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */ /* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */
.long 0x20f300 .long 0x20f300
/* Task segment descriptor */ /* Task segment descriptor */
.long 0x35b10068 .long 0x1e000068
/* GDTE_PRESENT | GDTE_SYS_TSS */ /* GDTE_PRESENT | GDTE_SYS_TSS */
.long 0x8929 .long 0x8900
.long 0 .long 0
.long 0 .long 0
_gdt_end: _gdt_end: