Commit Graph

464 Commits

Author SHA1 Message Date
Matthew Leach
5ebfc29cd2 sched: introduce Work as the unified scheduleable unit
Refactor the scheduler so all scheduleable work is wrapped in Arc<Work>,
replacing the previous per-CPU wait_q design where sleeping tasks were
bound to a specific CPU. Wakers now hold direct Arc<Work> references and
can re-enqueue tasks on any CPU upon wakeup.

Key changes:

- Add Work struct wrapping OwnedTask with an AtomicTaskState and
  scheduler metadata (SchedulerData), replacing the old SchedulableTask.
  Remove Task::state (Arc<SpinLock<TaskState>>). Work::state is now the
  single source of truth for task state.

- Rewrite the run queue using BinaryHeap-based eligible/ineligible split
  (EEVDF) with a dedicated VClock, replacing the BTreeMap linear scan.
  Extract vclock into its own module.

- Rewrite wakers to hold Arc<Work> directly instead of looking up tasks
  by TaskDescriptor from TASK_LIST.

- Replace lock-based sleep transitions in uspc_ret with atomic CAS
  (try_sleep_current) that correctly detects concurrent Woken state.

- Simplify least-tasked-CPU metric to use only run-queue weight, since
  sleeping tasks are no longer bound to any CPU.

- Add current_work() accessor.
2026-03-12 10:53:22 +00:00
Matthew Leach
e12af349ad Merge pull request #258 from arihant2math/ext4plus-update
Update ext4plus to 0.1.0-alpha.5
2026-03-12 09:54:06 +00:00
Ashwin Naren
654b31efc6 bump to 0.1.0-alpha.5 2026-03-11 00:32:33 -07:00
Ashwin Naren
136fb16275 set time of creation correctly 2026-03-10 23:37:29 -07:00
Ashwin Naren
4212b85e6c update ext4plus to 0.1.0-alpha.4 2026-03-10 17:08:46 -07:00
Matthew Leach
5becb38531 Merge pull request #253 from arihant2math/socket-fixups 2026-03-08 05:40:57 +00:00
Matthew Leach
ce156c1bd8 Merge pull request #255 from arihant2math/fix-uart-freeze 2026-03-08 05:36:24 +00:00
Matthew Leach
9491549ae9 Merge pull request #256 from arihant2math/arm-gic-v2 2026-03-08 05:35:56 +00:00
Ashwin Naren
0d466dce19 finish implementation of arm GIC v2 driver 2026-03-07 18:40:40 -08:00
Ashwin Naren
50dcaf2f14 proper draining of uart 2026-03-07 18:00:07 -08:00
Ashwin Naren
4a12208d9f fix linux incompatibilities 2026-03-07 17:42:57 -08:00
Ashwin Naren
3760868d83 remove old framebuffer debugging logic 2026-03-07 17:39:57 -08:00
Ashwin Naren
83ec279895 Merge pull request #254 from hexagonal-sun/dont-override-probe-fns
drivers: init: don't override probe_fns
2026-03-07 15:28:27 -08:00
Matthew Leach
9fc7066eff drivers: init: don't override probe_fns
If multiple drivers are associated with a compatible string, don't
override an existing probe_fn. Instead, store a list of associated
probe_fns. Once a probe_fn has claimed the device stop calling the
associated probe chain.
2026-03-07 20:08:14 +00:00
Ashwin Naren
54265fdae0 support for ARM PL031 RTC 2026-03-06 23:51:04 -08:00
Ashwin Naren
9fea27a427 dependency updates (#248) 2026-03-06 23:47:10 -08:00
Matthew Leach
ebd893bcaa Merge pull request #246 from hexagonal-sun/virtio-rng
virtio rng
2026-03-07 07:37:08 +00:00
Matthew Leach
4a98779020 Add virtio-rng driver and ProbeError::NoMatch for silent probe skipping
Add a virtio-rng entropy source driver that registers with the kernel
RNG subsystem. Introduce `ProbeError::NoMatch` so virtio drivers can
silently reject empty or wrong-type MMIO slots without spamming the boot
log with fatal errors or leaving devices stuck in the deferred queue.
2026-03-07 07:33:31 +00:00
Matthew Leach
70ce893daf rand: add EntropySource
Add an `EntropySource` trait which allows the `EntropyPool` to pull
entropy from various sources.
2026-03-07 07:33:18 +00:00
Matthew Leach
79b2df5bf4 tty: add entropy
Add entropy to the entropy pool when processing input on TTYs.
2026-03-07 07:33:18 +00:00
Matthew Leach
65517c6641 Add BLAKE2s entropy pool with per-CPU ChaCha20 CSPRNG
Replace the single `SmallRng` with a proper two-layer RNG architecture:

- Global BLAKE2s-256 entropy pool that accumulates entropy and gates
  seed extraction behind a 256-bit threshold.
- Per-CPU ChaCha20Rng instances that are lazily seeded from the pool on
  first use and periodically reseed every 1 MB by XOR-ing a fresh BLAKE2
  extract with 32 bytes of their own output.

The /dev/random chardev uses fill_random_bytes directly instead of
routing through the syscall layer.
2026-03-07 07:33:15 +00:00
Matthew Leach
0e7b342d0a Merge pull request #250 from arihant2math/fix-clippy-again
Fix clippy again
2026-03-07 07:27:06 +00:00
Ashwin Naren
64f320c7c7 fix clippy again 2026-03-06 19:46:38 -08:00
Ashwin Naren
a3a324148e Socket implementation (#127) 2026-03-06 18:54:36 -08:00
Matthew Leach
594a1287ea only enable core_intrinsics when testing 2026-03-06 13:13:31 -08:00
Ashwin Naren
1523b9ccef switch to crates.io ext4plus 2026-03-04 15:48:18 -08:00
Ashwin Naren
f7757325ca fix panic if no display exists 2026-03-04 12:13:01 -08:00
Ashwin Naren
697254d7a9 address review 2026-03-04 12:13:01 -08:00
Ashwin Naren
4588e61aef GPU support with virtio driver 2026-03-04 12:13:01 -08:00
Matthew Leach
172ac28126 Merge pull request #244 from arihant2math/fix-arch-ls
Distinguish between file permissions and file mode
2026-03-03 07:33:21 +00:00
Matthew Leach
7c007b7c9f Merge pull request #243 from arihant2math/fix-justfile
Fix justfile
2026-03-03 07:31:24 +00:00
Ashwin Naren
edca499714 distinguish between file permissions and file mode 2026-03-02 11:53:06 -08:00
Ashwin Naren
28c1ca3fa3 fix justfile 2026-03-02 09:48:28 -08:00
Matthew Leach
d164e06558 Merge pull request #241 from TroyNeubauer/handle-sigsev 2026-03-02 06:17:23 +00:00
Troy Neubauer
15605b11ef no pub on location 2026-03-01 04:26:49 -08:00
Troy Neubauer
5cdeb82dfa clippy 2026-03-01 04:23:47 -08:00
Troy Neubauer
c180f1ca24 stack overflow test 2026-03-01 03:59:38 -08:00
Troy Neubauer
1bcd8b90ae Merge remote-tracking branch 'upstream/master' into handle-sigsev 2026-03-01 03:32:47 -08:00
Matthew Leach
912dc0f713 Merge pull request #239 from arihant2math/get-process-api 2026-03-01 05:55:17 +00:00
Matthew Leach
0105caf8dc Merge pull request #238 from TroyNeubauer/add-nix-shell 2026-03-01 05:53:27 +00:00
Ashwin Naren
ce27c4bc36 add find_process_by_tgid 2026-02-28 17:09:07 -08:00
Troy Neubauer
fc3e39fb54 Merge branch 'add-nix-shell' of github.com:TroyNeubauer/moss-kernel into add-nix-shell 2026-02-28 16:34:15 -08:00
Troy Neubauer
d28959937f update to 2-24 toolchain to avoid rust-analyzer #21715 2026-02-28 16:32:10 -08:00
Troy Neubauer
17769108dd Update flake.nix
Co-authored-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-28 13:16:41 -08:00
Troy Neubauer
6a0fb71cb6 Update flake.nix
Co-authored-by: Ashwin Naren <arihant2math@gmail.com>
2026-02-28 13:16:25 -08:00
Troy Neubauer
07044d1c4c add nix shell 2026-02-28 12:11:59 -08:00
Troy Neubauer
6a7c40c545 un-register rust's SIGSEV handler in test 2026-02-28 11:53:08 -08:00
Matthew Leach
e114a64a82 Merge pull request #237 from arihant2math/sigsev
Handle SIGSEVs correctly
2026-02-28 19:19:46 +00:00
Troy Neubauer
704f4e05f0 segfault properly 2026-02-28 10:32:05 -08:00
Ashwin Naren
c35982c9ea deliver signal to process on sig sev instead of panicking 2026-02-27 17:24:24 -08:00