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

Function setup_kernel

lab7/src/5/src/kernel/setup.cpp:46–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46extern "C" void setup_kernel()
47{
48
49 // 中断管理器
50 interruptManager.initialize();
51 interruptManager.enableTimeInterrupt();
52 interruptManager.setTimeInterrupt((void *)asm_time_interrupt_handler);
53
54 // 输出管理器
55 stdio.initialize();
56
57 // 进程/线程管理器
58 programManager.initialize();
59
60 // 内存管理器
61 memoryManager.openPageMechanism();
62 memoryManager.initialize();
63
64 // 创建第一个线程
65 int pid = programManager.executeThread(first_thread, nullptr, "first thread", 1);
66 if (pid == -1)
67 {
68 printf("can not execute thread\n");
69 asm_halt();
70 }
71
72 ListItem *item = programManager.readyPrograms.front();
73 PCB *firstThread = ListItem2PCB(item, tagInGeneralList);
74 firstThread->status = RUNNING;
75 programManager.readyPrograms.pop_front();
76 programManager.running = firstThread;
77 asm_switch_thread(0, firstThread);
78
79 asm_halt();
80}

Callers

nothing calls this directly

Calls 8

printfFunction · 0.70
initializeMethod · 0.45
enableTimeInterruptMethod · 0.45
setTimeInterruptMethod · 0.45
openPageMechanismMethod · 0.45
executeThreadMethod · 0.45
frontMethod · 0.45
pop_frontMethod · 0.45

Tested by

no test coverage detected