570 Commits

Author SHA1 Message Date
Ashwin Naren
4f91fe87d6 fix clippy 2026-05-14 19:55:22 -07:00
Ashwin Naren
dbaf4077c7 formatting 2026-05-14 19:36:57 -07:00
Ashwin Naren
74b5e120b2 fix sys_sched_getaffinity 2026-05-14 19:24:43 -07:00
Ashwin Naren
4fd57b69e2 dep bump 2026-05-14 08:50:44 -07:00
Ashwin Naren
21a32453fc update syscall table 2026-05-13 15:27:10 -07:00
Matthew Leach
370f62194a libkernel: bump to v0.1.3 2026-05-13 21:23:50 +01:00
Ashwin Naren
39eaded4d0 Merge pull request #301 from hexagonal-sun/libkernel-yet-more-fixes
Libkernel yet more fixes
2026-05-13 13:01:17 -07:00
Matthew Leach
fee153d23c libkernel: region: add new utility functions
Add the following to all memory region variants:

 - `is_empty()`: Return true if the region has zero size.
 - `cap_size()`: Reduces the size if the given size < current.
 - `shrink_start()`: Move start address forward, while shrinking the
   region.
2026-05-13 17:10:29 +01:00
Matthew Leach
64c8b02904 libkernel: smalloc: don't ever allocate a null address
If a memory list begins at NULL, never give out that address. It trips
up UB checks, instead reserve the null page when that condition has been
detected.
2026-05-13 16:20:36 +01:00
Matthew Leach
0791b01f38 libkernel: paging: add translate
Add a `translate` function which is much more powerful that `get_pte`.
It permits block mappings to be returned for a given VA.
2026-05-13 16:19:52 +01:00
Ashwin Naren
971462ed8a implement exceptfds partially for sys_pselect6 to fix arch bash and sh. 2026-05-12 10:00:00 -07:00
Matthew Leach
acf03d7d68 Merge pull request #285 from arihant2math/new-systemd3
systemd part 3: Cgroup2 partial stubbing
2026-05-12 11:00:05 +01:00
Ashwin Naren
91117f8e51 post-rebase fix 2026-05-11 17:24:29 -07:00
Ashwin Naren
bb8dde3258 address review 2026-05-11 17:17:20 -07:00
Ashwin Naren
775824ed83 cgroup2 partial stubbing 2026-05-11 17:16:41 -07:00
Matthew Leach
3c0253e26a Merge pull request #294 from hexagonal-sun/libkernel-bump
libkernel: bump version
2026-05-11 11:04:03 +01:00
Matthew Leach
99631128af libkernel: bump version
Bump libkernel to v0.1.2
2026-05-11 11:03:08 +01:00
Matthew Leach
a6205c56fa Merge pull request #293 from hexagonal-sun/libkernel-virt-addr-spc
libkernel: address: add virtualisation guest types
2026-05-11 10:59:37 +01:00
Matthew Leach
a64d67237c libkernel: address: add virtualisation guest types
Add address types for use in virtualised environments.
2026-05-11 10:54:42 +01:00
Ashwin Naren
4bab25b87c more mapping of errors 2026-05-10 14:01:42 -07:00
Ashwin Naren
bce8d7c818 libkernel: Add support for xattr in ext4 2026-05-10 13:58:25 -07:00
Matthew Leach
d0e9cccd37 libkernel: memory: phys: expose MAX_ORDER const.
Expose the physical memory allocator MAX_ORDER const.
2026-05-10 13:57:49 -07:00
Matthew Leach
d807fecac2 libkernel: phys: support managing a sub-region of memory
Add `FrameAllocator::init_from_region`, which constructs a buddy frame
allocator over an explicit PhysMemoryRegion rather than the entire
memory span known to smalloc. This is a building block for managing
multiple disjoint memory pools (e.g. per-NUMA-node allocators).
2026-05-10 13:57:49 -07:00
Matthew Leach
052ca0e4e3 libkernel: smalloc: add claim_region for downstream allocators
Introduce Smalloc::claim_region, which removes a sub-region from the
free memory pool and transfers ownership to another allocator. The
region is punched out of the memory list rather than being added to the
reservation list.
2026-05-10 13:57:49 -07:00
Matthew Leach
72ef61fb10 libkernel: pg_tear_down: add more flexibility
The current tear down implementation assumes that all data mappings &
intermediate tables need to be free'd. That might not provide enough
flexibility for all tear-down scenarios.

Provide a more flexible API, passing current walk state into a control
function which makes a descision regarding tear-down and recursion.
2026-05-10 13:57:49 -07:00
Matthew Leach
d0b10adf7c libkernel: move SmallocPageAlloc into libkernel
The `SmallocPageAlloc` type is generic and architecture-independent, so
it belongs in libkernel rather than the kernel's arm64-specific code. It
is placed in memory::paging::smalloc_page_allocator and gated by the
existing paging feature.

The kernel's copy is replaced with a thin re-export so all call sites
are unaffected.
2026-05-10 13:57:49 -07:00
Matthew Leach
80af2e8852 libkernel: pg_offset: decouple from VirtualMemory trait
Since the only requirement for a `PageOffsetTranslator` is a constant
offset, pass that in as a generic parameter, allowing it to be decoupled
from the `VirtualMemory` trait.
2026-05-10 13:57:49 -07:00
Matthew Leach
370aae9697 libkernel: CpuOps: make interrupt flags a associated type
Rather than hard-coding the interrupt flags as a `usize`. Allow each CPU
architecture to define it's own interrupt flags type via an associated
type.
2026-05-10 13:57:49 -07:00
Ashwin Naren
20c17b69c5 implement F_DUPFD_CLOEXEC for fcntl 2026-04-26 21:21:20 -07:00
Matthew Leach
d7d9bfcddc Merge pull request #287 from hexagonal-sun/libkernel-v0-1-1
libkernel: v0.1.1
2026-04-23 21:35:21 +01:00
Matthew Leach
8f4692253e libkernel: v0.1.1 2026-04-23 21:15:23 +01:00
Matthew Leach
5af78647b0 Merge pull request #274 from arihant2math/better-timers 2026-04-23 17:36:24 +01:00
Matthew Leach
4a6ef6f3de Merge pull request #257 from arihant2math/unix-dgram 2026-04-23 17:36:01 +01:00
Ashwin Naren
99d72786ad address review 2026-04-23 09:10:51 -07:00
Matthew Leach
6e3a306d28 Merge pull request #286 from hexagonal-sun/libkernel-fix-last-entry-pg-table-walking 2026-04-23 06:04:40 +01:00
Matthew Leach
6d41e485b3 libkernel: pg_walk: use saturating arithmetic to avoid overflow at last page-table entry
The generic RecursiveWalker computed the coverage region for each
page-table entry as:

    VirtMemoryRegion::new(entry_va, table_coverage).intersection(region)

For the last entry at the PML4 level (PML4[511]) in the kernel
high-half, entry_va + table_coverage wraps past usize::MAX, causing an
arithmetic overflow panic inside end_address().

Fix this in walk.rs by computing the intersection bounds with
saturating_add/min/max directly.

Add regression tests for all levels, ensuring last-element walking is
correct.
2026-04-21 15:56:56 +01:00
Ashwin Naren
bf73a8914f use generic wakeup instead of specialized 2026-04-18 18:39:28 -07:00
Ashwin Naren
65d0581736 implement itimer syscalls 2026-04-18 18:39:28 -07:00
Ashwin Naren
6b97bab57f wake signalfd readers on signal delivery
- add per-task signal waiter notifier
- wake waiters when task/group signals are queued
- replace signalfd polling sleep with waker-based waiting
- route SIGCHLD and other signal enqueue sites through shared helpers
2026-04-17 14:22:15 -07:00
Ashwin Naren
14ae01767d address review 2026-04-17 14:22:15 -07:00
Ashwin Naren
2654126644 fix usertest warning 2026-04-17 14:22:15 -07:00
Ashwin Naren
defa422243 signal4fd syscall 2026-04-17 14:22:15 -07:00
Ashwin Naren
e2202e1cb8 epoll implementation 2026-04-17 14:22:15 -07:00
Ashwin Naren
3ddcc8e7b3 pidfd stub 2026-04-17 14:22:15 -07:00
Matthew Leach
68e1b57739 libkernel: error: fix doc error
Fix a doc error in the libkernel::error module.
2026-04-17 22:17:40 +01:00
Matthew Leach
6a876bb0ed Merge pull request #283 from hexagonal-sun/libkernel/x86_64-paging
libkernel/x86 64 paging
2026-04-17 22:14:09 +01:00
Matthew Leach
519fd94eda libkernel: x86_64: pg_tables: ensure canonical address
Ensure that we only try to map canonical addresses in `try_map`.
2026-04-17 22:10:39 +01:00
Matthew Leach
52270c7525 libkernel: pg_tear_down: support block mappings
Support tearing down block mappings when walking the page table
hierarchy.
2026-04-17 22:10:39 +01:00
Matthew Leach
41ffd1b157 Merge pull request #284 from arihant2math/ext4plus-bump2
Bump ext4plus
2026-04-17 11:21:48 +01:00
Ashwin Naren
1793e24cb8 bump ext4plus 2026-04-16 21:06:52 -07:00