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

Method getTotalMemory

lab7/src/4/src/kernel/memory.cpp:92–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92int MemoryManager::getTotalMemory()
93{
94
95 if (!this->totalMemory)
96 {
97 int memory = *((int *)MEMORY_SIZE_ADDRESS);
98 // ax寄存器保存的内容
99 int low = memory & 0xffff;
100 // bx寄存器保存的内容
101 int high = (memory >> 16) & 0xffff;
102
103 this->totalMemory = low * 1024 + high * 64 * 1024;
104 }
105
106 return this->totalMemory;
107}
108
109void MemoryManager::openPageMechanism()
110{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected