From d8a10448bb6253809396f95b2768700d550a20b6 Mon Sep 17 00:00:00 2001 From: Reto Buerki Date: Tue, 24 Feb 2015 15:43:10 +0100 Subject: [PATCH] hw_x86_64: Make Idt member functions non-static Add appropriate Idt object to Genode::Cpu class. Update the hard-coded TSS base address. --- repos/base-hw/src/core/include/spec/x86/cpu.h | 7 +++++-- repos/base-hw/src/core/include/spec/x86_64/idt.h | 6 +++--- repos/base-hw/src/core/spec/x86_64/idt.cc | 4 +--- repos/base-hw/src/core/spec/x86_64/kernel/crt0.s | 2 +- 4 files changed, 10 insertions(+), 9 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 eeb39ba02..230da4302 100644 --- a/repos/base-hw/src/core/include/spec/x86/cpu.h +++ b/repos/base-hw/src/core/include/spec/x86/cpu.h @@ -37,17 +37,20 @@ namespace Kernel { using Genode::Cpu_lazy_state; } class Genode::Cpu { + private: + Idt _idt; + public: Cpu() { /* Setup IDT only once */ if (primary_id() == executing_id()) { - Idt::setup(); + _idt.setup(); Tss::setup(); } - Idt::load(); + _idt.load(); Tss::load(); } diff --git a/repos/base-hw/src/core/include/spec/x86_64/idt.h b/repos/base-hw/src/core/include/spec/x86_64/idt.h index f076e280b..7c51ac4d3 100644 --- a/repos/base-hw/src/core/include/spec/x86_64/idt.h +++ b/repos/base-hw/src/core/include/spec/x86_64/idt.h @@ -37,19 +37,19 @@ class Genode::Idt /** * IDT table */ - static gate _table[]; + __attribute__((aligned(8))) gate _table[SIZE_IDT]; public: /** * Setup IDT. */ - static void setup(); + void setup(); /** * Load IDT into IDTR. */ - static void load(); + void load(); }; #endif /* _IDT_H_ */ diff --git a/repos/base-hw/src/core/spec/x86_64/idt.cc b/repos/base-hw/src/core/spec/x86_64/idt.cc index c9f46b44c..4f3cf52f8 100644 --- a/repos/base-hw/src/core/spec/x86_64/idt.cc +++ b/repos/base-hw/src/core/spec/x86_64/idt.cc @@ -12,8 +12,6 @@ class Descriptor Descriptor(uint16_t l, uint64_t b) : _limit(l), _base (b) {}; } __attribute__((packed)); -__attribute__((aligned(8))) Idt::gate Idt::_table[SIZE_IDT]; - void Idt::setup() { @@ -38,6 +36,6 @@ void Idt::setup() void Idt::load() { - asm volatile ("lidt %0" : : "m" (Descriptor (sizeof (_table) - 1, + asm volatile ("lidt %0" : : "m" (Descriptor (sizeof(_table) - 1, reinterpret_cast(_table)))); } diff --git a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s index a06028492..dc63dc27b 100644 --- a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s +++ b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s @@ -170,7 +170,7 @@ /* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */ .long 0x20f300 /* Task segment descriptor */ - .long 0x11000068 + .long 0x01000068 /* GDTE_PRESENT | GDTE_SYS_TSS */ .long 0x893a .long 0