324 Commits

Author SHA1 Message Date
Ashwin Naren
157c29104f formatting 2026-02-07 00:31:23 -08:00
Ashwin Naren
ab93101a9f implement STATX_MNT_ID for sys_statx 2026-02-07 00:31:23 -08:00
Ashwin Naren
8046d746dd implement more of sys_power 2026-02-07 00:31:23 -08:00
Matthew Leach
fc873a9b67 arm64: mem: AddresSpace: impl Drop
Implement the Drop trait on `Arm64ProcessAddressSpace` freeing up all
pages which have been used by this address space.
2026-01-30 19:39:59 -08:00
Matthew Leach
8a84ba0fb9 libkernel: arm64: pg_tables; pg_tear_down: new
Add a new module which walks the page table hierarchy for a given
address space and applies a freeing closure to every allocated frame.
2026-01-30 19:39:59 -08:00
Matthew Leach
c49396ed35 libkernel: arm64: pg_tables: get_idx: new
Add a function which returns a descriptor from a page table by it's
numerical index.
2026-01-30 19:39:59 -08:00
Ashwin Naren
62709be4d6 cmdline inode 2026-01-30 19:36:42 -08:00
Ashwin Naren
04ac1e8783 implement sys_waitid 2026-01-30 08:31:26 -08:00
Matthew Leach
64469bb79c Merge pull request #185 from hexagonal-sun/hardware-smp-fixes 2026-01-28 09:14:25 +00:00
Matthew Leach
462de189b0 arm64: boot: secondaries: ensure WFI doesn't trap
The WFI insn is set not to trap on the primary core. Ensure it's also
set on the secondary cores too.
2026-01-28 08:00:01 +00:00
Matthew Leach
ba53418382 arm64: secondary: ensure boot_ctx is flushed to RAM
When the secondary boots and derefes the boot_ctx pointer passed in as a
parameter, it reads NULL, causing the secondary to end up stuck in an
exception loop. The data is sat in the primary core's cache and hasn't
been flushed to RAM. Since the secondary starts without the MMU (and
caches) enabled, the CCI doesn't kick in and we read stale data.

Manually flush the boot_ctx data to RAM before waking up the secondary.
2026-01-28 08:00:01 +00:00
Matthew Leach
d92945379a arm64: memory: flush_to_ram: new
Create a new function which takes a pointer to an object `T` and ensures
that the data is flushed from the caches to the point of
coherency (RAM).
2026-01-28 08:00:01 +00:00
Ashwin Naren
253a907c62 fix tests 2026-01-27 00:31:47 -08:00
Ashwin Naren
17b347cdc4 naming changes 2026-01-27 00:31:47 -08:00
Ashwin Naren
04f015848b percpu refactor 2026-01-27 00:31:47 -08:00
Ashwin Naren
7c7776ba7b working top
implements enough of procfs for `top` to run
2026-01-27 00:31:47 -08:00
Matthew Leach
e7eebb4494 Merge pull request #183 from hexagonal-sun/procfs-maps
procfs: implement /proc/<PID>/maps
2026-01-27 07:26:59 +00:00
Ashwin Naren
4ba1c029f1 optimize docker image size 2026-01-26 23:22:34 -08:00
Matthew Leach
87fe041ba0 procfs: implement /proc/<PID>/maps
Implement the `maps` file which shows a process's VMA entries. Example
output:

```
[root@moss-machine /]# cat /proc/1/maps
500000000000-500000117000 r-xp 0000000000                    /bin/bash
50000012b000-500000130000 r--p 000011b000                    /bin/bash
500000130000-50000013e000 rw-p 0000120000                    /bin/bash
700000000000-70000002b000 r-xp 0000000000                    /lib/ld-linux-aarch64.so.1
70000003e000-700000040000 r--p 000002e000                    /lib/ld-linux-aarch64.so.1
700000040000-700000042000 rw-p 0000030000                    /lib/ld-linux-aarch64.so.1
7fffff510000-7fffff585000 r-xp 0000000000                    /usr/lib/libncursesw.so.6
7fffff585000-7fffff59b000 ---p 0000075000                    /usr/lib/libncursesw.so.6
7fffff59b000-7fffff5a0000 r--p 000007b000                    /usr/lib/libncursesw.so.6
7fffff5a0000-7fffff5a1000 rw-p 0000080000                    /usr/lib/libncursesw.so.6
7fffff5b0000-7fffff760000 r-xp 0000000000                    /usr/lib/libc.so.6
7fffff760000-7fffff76d000 ---p 00001b0000                    /usr/lib/libc.so.6
7fffff76d000-7fffff770000 r--p 00001bd000                    /usr/lib/libc.so.6
7fffff770000-7fffff772000 rw-p 00001c0000                    /usr/lib/libc.so.6
7fffff772000-7fffff779000 rw-p 0000000000
7fffff780000-7fffff7d9000 r-xp 0000000000                    /usr/lib/libreadline.so.8
7fffff7d9000-7fffff7ed000 ---p 0000059000                    /usr/lib/libreadline.so.8
7fffff7ed000-7fffff7f0000 r--p 000005d000                    /usr/lib/libreadline.so.8
7fffff7f0000-7fffff7f6000 rw-p 0000060000                    /usr/lib/libreadline.so.8
7fffff7f6000-7fffff7fb000 rw-p 0000000000
7fffff800000-800000063000 rw-p 0000000000                    [stack]
```
2026-01-27 06:10:43 +00:00
Ashwin Naren
d386b8ba36 post rebase fixes 2026-01-25 10:50:02 -08:00
Ashwin Naren
d8c77ebca7 procfs bugfixes 2026-01-25 10:50:02 -08:00
Ashwin Naren
d7ad7b76dc fix clocks not actually updating within time slice 2026-01-25 10:50:02 -08:00
Ashwin Naren
2d34ebcef9 procfs refactor 2026-01-25 10:50:02 -08:00
Ashwin Naren
c5a0976a73 track stime and utime
Tracks stime and utime for processes and tasks. Reports the times through procfs and `sys_clock_gettime`.
2026-01-25 10:50:02 -08:00
Ashwin Naren
bed6b65db0 fix clockid enum 2026-01-25 10:50:02 -08:00
Matthew Leach
3aca7b2122 devfs: set attr id the same as the inode id
Ensure that the ID of the attr contains the ID of the devfs inode,
instead of the default value.
2026-01-25 10:29:43 -08:00
Matthew Leach
4c94f6e3d4 pipe: add PipeInode for fstat
Add a PipeInode struct which allows `fstat` for an FD which is backed by
a pipe.
2026-01-25 10:29:43 -08:00
Matthew Leach
fae5dc1a4f usertest: fix test output
Since the test driver now outputs the test name, remove test name
printing in the signal tests.

Also flush stdout when the test has began running so if a problem
occures it's easier to know which test was running.
2026-01-25 10:29:16 -08:00
Matthew Leach
4a3477182a clock_nanosleep: fix arguments to syscall
The `sys_clock_nanosleep` implementation was missing a `flags` parameter
in the second position.  This meant that `rqtp` was interpreted as
`rmtp`, and when interrupted, `rmtp` would write to a garbage address
causing an `EFAULT`.

Fix the argument ordering.
2026-01-25 10:28:40 -08:00
Matthew Leach
53dea094e3 Merge pull request #175 from arihant2math/more-interrupts
Make futex wait interruptable
2026-01-24 07:09:17 +00:00
Ashwin Naren
59adc10cee make futex wait interruptable 2026-01-23 10:23:29 -08:00
Ashwin Naren
aa5a9c7b79 fix typos 2026-01-23 01:26:04 -08:00
Ashwin Naren
92efb4cee7 enforce semicolon_if_nothing_returned and uninlined_format_args 2026-01-23 01:26:04 -08:00
Matthew Leach
190bc06994 Merge pull request #160 from arihant2math/mincore 2026-01-21 06:12:40 +00:00
Ashwin Naren
aca5c0db79 implement mincore 2026-01-20 19:52:47 -08:00
Matthew Leach
9eb2fcc185 Merge pull request #172 from arihant2math/sid
Implement sid syscalls
2026-01-20 06:24:27 +00:00
Ashwin Naren
7e2de367a9 update table 2026-01-19 18:36:31 -08:00
Ashwin Naren
06d016eab6 implement sid syscalls 2026-01-19 18:36:00 -08:00
Matthew Leach
76d4d0023f Merge pull request #170 from arihant2math/better-ext4-writing 2026-01-19 16:19:14 +00:00
Matthew Leach
0979e5f71a Merge pull request #171 from arihant2math/fix-intermittent-ci 2026-01-19 16:18:12 +00:00
Ashwin Naren
fb27ed3320 add retry logic to wget 2026-01-18 17:02:52 -08:00
Ashwin Naren
8df12a027c implement truncation 2026-01-18 01:17:19 -08:00
Ashwin Naren
782bef29e6 move fs tests to their own file 2026-01-17 10:24:05 -08:00
Ashwin Naren
8908b1e332 use macro for registration 2026-01-17 10:24:05 -08:00
Matthew Leach
b9fa68d9a3 Merge pull request #167 from hexagonal-sun/fix-interrupt-poll-order 2026-01-17 17:13:15 +00:00
Matthew Leach
3b71fa3d39 signal: interruptible: prioritize wrapped future over signals
Poll the wrapped future first, ensuring that the interrupt logic doesn't
short-circuit a future which is already ready.

This fixes an issue where `sys_wait4` would return `-EINTR` when
receiving a `SIGCHLD`. Since `SIGCHLD` indicates the wait condition
is met, the underlying future is ready and should return the PID
successfully rather than aborting.
2026-01-17 12:10:37 +00:00
Matthew Leach
abccd323ca Merge pull request #164 from hexagonal-sun/tty-signal-fixes
tty signal fixes
2026-01-17 10:27:50 +00:00
Matthew Leach
bc5d1cd91e syscalls: wait4: make interruptable()
Make the `sys_wait4` system call interruptable via signal delivery.

Also include some a test in `usertest` to ensure proper functionality.
2026-01-17 10:22:53 +00:00
Matthew Leach
ecdfd360d1 sched: remove force_resched()
This function is used to force the scheduler to reschedule another task,
avoiding the fast-path exit.  Given the sheer number of task state
change points in the code, the fast-path exit code has become too
brittle.

Instead, check that the current task's state is still `Running` before
taking the fast-path short-circuit. The cost of one spinlock uncontended
lock-unlock cycle is worth the cost of avoiding many subtle scheduling
logic bugs.
2026-01-17 10:21:17 +00:00
Matthew Leach
4a88739804 syscalls: tty: read: make interruptable()
Allow a `read()` on a tty to be interrupted by a syscall. This is the
fundamental fix for making '^C' interrupt a process like `cat` when it's
reading from `stdin`.
2026-01-17 10:21:17 +00:00