Skip to main content

kernel/
config.rs

1// SPDX-License-Identifier: GPL-3.0-only
2//! Compile-Time Kernel Config; configure the compiled kernel's default params
3//!
4//! Authors: MarioS271
5
6use crate::kprint::log_entry::LogLevel;
7use crate::kprint::state::LogTargets;
8use crate::lib::types::boot_info::PanicAction;
9
10////////////////////// LOGGING ////////////////////// 
11/// The max log level to use unless configured otherwise by the kernel cmd line
12pub const MAX_LOG_LEVEL: LogLevel = LogLevel::Info;
13
14/// The default log targets which should recieve logs
15pub const DEFAULT_LOG_TARGETS: LogTargets = LogTargets::ALL;
16
17
18////////////////////// OTHER //////////////////////
19/// The default action to take on a kernel panic
20///
21/// This value should be zero in the [`PanicAction`] definition to avoid moving
22/// structs which statically initialize this from `.bss` to `.data`; this is checked by the
23/// const assert after this declaration
24pub const DEFAULT_PANIC_ACTION: PanicAction = PanicAction::Halt;
25const _: () = assert!(
26    DEFAULT_PANIC_ACTION as u8 == 0,
27    "DEFAULT_PANIC_ACTION is non-zero which would move container structs from .bss to .data, which in turn bloats the kernel binary"
28);