NOVA
Stripped down NOVA kernel for the OSY course
Loading...
Searching...
No Matches
tss.h
1/*
2 * Task State Segment (TSS)
3 *
4 * Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
5 * Economic rights: Technische Universitaet Dresden (Germany)
6 *
7 * This file is part of the NOVA microhypervisor.
8 *
9 * NOVA is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * NOVA is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License version 2 for more details.
17 */
18
19#pragma once
20
21#include "compiler.h"
22#include "selectors.h"
23#include "types.h"
24
25// See x86 manuals
26class Tss
27{
28 public:
29 uint32 : 32; // 0x0
30
31 uint32 sp0; // 0x4
32 uint16 ss0; uint16 : 16; // 0x8
33 uint32 sp1; // 0xc
34 uint16 ss1; uint16 : 16; // 0x10
35 uint32 sp2; // 0x14
36 uint16 ss2; uint16 : 16; // 0x18
37 uint32 cr3; // 0x1c
38 uint32 eip; // 0x20
39 uint32 eflags; // 0x24
40 uint32 eax; // 0x28
41 uint32 ecx; // 0x2c
42 uint32 edx; // 0x30
43 uint32 ebx; // 0x34
44 uint32 esp; // 0x38
45 uint32 ebp; // 0x3c
46 uint32 esi; // 0x40
47 uint32 edi; // 0x44
48 uint16 es; uint16 : 16; // 0x48
49 uint16 cs; uint16 : 16; // 0x4c
50 uint16 ss; uint16 : 16; // 0x50
51 uint16 ds; uint16 : 16; // 0x54
52 uint16 fs; uint16 : 16; // 0x58
53 uint16 gs; uint16 : 16; // 0x5c
54 uint16 ldt; uint16 : 16; // 0x60
55
56 uint16 trap; // 0x64
57 uint16 iobm; // 0x66
58
59 static Tss run;// CPULOCAL;
60 static Tss dbf;// CPULOCAL;
61
62 static void build();
63
64 ALWAYS_INLINE
65 static inline void load()
66 {
67 asm volatile ("ltr %w0" : : "rm" (SEL_TSS_RUN));
68 }
69};
Definition tss.h:27