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

Method getTotalMemory

lab8/src/6/src/kernel/memory.cpp:113–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113int MemoryManager::getTotalMemory()
114{
115
116 if (!this->totalMemory)
117 {
118 int memory = *((int *)MEMORY_SIZE_ADDRESS);
119 // ax寄存器保存的内容
120 int low = memory & 0xffff;
121 // bx寄存器保存的内容
122 int high = (memory >> 16) & 0xffff;
123
124 this->totalMemory = low * 1024 + high * 64 * 1024;
125 }
126
127 return this->totalMemory;
128}
129
130int MemoryManager::allocatePages(enum AddressPoolType type, const int count)
131{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected