mirror of
https://github.com/tailix/kernel.git
synced 2024-10-30 12:03:52 -04:00
Add function "memory_free_page"
This commit is contained in:
parent
940d0734b1
commit
b981271c64
2 changed files with 13 additions and 0 deletions
|
@ -45,6 +45,17 @@ unsigned long memory_alloc_page()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void memory_free_page(const unsigned long addr)
|
||||||
|
{
|
||||||
|
const unsigned long i = addr / PAGE_SIZE;
|
||||||
|
|
||||||
|
if (i >= FRAMES_COUNT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
frames[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void mark_used(const unsigned long base, const unsigned long limit)
|
void mark_used(const unsigned long base, const unsigned long limit)
|
||||||
{
|
{
|
||||||
const unsigned int start = base / PAGE_SIZE;
|
const unsigned int start = base / PAGE_SIZE;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <kernelmq/info.h>
|
#include <kernelmq/info.h>
|
||||||
|
|
||||||
void memory_initialize(const struct KernelMQ_Info *kinfo);
|
void memory_initialize(const struct KernelMQ_Info *kinfo);
|
||||||
|
|
||||||
unsigned long memory_alloc_page();
|
unsigned long memory_alloc_page();
|
||||||
|
void memory_free_page(unsigned long addr);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue