[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH 11/11] kernel2: TSS-Struktur für arch/amd64



Signed-off-by: Andreas Freimuth <m.nemo@xxxxxxx>

--HG--
extra : rebase_source : 38132ff76acfe94f67c9df56b85c375e7a995d66
---
 src/kernel2/include/arch/amd64/cpu.h |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/kernel2/include/arch/amd64/cpu.h b/src/kernel2/include/arch/amd64/cpu.h
index 67fb194..1ffe971 100644
--- a/src/kernel2/include/arch/amd64/cpu.h
+++ b/src/kernel2/include/arch/amd64/cpu.h
@@ -42,12 +42,6 @@
 typedef uint8_t cpu_id_t;
 
 typedef struct {
-    cpu_id_t id;
-    uint8_t apic_id;
-    bool bootstrap;
-} cpu_t;
-
-typedef struct {
     uint64_t bx;
     uint64_t cx;
     uint64_t dx;
@@ -74,6 +68,28 @@ typedef struct {
 
 typedef interrupt_stack_frame_t machine_state_t;
 
+/// Task state segment
+typedef struct {
+	uint32_t : 32;
+	uint64_t sp0, sp1, sp2;
+	uint64_t : 64;
+	uint64_t ist[7];
+	uint64_t : 64;
+	uint16_t : 16;
+	uint16_t io_bit_map_offset;
+} __attribute__((packed)) cpu_tss_t;
+
+// Dieser Wert muss ausserhalb des in der GDT definierten Limits
+// fuer das TSS liegen
+#define TSS_IO_BITMAP_NOT_LOADED UINT16_MAX
+
+typedef struct {
+    cpu_id_t id;
+    uint8_t apic_id;
+    bool bootstrap;
+    cpu_tss_t tss;
+} cpu_t;
+
 extern cpu_t cpus[];
 extern size_t cpu_count;
 extern cpu_id_t cpu_id_bootstrap;
-- 
1.7.3.4