4f2a0436eb
Phase A of the ACPI fork-sync plan (local/docs/ACPI-FORK-SYNC-STRATEGY-2026-06-30.md). Restores the kernel to the upstream Redox OS kernel main branch state for the ACPI subsystem: - Cargo.toml: switch redox_syscall from 0.7.4 (two versions behind) to a git ref of gitlab.redox-os.org/redox-os/syscall.git, matching the upstream master dependency. The crates.io 0.8.1 release predates the AcpiVerb enum that MR #613 / MR #275 introduced, so a crates.io pin is insufficient. - src/acpi/rsdp.rs: full rewrite to match upstream f49c7d99 (RSDP validation + NonNull + fail-softly): * signature check "RSD PTR " * 20-byte base checksum * full-length checksum for revision >= 2 * NonNull<u8> instead of *const u8 Fixes gap #1 from the 2026-06-30 ACPI assessment: the kernel was accepting any pointer from the bootloader without validation. - src/startup/mod.rs: acpi_rsdp() returns Option<NonNull<u8>> to match the new Rsdp::get_rsdp signature. - src/acpi/mod.rs: init() takes Option<NonNull<u8>>. - src/scheme/acpi.rs: full rewrite to upstream MR #613 (Simplify acpi scheme). Drops the /scheme/kernel.acpi/ filesystem surface in favor of a single Fd::open + call() interface with AcpiVerb verbs: * AcpiVerb::ReadRxsdt - returns the raw RXSDT bytes * AcpiVerb::CheckShutdown - returns whether shutdown is pending Uses HandleBits bitflags, atomic EXISTS_KSTOP_HANDLE, Mutex<L4> from crate::sync::ordered. Replaces /scheme/kernel.acpi/rxsdt and /scheme/kernel.acpi/kstop files. - src/scheme/mod.rs: KernelScheme::kcall signature updated to take fds: &[usize] instead of id: usize (matches upstream). kfpath now has a default body returning EOPNOTSUPP (matches upstream). - src/scheme/memory.rs, proc.rs, user.rs: kcall impls updated to match new trait signature, using fds.first() to extract the single handle for backward compat. - src/scheme/proc.rs: kcall dispatch adds _ => Err(EINVAL) catch-all for the new ProcSchemeVerb variants (RegsInt, RegsFloat, RegsEnv, SchedAffinity, Start) that the gitlab syscall crate adds. These verbs are not yet implemented in the proc scheme; the catch-all returns EINVAL cleanly instead of failing to compile. - src/syscall/fs.rs: SYS_CALL dispatcher now passes &[number] to scheme.kcall() to match the new trait signature. - Makefile: removed -Z json-target-spec flag (promoted to stable in nightly 2026-04-01; the flag is unknown in our pinned toolchain). Verified by `make` in local/sources/kernel/ with PATH including the prefix cross-toolchain: kernel builds and links successfully.
121 lines
3.8 KiB
TOML
121 lines
3.8 KiB
TOML
[workspace]
|
|
resolver = "3"
|
|
|
|
[package]
|
|
name = "kernel"
|
|
version = "0.5.12"
|
|
build = "build.rs"
|
|
edition = "2024"
|
|
|
|
[build-dependencies]
|
|
cc = "1.0"
|
|
toml = "0.8"
|
|
|
|
[dependencies]
|
|
arrayvec = { version = "0.7.4", default-features = false }
|
|
bitfield = "0.13.2"
|
|
bitflags = "2"
|
|
fdt = { git = "https://github.com/repnop/fdt.git", rev = "2fb1409edd1877c714a0aa36b6a7c5351004be54" }
|
|
hashbrown = { version = "0.14.3", default-features = false, features = ["ahash", "inline-more"] }
|
|
linked_list_allocator = "0.9.0"
|
|
redox-path = "0.2.0"
|
|
redox_syscall = { git = "https://gitlab.redox-os.org/redox-os/syscall.git", default-features = false }
|
|
rmm = { path = "rmm", default-features = false }
|
|
slab = { version = "0.4", default-features = false }
|
|
smallvec = { version = "1.15.1", default-features = false }
|
|
spin = { version = "0.9.8" }
|
|
|
|
[dependencies.object]
|
|
version = "0.37.1"
|
|
default-features = false
|
|
features = ["read_core", "elf"]
|
|
|
|
[dependencies.rustc-demangle]
|
|
version = "0.1.16"
|
|
default-features = false
|
|
|
|
[lints.clippy]
|
|
# Overflows are very, very bad in kernel code as it may provide an attack vector for
|
|
# userspace applications, and it is only checked in debug builds
|
|
# TODO: address occurrences and then deny
|
|
arithmetic_side_effects = "warn"
|
|
cast_ptr_alignment = "warn" # TODO: address occurrences and then deny
|
|
identity_op = "allow" # Used to allow stuff like 1 << 0 and 1 * 1024 * 1024
|
|
if_same_then_else = "allow" # Useful for adding comments about different branches
|
|
# Indexing a slice can cause panics and that is something we always want to avoid
|
|
# in kernel code. Use .get and return an error instead
|
|
# TODO: address occurrences and then deny
|
|
indexing_slicing = "warn"
|
|
many_single_char_names = "allow" # Useful in the syscall function
|
|
module_inception = "allow" # Used for context::context
|
|
# Not implementing default is sometimes useful in the case something has significant cost
|
|
# to allocate. If you implement default, it can be allocated without evidence using the
|
|
# ..Default::default() syntax. Not fun in kernel space
|
|
new_without_default = "allow"
|
|
not_unsafe_ptr_arg_deref = "deny"
|
|
or_fun_call = "allow" # Used to make it nicer to return errors, for example, .ok_or(Error::new(ESRCH))
|
|
precedence = "deny"
|
|
ptr_cast_constness = "deny"
|
|
too_many_arguments = "allow" # This is needed in some cases, like for syscall
|
|
# Avoid panicking in the kernel without information about the panic. Use expect
|
|
# TODO: address occurrences and then deny
|
|
unwrap_used = "warn"
|
|
|
|
[lints.rust]
|
|
static_mut_refs = "warn" # FIXME deny once all occurrences are fixed
|
|
# This is usually a serious issue - a missing import of a define where it is interpreted
|
|
# as a catch-all variable in a match, for example
|
|
unreachable_patterns = "deny"
|
|
unused_must_use = "deny" # Ensure that all must_use results are used
|
|
|
|
[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
|
|
raw-cpuid = "10.2.0"
|
|
x86 = { version = "0.47.0", default-features = false }
|
|
|
|
[target.'cfg(any(target_arch = "riscv64", target_arch = "riscv32"))'.dependencies]
|
|
sbi-rt = "0.0.3"
|
|
|
|
[features]
|
|
default = [
|
|
"acpi",
|
|
#"debugger",
|
|
"multi_core",
|
|
"serial_debug",
|
|
"self_modifying",
|
|
"x86_kvm_pv",
|
|
#"busy_panic",
|
|
#"drop_panic",
|
|
#"syscall_debug"
|
|
]
|
|
|
|
# Activates some limited code-overwriting optimizations, based on CPU features.
|
|
self_modifying = []
|
|
|
|
acpi = []
|
|
lpss_debug = []
|
|
multi_core = ["acpi"]
|
|
profiling = []
|
|
#TODO: remove when threading issues are fixed
|
|
pti = []
|
|
drop_panic = []
|
|
busy_panic = []
|
|
qemu_debug = []
|
|
serial_debug = []
|
|
system76_ec_debug = []
|
|
x86_kvm_pv = []
|
|
|
|
debugger = ["syscall_debug"]
|
|
syscall_debug = []
|
|
|
|
sys_fdstat = []
|
|
|
|
[profile.dev]
|
|
# Avoids having to define the eh_personality lang item and reduces kernel size
|
|
panic = "abort"
|
|
|
|
[profile.release]
|
|
# Avoids having to define the eh_personality lang item and reduces kernel size
|
|
panic = "abort"
|
|
#lto = true
|
|
debug = "full"
|