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

Method getTotalMemory

lab7/src/3/src/kernel/memory.cpp:90–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected