Michael Shaw
4aefedf276
slab: record size on kmalloc(..., ALLOC_KERN);
...
previously, this size was not recorded, causing krealloc to fail, due to
it always copying zero bytes
2024-02-12 22:45:43 -05:00
Michael Shaw
8721d1968b
slab: add krealloc
2024-02-07 22:31:08 -05:00
Michael Shaw
1fcac9b274
slab: correct lock pointers
2023-11-22 21:58:41 -05:00
Michael Shaw
aac47e60f3
proc: free pages and fds after proc termination
2023-11-22 21:55:52 -05:00
Michael Shaw
3f7b186177
slab: remove erroneous include
2023-11-10 19:14:01 -05:00
Michael Shaw
06b02fc9a6
kmalloc: add fallback for failed DMA allocations
2023-11-03 14:43:53 -04:00
Michael Shaw
4dc4f07dc6
mem: improve device memory mapping
...
MMIO ports will no longer directly map to HHDM addresses and will need
to be searched for in the memory mapping tree
2023-10-24 22:16:33 -04:00
Michael Shaw
0dcf6a9e76
ext2: generalize block sizes and remove inode read
2023-10-18 16:37:09 -04:00
Michael Shaw
1fa16f1a15
slab: fix formatting error
2023-06-26 00:12:52 -04:00
Michael Shaw
2b920385c1
slab: add error checking to spinlocks to prevent deadlock
2023-05-27 23:49:48 -04:00
Michael Shaw
0b8e1c2aad
slab: add lock value to kmalloc_tree initialization
2023-05-27 23:14:37 -04:00
Michael Shaw
21e2540243
block: replace block_part with independent block devices
...
this also removes the fat32 support for now, as the virtual filesystem
needs more work
2023-05-27 17:32:39 -04:00
Michael Shaw
db5990cc97
mem: add locks to kernel memory management structures
2023-05-27 02:11:27 -04:00
Michael Shaw
ceb0287109
slab: fix alignment
...
If the pointer the the beginning of the slab was the beginning of the
aligned region, instead of jumping to the next, as was done previously,
we use the already aligned pointer instead.
2023-05-19 20:13:31 -04:00
Michael Shaw
29a0435cf6
slab: replace struct slab with slab_t
...
This type should never be modified by the user, and only passed into the
functions in slab.c. Using a typedef to notifies the user semantically
of this fact
2023-05-19 16:49:34 -04:00
Michael Shaw
0395b65ad8
stdio: add vsnprintf and change printf to kprintf
2023-05-14 01:23:21 -04:00
Michael Shaw
c94d26dff1
kfree: fix format specifier
2023-05-13 20:40:56 -04:00
Michael Shaw
b84a48aaa7
slab: log bad kfree
2023-05-10 23:23:03 -04:00
Michael Shaw
ea1c1b337d
rbt: remove verify function
2023-05-10 21:57:40 -04:00
Michael Shaw
c712f0a7d6
kmalloc: add consistency test when KDEBUG is defined
2023-05-10 21:41:25 -04:00
Michael Shaw
4e36cfd90b
lib: add rbtree data structure
...
This also switches the kmalloc allocator over to the new rbtree
structure. As a balanced binary search tree, it is much more efficient
than the previous method
2023-05-10 21:24:19 -04:00
Michael Shaw
d3e9b728dc
slab: no longer automatically allocate slab cache sizes
2023-05-10 13:18:37 -04:00
Michael Shaw
b90946e1f8
mem: adjust MMIO addresses
2023-05-10 01:14:33 -04:00
Michael Shaw
d3f04046f4
slab: adjust slab sizes
2023-05-08 01:19:37 -04:00
Michael Shaw
8544efe1ab
slab: upgrade kmalloc to allow DMA regions
...
these DMA regions are only meant to comply with certain AHCI
requirements, and are not yet general purpose
2023-05-08 01:14:11 -04:00
Michael Shaw
47edaa8512
slab: add kzalloc
2023-05-04 15:26:40 -04:00
Michael Shaw
2c9e239c65
mem: remove unused kmalloc_slab
2023-05-03 18:51:12 -04:00
Michael Shaw
c870c31774
slab: change how kmalloc slabs are tracked and freed
2023-05-03 13:15:58 -04:00
Michael Shaw
e1108b3493
mem: improve slabbing to include flags
2023-04-29 16:54:12 -04:00
Michael Shaw
aaeabe7b49
mem: switch kmap to slab allocation
...
allocating individual pages en-masse for kmap with the buddy allocator
is way too slow, especially with the new method of buddy allocation that
is noticeably slower to start, but scales more efficiently.
the slab allocator is extremely fast and is perfect for this purpose
2023-04-29 14:51:57 -04:00
Michael Shaw
159ceec0a2
mem: move slab min size to macro
...
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
2023-04-21 12:02:02 -04:00
Michael Shaw
addf96aae7
mem: fix bug with slab_create
...
before this would overwrite into the next region, which would cause an
error at `buddy_alloc_helper` as the region overridden was the `len`
field of a `struct buddy_free_list`
2023-04-20 21:43:43 -04:00
Michael Shaw
4db95954a3
change SLAB_MIN_COUNT to 64
2023-04-20 19:31:25 -04:00
Michael Shaw
794c328809
mem: update slab allocator
...
the slab allocator will now free slabs if they are not the first slab
for a given size and they are empty
2023-04-20 19:22:07 -04:00
Michael Shaw
f1f81a876c
mem: make slab_range static inline
2023-04-20 17:04:42 -04:00
Michael Shaw
577779f8ae
mem: add kmalloc and kfree
2023-04-20 17:03:10 -04:00
Michael Shaw
74a58d6641
mem: add basic slab allocator
2023-04-20 16:06:49 -04:00