Commit graph vbos/mem
Author SHA1 Message Date
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
abbad89d7f page: modify attributes of parent page tables 2023-11-22 01:24:06 -05:00
Michael Shaw
37518aea81 usr: implement user process switching
This is a rather large commit, so the gist of it is this:

User context switching is now functional, after a change to the TSS, and
a few minor details in the scheduler and loader.

ELF parsing is rather primitive, but basically functional, as long as it
only loads code.

The interrupt 0x80 is for syscalls, and will switch from user mode to
kernel mode. It is currently the only interrupt that can be called from
user mode

This adds the syscall functionality, which currently uses a red-black
tree to store the function pointers, although when the table is more
flushed out, it will probably be replaced with an array

The pager now correctly marks the parent nodes with attributes as it
allocates them. Without doing this, the page table entries will never be
reached in lower privilege modes, causing page faults

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
2023-11-20 22:07:35 -05:00
Michael Shaw
d60da85470 load: add basic elf loading 2023-11-16 23:22:27 -05:00
Michael Shaw
38918e3be3 page: fix error in mmap_find_unmapped 2023-11-15 20:35:27 -05:00
Michael Shaw
ec4d266abd ahci: relocate ahci_vbase to unmapped region 2023-11-15 20:16:21 -05:00
Michael Shaw
823f811954 mmap: generalize mmap
also add a range search function to ensure that memory allocations do
not overlap in virtual space
2023-11-15 16:56:29 -05:00
Michael Shaw
fdb319e96b paging: move paging from buddy.c into new file 2023-11-15 15:41:48 -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
2c88b77edd init: correct TSS impl, generalize stack loading 2023-11-01 17:43:27 -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
158004fd88 asm: clean up reg.S with fancy macro 2023-10-20 13:33:39 -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
cf035645e8 mem: flush tlb on kmap 2023-06-10 21:27:49 -04:00
Michael Shaw
30bf724282 kunmap: add error checking 2023-05-28 00:00: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
8ee80d22c9 mem: add kunmap and begin tracking mapped pages 2023-05-27 23:24:39 -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
13437a219e page: do not invalidate kernel TLB entries
set the PAGE_GLOBAL attr for kernel pages
2023-05-23 23:23:10 -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
29dd9b54e7 buddy: adjust memory mappings for early init
this massively speeds up boot on larger memory systems, as before this
was only tested on a 2GB system. Only identity mapping the first 4GB of
still allows MMIO to work, but without the massive space and time taken
by the previous method
2023-05-10 01:10:36 -04:00
Michael Shaw
d6828e5698 buddy: fix printf format size error 2023-05-10 00:47:57 -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
c623f4a9fb mem: rename function 2023-05-07 15:28:52 -04:00
Michael Shaw
69ee1fd79c ahci: complete read/write sectors function 2023-05-07 15:21:04 -04:00
Michael Shaw
7db20603f6 ahci: add ahci_read_sectors function 2023-05-06 23:50:14 -04:00
Michael Shaw
adfa24dd1e ahci: complete hbafis_t struct 2023-05-06 17:27:52 -04:00
Michael Shaw
47edaa8512 slab: add kzalloc 2023-05-04 15:26:40 -04:00
Michael Shaw
39c778d2f0 add some asserts 2023-05-04 02:02:17 -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
75d156c4e3 stack_init: fix bug 2023-04-30 01:11:07 -04:00
Michael Shaw
e1108b3493 mem: improve slabbing to include flags 2023-04-29 16:54:12 -04:00