MCPcopy Create free account
hub / github.com/YatSenOS/YatSenOS-Tutorial-Volume-1 / initializeTSS

Method initializeTSS

lab8/src/3/src/kernel/program.cpp:177–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void ProgramManager::initializeTSS()
178{
179
180 int size = sizeof(TSS);
181 int address = (int)&tss;
182
183 memset((char *)address, 0, size);
184 tss.ss0 = STACK_SELECTOR; // 内核态堆栈段选择子
185
186 int low, high, limit;
187
188 limit = size - 1;
189 low = (address << 16) | (limit & 0xff);
190 // DPL = 0
191 high = (address & 0xff000000) | ((address & 0x00ff0000) >> 16) | ((limit & 0xff00) << 16) | 0x00008900;
192
193 int selector = asm_add_global_descriptor(low, high);
194 // RPL = 0
195 asm_ltr(selector << 3);
196 tss.ioMap = address + size;
197}
198
199int ProgramManager::executeProcess(const char *filename, int priority)
200{

Callers

nothing calls this directly

Calls 1

memsetFunction · 0.50

Tested by

no test coverage detected