mirror of
https://github.com/tailix/kernel.git
synced 2025-02-17 15:45:37 -05:00
Rename module "memory" to "pfa"
This commit is contained in:
parent
3a0366df9b
commit
8586e0ea09
5 changed files with 24 additions and 24 deletions
|
@ -6,7 +6,7 @@ OBJS = start.s.o
|
||||||
OBJS += init.c.o
|
OBJS += init.c.o
|
||||||
OBJS += multiboot.c.o
|
OBJS += multiboot.c.o
|
||||||
OBJS += panic.c.o panic.asm.cpp.o
|
OBJS += panic.c.o panic.asm.cpp.o
|
||||||
OBJS += memory.c.o
|
OBJS += pfa.c.o
|
||||||
OBJS += paging.c.o paging.asm.cpp.o
|
OBJS += paging.c.o paging.asm.cpp.o
|
||||||
|
|
||||||
# Architecture-independent
|
# Architecture-independent
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "logger.h"
|
#include "pfa.h"
|
||||||
#include "memory.h"
|
|
||||||
#include "protected.h"
|
#include "protected.h"
|
||||||
#include "paging.h"
|
#include "paging.h"
|
||||||
|
|
||||||
|
@ -19,7 +18,7 @@ void main(const struct KernelMQ_Info *const kinfo_ptr)
|
||||||
|
|
||||||
assert(kernelmq_info_validate_and_copy(&kinfo, kinfo_ptr), "Invalid kernel information.");
|
assert(kernelmq_info_validate_and_copy(&kinfo, kinfo_ptr), "Invalid kernel information.");
|
||||||
|
|
||||||
memory_initialize(&kinfo);
|
pfa_initialize(&kinfo);
|
||||||
|
|
||||||
protected_initialize(&kinfo);
|
protected_initialize(&kinfo);
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef KERNELMQ_INCLUDED_MEMORY
|
|
||||||
#define KERNELMQ_INCLUDED_MEMORY 1
|
|
||||||
|
|
||||||
#include <kernelmq/info.h>
|
|
||||||
|
|
||||||
void memory_initialize(const struct KernelMQ_Info *kinfo);
|
|
||||||
|
|
||||||
unsigned long memory_alloc_page();
|
|
||||||
unsigned long memory_alloc_big_page();
|
|
||||||
|
|
||||||
void memory_free_page(unsigned long addr);
|
|
||||||
void memory_free_big_page(unsigned long addr);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "memory.h"
|
#include "pfa.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "panic.h"
|
||||||
|
|
||||||
#include <kernelmq/stdlib.h>
|
#include <kernelmq/stdlib.h>
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ static unsigned char frames[FRAMES_COUNT];
|
||||||
|
|
||||||
static void mark_used(unsigned long base, unsigned long limit);
|
static void mark_used(unsigned long base, unsigned long limit);
|
||||||
|
|
||||||
void memory_initialize(const struct KernelMQ_Info *const kinfo)
|
void pfa_initialize(const struct KernelMQ_Info *const kinfo)
|
||||||
{
|
{
|
||||||
kmemset(frames, 0, sizeof(frames));
|
kmemset(frames, 0, sizeof(frames));
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ void memory_initialize(const struct KernelMQ_Info *const kinfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long memory_alloc_page()
|
unsigned long pfa_alloc_page()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < FRAMES_COUNT; ++i) {
|
for (unsigned int i = 0; i < FRAMES_COUNT; ++i) {
|
||||||
if (!frames[i]) {
|
if (!frames[i]) {
|
||||||
|
@ -45,7 +46,7 @@ unsigned long memory_alloc_page()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long memory_alloc_big_page()
|
unsigned long pfa_alloc_big_page()
|
||||||
{
|
{
|
||||||
unsigned int start = 0;
|
unsigned int start = 0;
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ unsigned long memory_alloc_big_page()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_free_page(const unsigned long addr)
|
void pfa_free_page(const unsigned long addr)
|
||||||
{
|
{
|
||||||
assert(!(addr % PAGE_SIZE), "Small page address to free is not aligned.");
|
assert(!(addr % PAGE_SIZE), "Small page address to free is not aligned.");
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ void memory_free_page(const unsigned long addr)
|
||||||
frames[i] = 0;
|
frames[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_free_big_page(const unsigned long addr)
|
void pfa_free_big_page(const unsigned long addr)
|
||||||
{
|
{
|
||||||
assert(!(addr % PAGE_BIG_SIZE), "Big page address to free is not aligned.");
|
assert(!(addr % PAGE_BIG_SIZE), "Big page address to free is not aligned.");
|
||||||
|
|
14
arch/pfa.h
Normal file
14
arch/pfa.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef KERNELMQ_INCLUDED_PFA
|
||||||
|
#define KERNELMQ_INCLUDED_PFA 1
|
||||||
|
|
||||||
|
#include <kernelmq/info.h>
|
||||||
|
|
||||||
|
void pfa_initialize(const struct KernelMQ_Info *kinfo);
|
||||||
|
|
||||||
|
unsigned long pfa_alloc_page();
|
||||||
|
unsigned long pfa_alloc_big_page();
|
||||||
|
|
||||||
|
void pfa_free_page(unsigned long addr);
|
||||||
|
void pfa_free_big_page(unsigned long addr);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue