X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=test%2Fgeekos_test_vm%2Finclude%2Fgeekos%2Ftss.h;fp=test%2Fgeekos_test_vm%2Finclude%2Fgeekos%2Ftss.h;h=66ea1184ef2f6a52aeba921e7bd8454adb8e28b1;hp=0000000000000000000000000000000000000000;hb=a70930549d1b741704dd7af4e6bb0e89f6f8a519;hpb=afb634a80f946634454a5d067a92aa600227bd93 diff --git a/test/geekos_test_vm/include/geekos/tss.h b/test/geekos_test_vm/include/geekos/tss.h new file mode 100644 index 0000000..66ea118 --- /dev/null +++ b/test/geekos_test_vm/include/geekos/tss.h @@ -0,0 +1,89 @@ +/* + * x86 TSS data structure and routines + * Copyright (c) 2001,2004 David H. Hovemeyer + * $Revision: 1.1 $ + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "COPYING". + */ + +#ifndef GEEKOS_TSS_H +#define GEEKOS_TSS_H + +/* + * Source: _Protected Mode Software Architecture_ by Tom Shanley, + * ISBN 020155447X. + */ + +/* + * NOTE: all reserved fields must be set to zero. + */ + +struct TSS { + /* + * Link to nested task. For example, if an interrupt is handled + * by a task gate, the link field will contain the selector for + * the TSS of the interrupted task. + */ + ushort_t link; + ushort_t reserved1; + + /* Stacks for privilege levels. esp0/ss0 specifies the kernel stack. */ + ulong_t esp0; + ushort_t ss0; + ushort_t reserved2; + ulong_t esp1; + ushort_t ss1; + ushort_t reserved3; + ulong_t esp2; + ushort_t ss2; + ushort_t reserved4; + + /* Page directory register. */ + ulong_t cr3; + + /* General processor registers. */ + ulong_t eip; + ulong_t eflags; + ulong_t eax; + ulong_t ecx; + ulong_t edx; + ulong_t ebx; + ulong_t esp; + ulong_t ebp; + ulong_t esi; + ulong_t edi; + + /* Segment registers and padding. */ + ushort_t es; + ushort_t reserved5; + ushort_t cs; + ushort_t reserved6; + ushort_t ss; + ushort_t reserved7; + ushort_t ds; + ushort_t reserved8; + ushort_t fs; + ushort_t reserved9; + ushort_t gs; + ushort_t reserved10; + + /* GDT selector for the LDT descriptor. */ + ushort_t ldt; + ushort_t reserved11; + + /* + * The debug trap bit causes a debug exception upon a switch + * to the task specified by this TSS. + */ + uint_t debugTrap : 1; + uint_t reserved12 : 15; + + /* Offset in the TSS specifying where the io map is located. */ + ushort_t ioMapBase; +}; + +void Init_TSS(void); +void Set_Kernel_Stack_Pointer(ulong_t esp0); + +#endif /* GEEKOS_TSS_H */