Commit Graph

65 Commits

Author SHA1 Message Date
Drew Galbraith 71431189c9 [Zion] Ensure memory alignment of large allocations. 2024-08-17 12:53:25 -07:00
Drew Galbraith 815a603c1c [Zion] Mark pages as not present before calling invlpg. 2023-12-05 16:11:37 -08:00
Drew Galbraith 1f8085f791 [Zion] Call invlpg when unmapping memory. 2023-12-05 15:53:42 -08:00
Drew Galbraith 46ae5de30a [Zion] Free paging structures after process exit. 2023-11-24 17:19:32 -08:00
Drew Galbraith 39ac0216dd [Zion] Free all user space mappings when exitting a process. 2023-11-24 17:08:37 -08:00
Drew Galbraith 430dc36728 [Zion] Add TODO to separate user stacks for safety. 2023-11-24 16:57:00 -08:00
Drew Galbraith 85b701ce31 [Zion] Clarify kernel stack reuse in a comment. 2023-11-24 16:55:45 -08:00
Drew Galbraith 2dd69f5844 [Zion] Map user stacks in as regular MemoryObjects.
This allows us to easily track the physical memory so it
can be freed when the thread exits. It also simplifies the page fault
handler as it just needs to check regular mappings to find a user stack.
2023-11-24 16:51:35 -08:00
Drew Galbraith 7695396980 [Zion] Add released User Stacks to pool for reuse. 2023-11-24 16:16:25 -08:00
Drew Galbraith d1ace374b6 [Zion] Return freed kernel stacks to pool. 2023-11-24 16:04:40 -08:00
Drew Galbraith c8931a01c8 [Zion] Fix physical page usage tracking. 2023-11-23 07:20:11 -08:00
Drew Galbraith 9b43d615a9 [Zion] Split free physical memory into two lists.
Allow partitioning create requests so for large continuous requests
we don't have to iterate past a bunch of single free pages.
2023-11-20 10:02:27 -08:00
Drew Galbraith 4d1846a7d5 [Zion] Actually free memory pages when a MemoryObject goes out of scope 2023-11-19 21:37:30 -08:00
Drew Galbraith 8e827a5dfb [Mammoth] Move all callers of FromCapability to OwnedMemoryObject. 2023-11-19 20:33:15 -08:00
Drew Galbraith 70bdb822a7 [Zion] Add implementation of KernelVmm::FreeKernelStack. 2023-11-19 17:29:09 -08:00
Drew Galbraith 308dd6a203 [Zion] Add a framework for better process exit. 2023-11-16 23:03:27 -08:00
Drew Galbraith e4deca716c [Zion] Use range based for loop on LinkedList as POC. 2023-11-15 18:50:58 -08:00
Drew Galbraith 9e76c81e97 [Zion] Move Kernel Stack Memory constants to separate file. 2023-11-15 15:55:24 -08:00
Drew Galbraith 07e6e3028d [Zion] Access the KernelStackManager through the VMM. 2023-11-15 15:38:25 -08:00
Drew Galbraith c5b9d20c7e [Zion] Remove early_dbgln since dbgln no longer allocs. 2023-11-15 15:19:02 -08:00
Drew Galbraith 20d6d2aaaf [Zion] Introduce the Kernel VMM to centralize allocs. 2023-11-15 15:15:31 -08:00
Drew Galbraith 0b47e3b7fc [Zion] Track used vs free physical memory. 2023-11-15 14:53:05 -08:00
Drew Galbraith 8e95a11907 [Zion] Move the physical memory manager to the LinkedList class. 2023-11-15 14:44:16 -08:00
Drew Galbraith 92d8a02291 [Zion] Cleanup memory debug statistics slightly. 2023-11-15 13:10:53 -08:00
Drew Galbraith 10d16e129f [Zion] Use a slab allocator for 64 byte and 128 byte allocs.
This has no effect on page usage for now (each uses a small amount of
pages so has some overhead.

However it does reduce the active allocations from
234 -> 146 (64B)
61 -> 51 (128B)
2023-11-15 13:06:14 -08:00
Drew Galbraith cc16210e90 [Zion] Use slab allocators immediately during heap init. 2023-11-15 13:02:34 -08:00
Drew Galbraith 659f122c9e [Zion] Free memory that was allocated with the slab allocator.
This reduces the number of active allocs by ~ 200.
Size 8: 142 -> 2
Size 16: 319 > 313
Size 32: 364-> 312
2023-11-15 12:53:14 -08:00
Drew Galbraith 6d27ee5dc5 [Zion] Add more debug information about kernel heap usage.
This will be helpful as we work to improve it.

Without deallocations, we currently stand at the following alloc numbers
8 - 142
16 - 319
32 - 364

unsized - 305

total page usage including slabs is 12.
2023-11-15 12:36:18 -08:00
Drew Galbraith 4657c46f73 [Zion] Fix kernel heap distribution calculation. 2023-11-15 12:14:58 -08:00
Drew Galbraith d71d543b2a [Zion] Move to a kernel slab allocator that will allow easier dealloc. 2023-11-15 12:04:35 -08:00
Drew Galbraith e5568450c2 [Zion] Make kernel slab allocation failures less chatty.
We started to hit this constraint but the allocators are due for
a redesign that actually does deallocation soon.
2023-11-15 09:45:37 -08:00
Drew Galbraith a745f45b5d [Zion] Add a method to dump the bootloader memory regions. 2023-11-08 08:07:57 -08:00
Drew Galbraith 69aced2220 [Zion] Move to StrFormat for debug line. 2023-11-05 09:24:09 -08:00
Drew Galbraith 2b27af5814 [Yellowstone] Move to yunq definition for yellowstone server. 2023-10-24 18:24:26 -07:00
Drew Galbraith ee603b7478 [zion] Add a basic slab allocator to the kernel.
Don't free from the slab allocator yet but allocations appear to work.
2023-08-02 00:54:39 -07:00
Drew Galbraith e3a425e274 [zion] Use a separate stack for PF and GP faults in the kernel. 2023-08-01 23:11:12 -07:00
Drew Galbraith 02e6b49d90 [glacier] Add a vector class 2023-06-26 15:46:03 -07:00
Drew Galbraith 164309eada [zion] Add utility to zero out a page when allocating one. 2023-06-19 23:44:33 -07:00
Drew Galbraith 72885190e9 Resolved page faults from user stacks 2023-06-12 23:28:23 -07:00
Drew Galbraith b6735d3175 [zion] Fix an over-allocation bug when creating a memory object 2023-06-12 20:55:53 -07:00
Drew Galbraith 0f0e39d1e9 Further parse AHCI information.
Send an IDENTIFY command to each drive and set up a hook to handle
interrupts.
2023-06-12 19:20:51 -07:00
Drew Galbraith 4bd7f972c1 Add additional physical memory logging 2023-06-07 16:22:39 -07:00
Drew Galbraith 53ff49b265 Add preprocessor directives to supress logs per file.
Makes the output much cleaner by default but allows for getting more
infor if debugging in the future.
2023-06-07 13:51:13 -07:00
Drew Galbraith eb04242a59 Add a debug mode for the KernelHeap. 2023-06-07 10:01:22 -07:00
Drew Galbraith e246f28d9c Get the second process elf from a MemoryObject instead of hardcoding.
Allows us to delete the CopyIntoNonResidentProcess function and simply
rely on the MemoryObject copy functions.
2023-06-07 00:19:15 -07:00
Drew Galbraith 23895b5c6c Spawn Processes using memory primitives rather than and elf loader.
This allows us to remove the temporary syscall for that style of process
spawn.
2023-06-07 00:04:53 -07:00
Drew Galbraith b06c76e477 Create a MemoryObject class and use it to load programs. 2023-06-06 21:44:10 -07:00
Drew Galbraith 1fda0f3fae Move VirtualMemory to AddressSpace Object 2023-06-06 20:43:15 -07:00
Drew Galbraith b5ad454ad1 Move Process & Thread to the object folder. 2023-06-06 20:18:53 -07:00
Drew Galbraith ef8eb5d993 Add a threading syscall API. 2023-06-06 16:24:03 -07:00