1.TSS structure:
TSS is not a register, it is a memory; (contains all registers)
2.TSS role:
If a thread switch switching registers necessarily so;
3.CPU how to find the TSS memory block it? Segment register by TaskRegister
Value TaskRegister segment register is loaded when the CPU starts out by the GDT TSS Descrptor (descriptor);
4.TSS Descriptor (TSS descriptor)
If Type 1001 (9), when the description is not loaded into the segment descriptor register TR
If the Type is 1011 (B) described when the segment descriptor is loaded into register TR
5.TR register read:
6. Review TR registers:
Testing laboratories:
7. experimental ideas
- Written entry function tests
- TSS structure
- Design and installation TSS descriptor
Construction TSS:
char st[10] = {0}; TSS tss = {// tss的地址根据执行代码自己组合 0x00000000,//link (DWORD)st,//esp0 0x00000010,//ss0 0x00000000,//esp1 0x00000000,//ss1 0x00000000,//esp2 0x00000000,//ss2 0x00000000,//cr3 0x0040fad0,//eip 必填项,不然执行完后cpu不知道回来从哪开始执行 0x00000000,//eflags 0x00000000,//eax 0x00000000,//ecx 0x00000000,//edx 0x00000000,//ebx (DWORD)st,//esp 0x00000000,//ebp 0x00000000,//esi 0x00000000,//edi 0x00000023,//es 0x00000008,//cs 0x00000010,//ss 0x00000023,//ds 0x00000030,//fs 0x00000000,//gs 0x00000000,//ldt 0x20ac0000 };