low-level physmem memory free function
parent
22000db5e9
commit
338f5b1a83
|
@ -14,4 +14,7 @@ u64 physmem_physical_to_page(u64 Physical);
|
||||||
// Read physical data
|
// Read physical data
|
||||||
void physmem_read(u64 Base, u64 Size, void *Destination);
|
void physmem_read(u64 Base, u64 Size, void *Destination);
|
||||||
|
|
||||||
|
// Return how much memory is free (including not reserved by system)
|
||||||
|
u64 physmem_get_free(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -82,3 +82,14 @@ void physmem_read(u64 Base, u64 Size, void *Destination)
|
||||||
OffsetInSource++;
|
OffsetInSource++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 physmem_get_free(void)
|
||||||
|
{
|
||||||
|
u64 Accumulator = 0;
|
||||||
|
for (u64 i = g_TopFrame; i <= g_MemorySize; i += PHYSMEM_PAGE_SIZE)
|
||||||
|
{
|
||||||
|
if (system_memory_available(i, PHYSMEM_PAGE_SIZE))
|
||||||
|
Accumulator += PHYSMEM_PAGE_SIZE;
|
||||||
|
}
|
||||||
|
return Accumulator;
|
||||||
|
}
|
Loading…
Reference in New Issue