Commit graph vbos/include/kernel/mem.h
Author SHA1 Message Date
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
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
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
ecf517d7b5 mem: add genrw to mem.h 2023-10-20 13:35:43 -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
b90946e1f8 mem: adjust MMIO addresses 2023-05-10 01:14:33 -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
69ee1fd79c ahci: complete read/write sectors function 2023-05-07 15:21:04 -04:00
Michael Shaw
9222a373fc buddy: replace free-lists with binary tree
before this patch, the buddy allocator used a hybrid bitmap-freelist
approach where free would use the bitmap to determine size, but all
other operations we O(n) traversals of the free-list.

now, both alloc and free use the bitmap exclusively for allocation.
2023-04-29 00:15:50 -04:00
Michael Shaw
22762339f9 irq: begin moving away from 8259
8259 PIC was used for interrupts for bootstrap development while the memory manager was being constructed. now that this is complete, a transition to the apic will begin

this patch fixes memory mapping issues with the reserved regions that caused page faults before.
2023-04-22 13:01:46 -04:00
Michael Shaw
74a58d6641 mem: add basic slab allocator 2023-04-20 16:06:49 -04:00
Michael Shaw
4595f35e4f mem: rename mem_region_header to buddy_region_header 2023-04-14 12:47:30 -04:00
Michael Shaw
59509f4448 mem.h: remove incorrect HHDM_START macro 2023-04-14 12:39:44 -04:00
Michael Shaw
b8fa30c8ed mem: change buddy allocator api
the buddy allocator now returns HHDM addresses as void* rather than
zero-based adddresses as paddr_t. it also automatically searches regions
now, rather than requiring a (struct mem_region_header *) for each
alloc/free
2023-04-13 17:36:04 -04:00
Michael Shaw
4f4af0946d mem: implement buddy allocator 2023-04-12 13:58:22 -04:00
Michael Shaw
d5f388208c mem: formatting fix 2023-03-09 01:59:21 -05:00
Michael Shaw
bb76bcac6c Modify to allow unmapping easily 2023-03-05 17:02:02 -05:00
Michael Shaw
705abf3234 mem: fixed memory mapping bugs with kmap
function `kmap` is now capable of reliably mapping physical addresses to
virtual addresses

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
2023-03-04 22:42:08 -05:00
Michael Shaw
ffddd592da mem: begin work on pager 2023-03-04 16:46:33 -05:00
Michael Shaw
2b9d76d015 mem: add page entry type 2023-03-01 14:20:13 -05:00