Commit Graph

61 Commits

Author SHA1 Message Date
eb8758bc5e vm: region: fix some cases where regions weren't being unlocked after use. 2026-02-26 19:41:40 +00:00
34bd6e479c vm: region: add nr_bytes_moved output param to memmove_v 2026-02-23 21:50:35 +00:00
5f0654430d syscall: add task_self, task_get_address_space, and vm_region_kill 2026-02-23 18:43:49 +00:00
b2d04c5983 vm: object: zero-initialise pages allocated for vm-object 2026-02-21 23:19:49 +00:00
044b3688aa vm: cache: all allocations are now zero-initialised 2026-02-21 23:18:09 +00:00
855440f584 vm: add trace output 2026-02-21 11:22:51 +00:00
e1e025ab6a vm: region: memmove_v() now supports iovec arrays stored in userspace 2026-02-21 11:20:09 +00:00
aa0933be10 vm: region: implement reading from a user-space vm-region into a kernel buffer 2026-02-21 11:16:11 +00:00
8b188a0ac4 vm: region: fix iterator using wrong buffer offset when seek exceeds current buffer size 2026-02-21 11:07:53 +00:00
ed25ee6761 vm: object: fix iterator using wrong buffer offset when seek exceeds current buffer size 2026-02-21 11:07:12 +00:00
0bae39e550 vm: zone: ensure memblock region bounds are page-aligned while creating zone blocks 2026-02-21 11:01:58 +00:00
2b7e5368c9 vm: implement copying data between different vm-regions 2026-02-19 19:15:15 +00:00
c6e1ba21dd vm: implement direct read/write/copy access to vm-object memory 2026-02-19 19:09:38 +00:00
2f413c603d kernel: all string parameters now take a corresponding length parameter 2026-02-19 19:08:17 +00:00
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
fb7d7635c2 vm: region: refactor to use offsets rather than absolute addresses 2026-02-08 15:51:51 +00:00
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
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
b31c3a40b4 vm: sparse: ensure that vm_pages for the reserved bsp region are created 2026-02-08 12:51:55 +00:00
2b1bed844a vm: change virt_to_phys param to const 2026-02-08 12:51:23 +00:00
26afc3c6c3 vm: sparse: fix region base/limit alignment calculation 2026-02-08 12:50:08 +00:00
aaa76ff197 memblock: make virt_to_phys pointer param const 2026-02-08 12:33:03 +00:00
0490541dc9 kernel: adjust formatting 2026-02-08 12:32:48 +00:00
62ec4c93ab meta: rename 2024-11-02 11:31:51 +00:00
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
abfd97b924 memblock: fix bounds being ignored when iterating through total or reserved regions 2023-12-30 15:29:13 +00:00
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
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
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
1cbab5f2f4 vm: optimise vm_zone_init by only making blocks from free regions during boot 2023-12-24 09:35:50 +00:00
9f3c080e41 vm: minimum and maximum zone IDs are now defined in arch/../vm.h 2023-05-07 21:39:31 +01:00
223b37a113 vm: only align slab headers when offslab is being used 2023-05-01 18:12:46 +01:00
b6f8c1ccaa kernel: don't use typedef for enums or non-opaque structs 2023-04-13 11:40:52 +01:00
b1b16ba19c kernel: reduce log message spam during boot 2023-04-09 17:14:19 +01:00
dd6c190720 memblock: fix returned memory region overrunning reserved memory region 2023-03-24 14:17:28 +00:00
2bfb6bcd78 kernel: add c++ support 2023-03-20 20:41:39 +00:00
ff19915466 vm: mark memory holes as reserved under sparse memory model 2023-02-17 19:34:12 +00:00
8c4c224435 vm: fix get_or_create_page not allocating enough memory for sparse page map 2023-02-08 21:29:45 +00:00
22eabbedbc vm: log per-zone free memory during init 2023-02-08 21:29:20 +00:00
9792aa512d vm: use vm_memory_mode() to determine which model to initialise 2023-02-08 21:28:47 +00:00
6c6ca6920b vm: handle null vm_pages and empty zones in zone init 2023-02-08 20:26:51 +00:00
b32791ade7 vm: zero sector array; perform overflow checks 2023-02-08 20:26:18 +00:00
a595b3040a vm: remove debug message from get_or_create_page 2023-02-08 20:25:52 +00:00
a9f8069aab vm: add sparse mm support to vm_page functions 2023-02-08 20:25:24 +00:00
a7d4166c89 vm: implement a sparse memory model 2023-02-08 17:13:01 +00:00
b8eb88627a vm: add huge page order size definitions 2023-02-08 17:11:08 +00:00
4edc7e308e vm: refactor page_array and functions into a separate source file 2023-02-07 21:18:08 +00:00
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
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
e9d4b60181 vm: print log messages during initialisation 2023-02-07 15:43:14 +00:00