1
0
mirror of https://github.com/EnderIce2/Fennix.git synced 2025-07-22 12:41:42 +00:00
Files
.github
.vscode
Bootloader
Drivers
Kernel
.vscode
arch
core
exec
files
include
boot
cpu
filesystem
interface
kexcept
memory
net
stb
abi.h
acpi.hpp
bitmap.hpp
cargs.h
convert.h
cpu.hpp
crc32.h
cwalk.h
debug.h
disk.hpp
display.hpp
driver.hpp
dumper.hpp
elf.h
exec.hpp
filesystem.hpp
hashmap.hpp
ini.h
intrin.hpp
ints.hpp
io.h
kcon.hpp
kconfig.hpp
kshell.hpp
lock.hpp
macho.h
md5.h
memory.hpp
msexec.h
pci.hpp
power.hpp
printf.h
rand.hpp
ring.hpp
scheduler.hpp
signal.hpp
smp.hpp
static_vector
symbols.hpp
syscalls.hpp
targp.h
task.hpp
time.hpp
tty.hpp
types.h
uart.hpp
vm.hpp
include_std
kshell
library
network
profiling
storage
subsystem
syscalls
tasking
tests
tty
virtualization
.editorconfig
.gdbinit
.gitignore
ISSUES.md
Makefile
README.md
TODO.md
dump.sh
kernel.cpp
kernel.h
kernel_config.cpp
kernel_thread.cpp
kernel_vfs.cpp
Userspace
initrd
tools
.editorconfig
.gitignore
.gitlab-ci.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
CREDITS.md
Doxyfile
Fennix Bootloader.code-workspace
Fennix Drivers.code-workspace
Fennix Kernel.code-workspace
Fennix Userspace.code-workspace
Fennix Website.code-workspace
Fennix.code-workspace
LICENSE.md
LICENSES.md
Makefile
README.md
SECURITY.md
STYLE_GUIDE.md
config.mk
Fennix/Kernel/include/memory.hpp
2024-11-20 05:00:33 +02:00

97 lines
2.5 KiB
C++

/*
This file is part of Fennix Kernel.
Fennix Kernel is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Fennix Kernel is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __FENNIX_KERNEL_INTERNAL_MEMORY_H__
#define __FENNIX_KERNEL_INTERNAL_MEMORY_H__
#ifdef __cplusplus
#include <filesystem.hpp>
#include <boot/binfo.h>
#include <bitmap.hpp>
#include <lock.hpp>
#include <cstddef>
#include <atomic>
#include <new>
#endif // __cplusplus
#include <types.h>
#ifdef __cplusplus
extern uintptr_t _bootstrap_start, _bootstrap_end;
extern uintptr_t _kernel_start, _kernel_end;
extern uintptr_t _kernel_text_start, _kernel_text_end;
extern uintptr_t _kernel_data_start, _kernel_data_end;
extern uintptr_t _kernel_rodata_start, _kernel_rodata_end;
extern uintptr_t _kernel_bss_start, _kernel_bss_end;
namespace Memory
{
enum MemoryAllocatorType
{
None,
/** Allocate memory by pages. */
Pages,
XallocV1,
XallocV2,
liballoc11,
/**
* @warning Not working as expected.
*
* FIXME: This allocator is not working as expected.
*/
rpmalloc_,
};
}
#include <memory/physical.hpp>
#include <memory/virtual.hpp>
#include <memory/swap_pt.hpp>
#include <memory/kstack.hpp>
#include <memory/table.hpp>
#include <memory/macro.hpp>
#include <memory/stack.hpp>
#include <memory/vma.hpp>
#include <memory/brk.hpp>
void InitializeMemoryManagement();
void CreatePageTable(Memory::PageTable *pt);
extern Memory::Physical KernelAllocator;
extern Memory::KernelStackManager StackManager;
extern Memory::PageTable *KernelPageTable;
#endif // __cplusplus
#ifndef __FENNIX_KERNEL_STDLIB_H__
EXTERNC void *malloc(size_t Size);
EXTERNC void *calloc(size_t n, size_t Size);
EXTERNC void *realloc(void *Address, size_t Size);
EXTERNC void free(void *Address);
#endif // !__FENNIX_KERNEL_STDLIB_H__
#define kmalloc(Size) malloc(Size)
#define kcalloc(n, Size) calloc(n, Size)
#define krealloc(Address, Size) realloc(Address, Size)
#define kfree(Address) free(Address)
#endif // !__FENNIX_KERNEL_INTERNAL_MEMORY_H__