summaryrefslogtreecommitdiff
path: root/Source/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel')
-rw-r--r--Source/Kernel/FileSystems/RamFS/RamFS.class.cpp8
-rw-r--r--Source/Kernel/Linker/ElfBinary.class.cpp2
-rw-r--r--Source/Kernel/Linker/MelonBinary.class.cpp2
-rw-r--r--Source/Kernel/MemoryManager/Mem.ns.cpp4
-rw-r--r--Source/Kernel/MemoryManager/Mem.ns.h4
-rw-r--r--Source/Kernel/MemoryManager/PageAlloc.ns.cpp4
-rw-r--r--Source/Kernel/MemoryManager/PhysMem.ns.cpp2
-rw-r--r--Source/Kernel/Shell/KernelShell-fs.class.cpp4
-rw-r--r--Source/Kernel/SyscallManager/Res.ns.cpp6
-rw-r--r--Source/Kernel/TaskManager/Thread.class.cpp4
-rw-r--r--Source/Kernel/common.h8
11 files changed, 24 insertions, 24 deletions
diff --git a/Source/Kernel/FileSystems/RamFS/RamFS.class.cpp b/Source/Kernel/FileSystems/RamFS/RamFS.class.cpp
index a224bf8..5997841 100644
--- a/Source/Kernel/FileSystems/RamFS/RamFS.class.cpp
+++ b/Source/Kernel/FileSystems/RamFS/RamFS.class.cpp
@@ -112,11 +112,11 @@ bool RamFS::write(FileNode* file, u64int position, u32int length, u8int *data) {
m_usedSize -= node->getLength();
m_usedSize += end;
- u8int* data = (u8int*)Mem::kalloc(end);
+ u8int* data = (u8int*)Mem::alloc(end);
if (data == 0) return false; //Invalid pointer
if (node->m_data != 0) {
memcpy(data, node->m_data, node->getLength());
- Mem::kfree(node->m_data);
+ Mem::free(node->m_data);
}
node->m_data = data;
node->setLength(end);
@@ -129,7 +129,7 @@ bool RamFS::truncate(FileNode* file) {
if (!m_isWritable) return false;
RamFileNode *node = (RamFileNode*) file;
- Mem::kfree(node->m_data);
+ Mem::free(node->m_data);
node->setLength(0);
node->m_data = 0;
@@ -163,7 +163,7 @@ DirectoryNode* RamFS::createDirectory(DirectoryNode* parent, String name) {
bool RamFS::remove(DirectoryNode* parent, FSNode* node) {
if (node->type() == NT_FILE) {
u8int *d = ((RamFileNode*)node)->m_data;
- if (d != 0) Mem::kfree(d);
+ if (d != 0) Mem::free(d);
}
return true;
}
diff --git a/Source/Kernel/Linker/ElfBinary.class.cpp b/Source/Kernel/Linker/ElfBinary.class.cpp
index 450053f..27e5474 100644
--- a/Source/Kernel/Linker/ElfBinary.class.cpp
+++ b/Source/Kernel/Linker/ElfBinary.class.cpp
@@ -26,7 +26,7 @@ Binary* ElfBinary::load(File& file) {
}
//Load data
for (SimpleList<phdr_t> *iter = b->m_phdr; iter != 0; iter = iter->next()) {
- iter->v().data = (u8int*)Mem::kalloc(iter->v().h.p_filesz);
+ iter->v().data = (u8int*)Mem::alloc(iter->v().h.p_filesz);
file.seek(iter->v().h.p_offset, SM_BEGINNING);
file.read(iter->v().h.p_filesz, iter->v().data);
}
diff --git a/Source/Kernel/Linker/MelonBinary.class.cpp b/Source/Kernel/Linker/MelonBinary.class.cpp
index d6074de..0737b71 100644
--- a/Source/Kernel/Linker/MelonBinary.class.cpp
+++ b/Source/Kernel/Linker/MelonBinary.class.cpp
@@ -7,7 +7,7 @@ Binary* MelonBinary::load(File& file) {
MelonBinary* r = new MelonBinary;
file.read<u32int>(&r->m_size);
file.read<u32int>(&r->m_org);
- r->m_data = (u8int*)Mem::kalloc(r->m_size);
+ r->m_data = (u8int*)Mem::alloc(r->m_size);
file.read(r->m_size, r->m_data);
return r;
} else {
diff --git a/Source/Kernel/MemoryManager/Mem.ns.cpp b/Source/Kernel/MemoryManager/Mem.ns.cpp
index c705b3b..c7f07f0 100644
--- a/Source/Kernel/MemoryManager/Mem.ns.cpp
+++ b/Source/Kernel/MemoryManager/Mem.ns.cpp
@@ -39,14 +39,14 @@ void createHeap() {
kheap.create(heapStart, heapSize, heapIndexSize, kernelPageDirectory, false, false);
}
-void *kalloc(u32int sz, bool align) {
+void *alloc(u32int sz, bool align) {
if (!kheap.usable()) return kallocInternal(sz, align);
if (align) return 0;
return kheap.alloc(sz);
}
-void kfree(void *ptr) {
+void free(void *ptr) {
kheap.free(ptr);
}
diff --git a/Source/Kernel/MemoryManager/Mem.ns.h b/Source/Kernel/MemoryManager/Mem.ns.h
index 15935c0..0d2b1da 100644
--- a/Source/Kernel/MemoryManager/Mem.ns.h
+++ b/Source/Kernel/MemoryManager/Mem.ns.h
@@ -8,8 +8,8 @@ namespace Mem {
extern u32int placementAddress;
void createHeap();
- void *kalloc(u32int sz, bool align = false);
- void kfree(void *ptr);
+ void *alloc(u32int sz, bool align = false);
+ void free(void *ptr);
u32int kheapSize(), kheapFree();
}
diff --git a/Source/Kernel/MemoryManager/PageAlloc.ns.cpp b/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
index 34d4f74..d8ede2a 100644
--- a/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
+++ b/Source/Kernel/MemoryManager/PageAlloc.ns.cpp
@@ -14,7 +14,7 @@ bool usable = false, locked = false;
void init() {
freec = CACHED_PAGES;
for (u32int i = 0; i < CACHED_PAGES; i++) {
- freePage[i] = Mem::kalloc(0x1000, true);
+ freePage[i] = Mem::alloc(0x1000, true);
}
usable = true;
}
@@ -26,7 +26,7 @@ void* alloc(u32int* phys) {
locked = true;
void* next = 0;
if (!Mem::pagingEnabled) {
- next = Mem::kalloc(0x1000, true);
+ next = Mem::alloc(0x1000, true);
} else {
u32int i = 0xFFFFF000;
page_t *p;
diff --git a/Source/Kernel/MemoryManager/PhysMem.ns.cpp b/Source/Kernel/MemoryManager/PhysMem.ns.cpp
index 25869f1..1b40e88 100644
--- a/Source/Kernel/MemoryManager/PhysMem.ns.cpp
+++ b/Source/Kernel/MemoryManager/PhysMem.ns.cpp
@@ -14,7 +14,7 @@ void initPaging(u32int mem_size) {
frames = new Bitset(nframes);
- kernelPageDirectory = new (Mem::kalloc(sizeof(PageDirectory), true)) PageDirectory();
+ kernelPageDirectory = new (Mem::alloc(sizeof(PageDirectory), true)) PageDirectory();
u32int i = 0xC0000000;
while (i < Mem::placementAddress) {
diff --git a/Source/Kernel/Shell/KernelShell-fs.class.cpp b/Source/Kernel/Shell/KernelShell-fs.class.cpp
index fe1ecbf..cd52810 100644
--- a/Source/Kernel/Shell/KernelShell-fs.class.cpp
+++ b/Source/Kernel/Shell/KernelShell-fs.class.cpp
@@ -55,11 +55,11 @@ void KernelShell::cat(Vector<String>& args) {
for (u32int i = 1; i < args.size(); i++) {
File f(args[i], FM_READ, m_cwd);
if (f.valid()) {
- u8int *buff = (u8int*)Mem::kalloc(f.length() + 1);
+ u8int *buff = (u8int*)Mem::alloc(f.length() + 1);
f.read(f.length(), buff);
buff[f.length()] = 0;
*m_vt << String((const char*) buff);
- Mem::kfree(buff);
+ Mem::free(buff);
} else {
*m_vt << "Error reading from file " << args[i] << "\n";
}
diff --git a/Source/Kernel/SyscallManager/Res.ns.cpp b/Source/Kernel/SyscallManager/Res.ns.cpp
index 274f6f1..1779a00 100644
--- a/Source/Kernel/SyscallManager/Res.ns.cpp
+++ b/Source/Kernel/SyscallManager/Res.ns.cpp
@@ -12,18 +12,18 @@ u32int size = 0;
void expand() { //Expands size of ressources array of 20 entries
size += 20;
- Ressource** tmp = (Ressource**)Mem::kalloc(size * sizeof(Ressource*));
+ Ressource** tmp = (Ressource**)Mem::alloc(size * sizeof(Ressource*));
for (u32int i = 0; i < size; i++) {
if (i < size - 20) tmp[i] = ressources[i];
else tmp[i] = 0;
}
- Mem::kfree(ressources);
+ Mem::free(ressources);
ressources = tmp;
}
u32int registerRes(Ressource* r) {
if (ressources == 0 or size == 0) {
- ressources = (Ressource**)Mem::kalloc(20 * sizeof(Ressource*));
+ ressources = (Ressource**)Mem::alloc(20 * sizeof(Ressource*));
size = 20;
for (u32int i = 0; i < 20; i++) ressources[i] = 0;
}
diff --git a/Source/Kernel/TaskManager/Thread.class.cpp b/Source/Kernel/TaskManager/Thread.class.cpp
index 2237457..315eae2 100644
--- a/Source/Kernel/TaskManager/Thread.class.cpp
+++ b/Source/Kernel/TaskManager/Thread.class.cpp
@@ -68,7 +68,7 @@ Thread::Thread(Process* process, thread_entry_t entry_point, void* data) : Resso
Thread::~Thread() {
Task::unregisterThread(this);
- Mem::kfree(m_kernelStack.addr);
+ Mem::free(m_kernelStack.addr);
if (m_userStack.addr != 0) {
m_process->getPagedir()->switchTo();
m_process->heap().free(m_userStack.addr);
@@ -82,7 +82,7 @@ void Thread::setup(Process* process, thread_entry_t entry_point, void* data, boo
m_isKernel = isKernel;
m_process = process;
- m_kernelStack.addr = Mem::kalloc(STACKSIZE);
+ m_kernelStack.addr = Mem::alloc(STACKSIZE);
m_kernelStack.size = STACKSIZE;
if (m_isKernel) {
diff --git a/Source/Kernel/common.h b/Source/Kernel/common.h
index c6da25e..86d76cd 100644
--- a/Source/Kernel/common.h
+++ b/Source/Kernel/common.h
@@ -20,9 +20,9 @@ inline void* operator new[](u32int, void *p) { return p; }
inline void operator delete(void*, void*) { }
inline void operator delete[](void*, void*) { }
-inline void* operator new(u32int sz) { return Mem::kalloc(sz); }
-inline void* operator new[](u32int sz) { return Mem::kalloc(sz); }
-inline void operator delete(void *ptr) { Mem::kfree(ptr); }
-inline void operator delete[](void *ptr) { Mem::kfree(ptr); }
+inline void* operator new(u32int sz) { return Mem::alloc(sz); }
+inline void* operator new[](u32int sz) { return Mem::alloc(sz); }
+inline void operator delete(void *ptr) { Mem::free(ptr); }
+inline void operator delete[](void *ptr) { Mem::free(ptr); }
#endif