]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/include/arch-x86/thread.h
Initial struct marshalling.
[polintos/scott/priv.git] / kernel / include / arch-x86 / thread.h
1 #ifndef _ARCH_THREAD_H
2 #define _ARCH_THREAD_H
3
4 #include <kern/types.h>
5
6 namespace Threads {
7         class Thread;
8 }
9
10 namespace Mem {
11         class ProcAddrSpace;
12 }
13
14 namespace Arch {
15         struct ArchThread {
16                 void *esp, *ebp;
17                 u8 jump_to_init;
18                 
19                 enum {
20                         size = 4096
21                 };
22                 
23                 void init(void *entry, void *arg1, void *arg2);
24         };
25
26         void switch_thread(Threads::Thread *dest, Threads::Thread *src);
27         void set_aspace(Mem::ProcAddrSpace *aspace);
28
29         namespace Priv {
30                 struct TSS {
31                         u16 prev_task;
32                         u16 reserved1;
33                         u32 esp0;
34                         u16 ss0;
35                         u16 reserved2;
36                         u32 esp1;
37                         u16 ss1;
38                         u16 reserved3;
39                         u32 esp2;
40                         u16 ss2;
41                         u16 reserved4;
42                         u32 cr3, eip, eflags;
43                         u32 eax, ecx, edx, ebx, esp, ebp, esi, edi;
44                         u16 es;
45                         u16 reserved5;
46                         u16 cs;
47                         u16 reserved6;
48                         u16 ss;
49                         u16 reserved7;
50                         u16 ds;
51                         u16 reserved8;
52                         u16 fs;
53                         u16 reserved9;
54                         u16 gs;
55                         u16 reserved10;
56                         u16 ldt;
57                         u16 reserved11;
58                         u16 trap;
59                         u16 iomap_base;
60                 };
61                 
62                 extern TSS tss;
63         }
64 };
65
66 #endif