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

Function first_thread

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

Source from the content-addressed store, hash-verified

16MemoryManager memoryManager;
17
18void first_thread(void *arg)
19{
20 // 第1个线程不可以返回
21 // stdio.moveCursor(0);
22 // for (int i = 0; i < 25 * 80; ++i)
23 // {
24 // stdio.print(' ');
25 // }
26 // stdio.moveCursor(0);
27
28 char *p1 = (char *)memoryManager.allocatePages(AddressPoolType::KERNEL, 100);
29 char *p2 = (char *)memoryManager.allocatePages(AddressPoolType::KERNEL, 10);
30 char *p3 = (char *)memoryManager.allocatePages(AddressPoolType::KERNEL, 100);
31
32 printf("%x %x %x\n", p1, p2, p3);
33
34 memoryManager.releasePages(AddressPoolType::KERNEL, (int)p2, 10);
35 p2 = (char *)memoryManager.allocatePages(AddressPoolType::KERNEL, 100);
36
37 printf("%x\n", p2);
38
39 p2 = (char *)memoryManager.allocatePages(AddressPoolType::KERNEL, 10);
40
41 printf("%x\n", p2);
42
43 asm_halt();
44}
45
46extern "C" void setup_kernel()
47{

Callers

nothing calls this directly

Calls 3

printfFunction · 0.70
allocatePagesMethod · 0.45
releasePagesMethod · 0.45

Tested by

no test coverage detected