mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-15 01:09:15 +00:00
.github
.vscode
Bootloader
Drivers
Kernel
.vscode
arch
core
exec
files
include
boot
cpu
filesystem
interface
kexcept
memory
brk.hpp
kstack.hpp
macro.hpp
physical.hpp
stack.hpp
swap_pt.hpp
table.hpp
va.hpp
virtual.hpp
vma.hpp
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
70 lines
1.7 KiB
C++
70 lines
1.7 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_MEMORY_KERNEL_STACK_MANAGER_H__
|
|
#define __FENNIX_KERNEL_MEMORY_KERNEL_STACK_MANAGER_H__
|
|
|
|
#include <memory.hpp>
|
|
|
|
namespace Memory
|
|
{
|
|
class KernelStackManager
|
|
{
|
|
public:
|
|
struct StackAllocation
|
|
{
|
|
void *PhysicalAddress;
|
|
void *VirtualAddress;
|
|
size_t Size;
|
|
};
|
|
|
|
private:
|
|
NewLock(StackLock);
|
|
std::list<StackAllocation> AllocatedStacks;
|
|
size_t TotalSize = 0;
|
|
uintptr_t CurrentStackTop = KERNEL_STACK_END;
|
|
|
|
public:
|
|
/**
|
|
* Allocate a new stack with detailed information
|
|
*
|
|
* @param Size Size in bytes to allocate
|
|
* @return {PhysicalAddress, VirtualAddress, Size}
|
|
*/
|
|
StackAllocation DetailedAllocate(size_t Size);
|
|
|
|
/**
|
|
* Allocate a new stack
|
|
*
|
|
* @param Size Size in bytes to allocate
|
|
* @return Pointer to the BASE of the stack
|
|
*/
|
|
void *Allocate(size_t Size);
|
|
|
|
/**
|
|
* Free a previously allocated stack
|
|
*
|
|
* @param Address Virtual Address
|
|
*/
|
|
void Free(void *Address);
|
|
KernelStackManager();
|
|
~KernelStackManager();
|
|
};
|
|
}
|
|
|
|
#endif // !__FENNIX_KERNEL_MEMORY_KERNEL_STACK_MANAGER_H__
|