Commit Graph

54 Commits

Author SHA1 Message Date
wash aa0933be10 vm: region: implement reading from a user-space vm-region into a kernel buffer 2026-02-21 11:16:11 +00:00
wash 8b188a0ac4 vm: region: fix iterator using wrong buffer offset when seek exceeds current buffer size 2026-02-21 11:07:53 +00:00
wash ed25ee6761 vm: object: fix iterator using wrong buffer offset when seek exceeds current buffer size 2026-02-21 11:07:12 +00:00
wash 0bae39e550 vm: zone: ensure memblock region bounds are page-aligned while creating zone blocks 2026-02-21 11:01:58 +00:00
wash 2b7e5368c9 vm: implement copying data between different vm-regions 2026-02-19 19:15:15 +00:00
wash c6e1ba21dd vm: implement direct read/write/copy access to vm-object memory 2026-02-19 19:09:38 +00:00
wash 2f413c603d kernel: all string parameters now take a corresponding length parameter 2026-02-19 19:08:17 +00:00
wash 6019c9307d kernel: separate headers into kernel and user headers
all kernel headers have been moved from include/mango to include/kernel
and include definitions that are only relevant to kernel-space.

any definitions that are relevant to both kernel- and user-space
(i.e. type definitions, syscall IDs) have been moved to
include/mango within libmango.
2026-02-19 18:54:48 +00:00
wash fb7d7635c2 vm: region: refactor to use offsets rather than absolute addresses 2026-02-08 15:51:51 +00:00
wash 883b5ac9e2 vm: add vm-region to manage userspace virtual memory address spaces
vm-region supports creating nested regions of virtual memory, each with their
own memory protection restrictions.

vm-objects can be mapped into a vm-region, making the underlying memory
accessible. all mappings are lazy: page tables are not updated until the
mapped memory is accessed.
2026-02-08 12:59:08 +00:00
wash b8ccffd2d4 vm: add vm-object to represent non-contiguous physical memory allocations
vm-object can be used to demand-allocate non-contiguous physical memory, and
will provide an api for userspace programs to do the same. unless a vm-object
is created in-place (i.e. to represent a specific area of physical memory),
its memory pages are only allocated when the object is mapped AND someone
attempts to access the memory.
2026-02-08 12:58:31 +00:00
wash b31c3a40b4 vm: sparse: ensure that vm_pages for the reserved bsp region are created 2026-02-08 12:51:55 +00:00
wash 2b1bed844a vm: change virt_to_phys param to const 2026-02-08 12:51:23 +00:00
wash 26afc3c6c3 vm: sparse: fix region base/limit alignment calculation 2026-02-08 12:50:08 +00:00
wash aaa76ff197 memblock: make virt_to_phys pointer param const 2026-02-08 12:33:03 +00:00
wash 0490541dc9 kernel: adjust formatting 2026-02-08 12:32:48 +00:00
wash 62ec4c93ab meta: rename 2024-11-02 11:31:51 +00:00
wash 149f49bd28 vm: limit sparse page init loop to last free page frame
when the sector coverage mode is set to free, the loop that initialises the vm_page structs for free and reserved pages is limited to the same upper bound that is used to calculate the sector size and count.
2023-12-30 15:29:48 +00:00
wash abfd97b924 memblock: fix bounds being ignored when iterating through total or reserved regions 2023-12-30 15:29:13 +00:00
wash 1c5c256c89 vm: sparse sector map now extends to cover only all free pages by default
by default, the sector map created under the sparse model now only extends to the last non-reserved page frame, any reserved page frames afterwards are ignored.
2023-12-29 19:53:31 +00:00
wash 8803c23f08 vm: improve memory usage under sparse with a high reserved memory ratio
previously, sparse would attempt to create a smaller number of larger sectors on systems with lots of reserved memory, often causing an out-of-memory condition. the reserved memory ratio calculation now compares reserved memory to free memory, rather than to the address of the last byte in physical memory. this improved heuristic means sparse is now better at choosing an appropriate sector size, allowing sparse to operate on systems with high amounts of reserved memory.
2023-12-24 09:39:28 +00:00
wash 8b99158d66 vm: fix overflow in memblock do_alloc when allocating large aligned blocks
allocating a large power-of-2 block with memblock may cause the base pointer of a region to exceed the limit pointer after it has been aligned during the free region scan in do_alloc().
2023-12-24 09:37:52 +00:00
wash 1cbab5f2f4 vm: optimise vm_zone_init by only making blocks from free regions during boot 2023-12-24 09:35:50 +00:00
wash 9f3c080e41 vm: minimum and maximum zone IDs are now defined in arch/../vm.h 2023-05-07 21:39:31 +01:00
wash 223b37a113 vm: only align slab headers when offslab is being used 2023-05-01 18:12:46 +01:00
wash b6f8c1ccaa kernel: don't use typedef for enums or non-opaque structs 2023-04-13 11:40:52 +01:00
wash b1b16ba19c kernel: reduce log message spam during boot 2023-04-09 17:14:19 +01:00
wash dd6c190720 memblock: fix returned memory region overrunning reserved memory region 2023-03-24 14:17:28 +00:00
wash 2bfb6bcd78 kernel: add c++ support 2023-03-20 20:41:39 +00:00
wash ff19915466 vm: mark memory holes as reserved under sparse memory model 2023-02-17 19:34:12 +00:00
wash 8c4c224435 vm: fix get_or_create_page not allocating enough memory for sparse page map 2023-02-08 21:29:45 +00:00
wash 22eabbedbc vm: log per-zone free memory during init 2023-02-08 21:29:20 +00:00
wash 9792aa512d vm: use vm_memory_mode() to determine which model to initialise 2023-02-08 21:28:47 +00:00
wash 6c6ca6920b vm: handle null vm_pages and empty zones in zone init 2023-02-08 20:26:51 +00:00
wash b32791ade7 vm: zero sector array; perform overflow checks 2023-02-08 20:26:18 +00:00
wash a595b3040a vm: remove debug message from get_or_create_page 2023-02-08 20:25:52 +00:00
wash a9f8069aab vm: add sparse mm support to vm_page functions 2023-02-08 20:25:24 +00:00
wash a7d4166c89 vm: implement a sparse memory model 2023-02-08 17:13:01 +00:00
wash b8eb88627a vm: add huge page order size definitions 2023-02-08 17:11:08 +00:00
wash 4edc7e308e vm: refactor page_array and functions into a separate source file 2023-02-07 21:18:08 +00:00
wash 9879bbf646 vm: optimise page array size and initialisation.
* the page array now only extends up to the last non-reserved memory frame.
* rather than memset'ing the whole array to zero, we only initialise p_flags
  for each page in vm_page_array_init, and then leave it to group_pages_into_block
  to initialise the other parts of vm_page_t.
2023-02-07 16:00:28 +00:00
wash 51ad3d48fd memblock: mark bytes preceding an aligned allocation as reserved.
this prevents tiny holes of free memory appearing between
blocks of aligned allocations.
2023-02-07 15:57:18 +00:00
wash e9d4b60181 vm: print log messages during initialisation 2023-02-07 15:43:14 +00:00
wash bf0b4d412c vm: use direct page mapping to convert virt/phys addresses 2023-02-07 15:40:06 +00:00
wash 0516ef06a3 vm: explicitly initialise kmalloc in vm_bootstrap
if kmalloc is called with count=N before vm_bootstrap is finished,
the request will be fulfilled using memblock_alloc.

if N is a power of 2, the returned pointer will be aligned to
an N-byte boundary.
2023-02-06 20:50:38 +00:00
wash 5c7bde4fdf vm: add alignment parameter to cache allocator
caches with object size N, where N is a power of two, will naturally
align their objects on N-byte boundaries.

all other caches will align to an 8-byte boundary by default.
2023-02-06 20:50:38 +00:00
wash 109616ec30 vm: add memblock support to vm_virt_to_phys, add vm_phys_to_virt 2023-02-06 20:50:38 +00:00
wash 998f05d337 memblock: add functions to convert allocated pointers between virt/phys 2023-02-06 20:50:38 +00:00
wash 6afb3bd10d memblock: add alignment parameter to alloc functions 2023-02-06 20:50:38 +00:00
wash 21907010bd memblock: return NULL on virtual alloc failure 2023-02-05 10:49:59 +00:00