Commit Graph

63 Commits

Author SHA1 Message Date
vasilito d64482f1a2 fadt: use FADT base address for fixed-register offsets (not data_address); futex: import FUTEX_REQUEUE 2026-07-09 11:16:45 +03:00
vasilito 2fc628fcdf kernel: implement FUTEX_REQUEUE operation
Added FUTEX_REQUEUE (opcode 2) to the futex syscall implementation.
Cross-referenced with Linux 7.1 kernel/futex/requeue.c futex_requeue().

Operation: wake up to  waiters on the primary futex, and
requeue up to  waiters to a secondary futex at addr2.
This avoids the thundering herd problem in pthread condition
variable broadcast: instead of waking all waiters and having
them immediately contend, most are moved to a private futex
where they wake one at a time.

Previously the futex syscall would return EINVAL for FUTEX_REQUEUE,
breaking pthread_cond_broadcast on contended condition variables.
2026-07-09 10:48:47 +03:00
vasilito ca67b1da37 0.3.0: converge kernel onto upstream master
- Rebase all Red Bear kernel changes onto upstream master (4d5d36d4).
- Update version to 0.5.12+rb0.3.0 and add Red Bear author attribution.
- Switch redox_syscall direct dependency to local fork path (../syscall).
- Bump rust-toolchain.toml to nightly-2026-05-24.
- Regenerate Cargo.lock for +rb0.3.0 suffixes and path deps.
2026-07-06 18:43:52 +03:00
Wildan M 973ac667e3 Use syscall time helper functions 2026-05-30 12:29:38 +07:00
Wildan M f70905d439 Resolve warnings 2026-05-23 00:04:34 +07:00
Wildan M 805f921e10 Use weak context for Proc and Futex 2026-05-20 12:57:37 +07:00
Wildan M 8c9def2d73 Lazily clean up futex 2026-05-13 20:49:02 +07:00
Wildan M ff11f47404 Add futex, pipe, timeout subscribers 2026-05-13 10:46:38 +07:00
bjorn3 654ee6ca3e size_of and align_of are part of the prelude nowadays 2026-04-09 15:23:34 -06:00
bjorn3 ab4abf63c9 Deduplicate Page and other paging related things between architectures 2026-04-03 22:15:00 +02:00
Wildan M d835a3d8f0 Solve all borrow checker leaving some violation 2026-04-01 08:42:18 -06:00
Wildan M a42ec44dbf Partially solve borrow rules 2026-04-01 08:42:18 -06:00
Wildan M 3b5a0e4c60 Apply ordered lock to AddrSpaceWrapper without solving borrow checker 2026-04-01 08:42:18 -06:00
bjorn3 c51aa1ef86 rmm: Make a couple of methods safe 2026-03-29 14:16:53 +02:00
Ron Williams fde164b2a0 Revert "Deficit based Weighted Round Robin Scheduler"
This reverts commit b7dabfc3c2.
2026-03-22 18:44:41 +00:00
Akshit Gaur b7dabfc3c2 Deficit based Weighted Round Robin Scheduler 2026-03-22 07:00:31 -06:00
auronandace 14b8c2b0c1 enforce two lints and collapse some ifs 2026-03-03 14:51:32 +00:00
auronandace 7770a9452c avoid direct indexing futexes 2026-02-23 11:57:28 +00:00
auronandace df469ddcb3 apply is_multiple_of lint 2026-02-21 08:39:26 +00:00
Anhad Singh a245e49e75 fix(syscalls/futex): premature timeout
Previously, if a futex with a timeout was woken up (even via
`futex_wake`), it was treated as though the timeout had expired. When
the timeout expires, the scheduler sets `wake` to `None` and unblocks
the process. Hence if `wake` is `None` and if a timeout was given to
futex, it has expired. Otherwise the process was woken up by
`futex_wake`.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-01-07 14:45:01 +11:00
Jeremy Soller e6edef2d8e Downgrade addrspace outside futex loop 2025-11-12 10:34:18 -07:00
Jeremy Soller 7834392dba Use hashmap for futex 2025-11-12 08:03:24 -07:00
Speedy_Lex 0931a7f49f Resolve a huge portion of the clippy lints 2025-10-06 06:30:23 -06:00
Jeremy Soller 5dc6f7c3ba lock ordering 2025-09-22 07:48:48 -06:00
4lDO2 c54195f10d Ensure process signals can also interrupt. 2024-07-17 17:31:05 +02:00
4lDO2 6bd01513c5 Simplify and improve thread/process cleanup. 2024-07-15 18:08:43 +02:00
4lDO2 80fe891c6e WIP: Replace ContextId with direct Arcs. 2024-07-15 18:08:42 +02:00
4lDO2 d94baa2712 Run rustfmt. 2024-07-15 17:50:18 +02:00
4lDO2 5e7db80285 Fix a bunch of warnings. 2024-07-15 17:48:45 +02:00
4lDO2 465128da26 Don't block nanosleep/futex <= signals are pending. 2024-07-15 17:20:57 +02:00
4lDO2 7f409d46bf Fix futex wakeup when CoW has occurred. 2024-04-28 15:17:32 +02:00
Jacob Lorentzon cd3f937861 Make futex timeout absolute, and properly return ETIMEDOUT 2024-04-05 20:31:03 +00:00
4lDO2 239bd317e9 Fix signal ordering wrt syscall return. 2024-03-16 17:49:31 +01:00
4lDO2 1f8d7bc67c Always check shootdown reqs when locking addrsp. 2024-03-04 19:03:01 +01:00
4lDO2 156017a25d Refactor: wrap RwLock<AddrSpace>. 2024-03-04 19:03:00 +01:00
bjorn3 782ec87f27 Fix UB in the locking code of context switching
The spin crate considers it UB to call force_write_unlock while there is
a threads trying to obtain a read lock on the same rwlock.

This also switches to the spinning_lot crate for the context rwlock as
it has support for a write guard keeping a reference to the rwlock using
an Arc instead of a reference.
2024-02-25 17:07:41 +01:00
Jeremy Soller 45f1c4e29e Add rustfmt from relibc and apply it with cargo fmt 2024-01-17 13:52:01 -07:00
4lDO2 2070fa44b7 Fix warnings. 2023-08-02 13:07:49 +02:00
4lDO2 885f88b777 Fix futex for non-AtomicU64-capable targets. 2023-07-27 16:44:26 +02:00
bjorn3 437b70838f Replace uses of atomic_* intrinsics with Atomic* types 2023-07-10 17:02:01 +02:00
4lDO2 56f88e80c2 Usercopy migration 2023-07-06 13:03:21 +00:00
4lDO2 a5168b4442 Fix warnings. 2023-04-30 18:11:20 +02:00
4lDO2 6c3f577f05 Also translate the 12-bit page offset in SYS_FUTEX. 2023-04-30 17:53:17 +02:00
Jeremy Soller cb58500b68 Update for new Rust 2023-02-11 14:50:55 -07:00
Jeremy Soller 31868077f0 Use u128 for time, store CPU time of processes 2022-11-14 10:10:17 -07:00
Jeremy Soller 8e0f54cb31 Clippy fixes 2022-11-11 13:19:14 -07:00
Jeremy Soller 5d55d4eb87 Fix warnings 2022-07-29 18:33:54 -06:00
Jeremy Soller 0c80643077 Make graphical_debug arch independent and fix lots of warnings 2022-07-29 15:56:44 -06:00
4lDO2 c912d9e0db Partial: migrate syscall handling code to RMM. 2022-07-27 10:52:23 +02:00
Jeremy Soller 515cab03eb Fix a number of warnings 2021-11-29 20:01:27 -07:00