Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve "Replace liballoc with Custom Heap" #368

Open
wants to merge 50 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
10c821f
Rename `heap` to `Liballoc`
Kfeavel Jan 24, 2022
9b2d64a
Refactor LinkedList to not require template
Kfeavel Jan 25, 2022
69c2401
Renamed `LinkedListNode` to `Node`
Kfeavel Jan 25, 2022
c54f1cf
Begin writing new heap code
Kfeavel Jan 25, 2022
acac7af
Partially complete `malloc` case 2
Kfeavel Jan 25, 2022
4a41cfb
Make `pageCount` constant
Kfeavel Jan 25, 2022
7cb50b5
Fix potential deadlock when out of memory
Kfeavel Jan 26, 2022
56a05d8
Complete `malloc` through part 4.1
Kfeavel Jan 26, 2022
5080071
Complete `malloc` implementation
Kfeavel Jan 27, 2022
8b810ab
Fix heap align compiler warning
Kfeavel Jan 27, 2022
c2c24e4
Use getters and setters for heap Minor
Kfeavel Jan 27, 2022
0bc8bc4
Use RAII lock in `malloc`
Kfeavel Jan 28, 2022
74fed55
Fix incorrect LinkedList logic and parameter order
Kfeavel Jan 28, 2022
f566276
Fix head class naming & use linkedlist in `Major`
Kfeavel Jan 28, 2022
2375cd4
Rename `LinkedList` to `LinkedListUnmanaged`
Kfeavel Jan 28, 2022
388f720
Replace `reinterpret_cast` with `static_cast`
Kfeavel Jan 28, 2022
4e9b11b
Complete `free` implementation
Kfeavel Jan 31, 2022
0c5ed65
Complete `calloc` implementation
Kfeavel Jan 31, 2022
5a5fbb2
Complete `realloc` implementation
Kfeavel Jan 31, 2022
0196101
Remove `liballoc`
Kfeavel Jan 31, 2022
12518f9
Rework spinner to stress test heap allocation
Kfeavel Jan 31, 2022
1c348cc
Initialize heap and panic on stress test failure
Kfeavel Jan 31, 2022
3984417
Heap: Fix incorrect `if` condition in `malloc`
Kfeavel Feb 5, 2022
2298378
Heap: added log output for debugging
Kfeavel Feb 5, 2022
419deda
Heap: Use InsertBack in `malloc` case 4.1
Kfeavel Feb 5, 2022
034cc6a
Heap: Add more debug logging
Kfeavel Feb 5, 2022
9870c08
Heap: Adding missing call to `unalign` in `free`
Kfeavel Feb 5, 2022
c736a9d
Heap: Fix heap magic value by using `rand` twice
Kfeavel Feb 5, 2022
1b5ef71
Lib: Change data types in `memmove` and `memcpy`
Kfeavel Feb 5, 2022
37c88f7
Replace `debugf` with `Logger::Debug`
Kfeavel Feb 15, 2022
e91945a
Check for duplicate pointers in memory stress test
Kfeavel Feb 15, 2022
adc7273
Fix infinite loop in heap case 1
Kfeavel Feb 15, 2022
9af6fd9
Change `startedBet` to boolean
Kfeavel Feb 15, 2022
69c0864
Fix minor block not being updated in case 4.1
Kfeavel Feb 15, 2022
8988573
Fix backwards linked list insertion arguments
Kfeavel Feb 16, 2022
e35ffd8
Demote heap logging from `Debug` to `Trace`
Kfeavel Feb 16, 2022
54d57b8
Reset spinner app
Kfeavel Feb 16, 2022
49650f6
Remove inconsistent linked list docs
Kfeavel Feb 16, 2022
745a455
Add brief to `New.hpp`
Kfeavel Feb 16, 2022
62aae39
Restructure unit tests
Kfeavel Feb 17, 2022
26de029
Add heap unit test
Kfeavel Feb 17, 2022
37592a0
Exclude unit test code from analysis
Kfeavel Feb 17, 2022
8e8dc6f
Reorganize stubbed unit test code
Kfeavel Feb 17, 2022
67b67da
Add `__xyris__` and `__kernel__` to VSCode defines
Kfeavel Feb 17, 2022
2f6d359
Cleanup heap unit test
Kfeavel Feb 17, 2022
1611929
Change heap byte alignment from 16 to 4
Kfeavel Feb 19, 2022
6520489
Copy unit test from `liballoc`
Kfeavel Feb 19, 2022
f36bdea
Create VSCode configuration for unit tests
Kfeavel Feb 19, 2022
c375a8a
Use `std::` on functions when possible
Kfeavel Feb 19, 2022
5264dd0
Update `Tests/Logger.cpp` to match kernel
Kfeavel Jan 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "libs/liballoc"]
path = Libraries/liballoc
url = https://github.com/XyrisOS/liballoc.git
branch = xyris
[submodule "thirdparty/limine"]
path = Thirdparty/limine
url = https://github.com/limine-bootloader/limine.git
Expand Down
19 changes: 18 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@
"COMMIT",
"VER_MAJOR",
"VER_MINOR",
"VER_PATCH"
"VER_PATCH",
"__xyris__",
"__kernel__"
],
"compilerPath": "/usr/bin/gcc",
"includePath": [
"${default}",
"${workspaceFolder}/Kernel/",
"${workspaceFolder}/Thirdparty/"
],
"cStandard": "c17",
"cppStandard": "c++20"
},
{
"name": "Xyris Unit Tests",
"defines": [
"__i686__",
"__xyris__"
],
"compilerPath": "/usr/bin/gcc",
"includePath": [
Expand Down
3 changes: 3 additions & 0 deletions Kernel/Arch/Memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# include <Arch/i686/Memory/Types.h>
#endif

#define BYTE_SIZE 8
#define BYTES_TO_BITS(b) ((b) * BYTE_SIZE)

#define B_TO_KB(b) ((b) / 1024)
#define KB_TO_MB(kb) ((kb) / 1024)
#define MB_TO_GB(mb) ((mb) / 1024)
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/Graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <Devices/Graphics/graphics.hpp>
#include <stddef.h>
#include <stdint.h>
#include <Memory/heap.hpp>
#include <Memory/Heap.hpp>
#include <Memory/paging.hpp>
#include <Bootloader/Handoff.hpp>
#include <Library/stdio.hpp>
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Devices/Serial/rs232.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#include <Arch/Arch.hpp>
#include <Devices/Serial/rs232.hpp>
#include <Library/RingBuffer.hpp>
#include <Memory/Heap.hpp>
#include <Library/stdio.hpp>
#include <Library/string.hpp>
#include <Locking/RAII.hpp>
#include <Logger.hpp>
#include <Memory/heap.hpp>
#include <stdarg.h>

#define RS_232_COM1_IRQ 0x04
Expand Down
2 changes: 2 additions & 0 deletions Kernel/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// Architecture specific code
#include <Arch/Arch.hpp>
// Memory management & paging
#include <Memory/Heap.hpp>
#include <Memory/paging.hpp>
#include <Memory/Physical.hpp>
// Generic devices
Expand Down Expand Up @@ -93,6 +94,7 @@ void kernelEntry(void* info, uint32_t magic)
Boot::Handoff handoff(info, magic);
Memory::Physical::Manager::initialize(handoff.MemoryMap());
Memory::init();
Memory::Heap::init();
Graphics::init(handoff.FramebufferInfo());
tasks_init();

Expand Down
Loading