| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef __USERPROG_TSS_H__
- #define __USERPROG_TSS_H__
- #include "../thread/thread.h"
- #include "../lib/stdint.h"
- /**
- * @file tss.h
- * @brief Header file for the Task State Segment (TSS) structure.
- *
- * This file contains the definition of the TSS structure used in the
- * operating system kernel's user program module. The TSS is used to
- * store information about a task, such as stack pointers and segment
- * selectors, which are essential for task switching in protected mode.
- */
- typedef struct tss
- {
- uint32_t backlink;
- uint32_t *esp0;
- uint32_t ss0;
- uint32_t *esp1;
- uint32_t ss1;
- uint32_t *esp2;
- uint32_t ss2;
- uint32_t cr3;
- uint32_t (*eip)(void);
- uint32_t eflags;
- uint32_t eax;
- uint32_t ecx;
- uint32_t edx;
- uint32_t ebx;
- uint32_t esp;
- uint32_t ebp;
- uint32_t esi;
- uint32_t edi;
- uint32_t es;
- uint32_t cs;
- uint32_t ss;
- uint32_t ds;
- uint32_t fs;
- uint32_t gs;
- uint32_t ldt;
- uint32_t trap;
- uint32_t iomap;
- } Tss;
- /// @brief 更新 tss 中 esp0 字段的值为 pthread 的 0 级线程
- /// @param pthread
- void update_tss_esp(struct task_struct *pthread);
- void tss_init(void);
- #endif // !__USERPROG_TSS_H__
|