Merged
Conversation
Refactor kernel codebase, update documentation and add CI.
…s early boot so acceptable to have a static mut ref
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the serial device and console management code to improve safety, encapsulation, and maintainability. The main changes include replacing global mutable statics with thread-safe structures, introducing new manager types for serial devices and the kernel console, and updating related code to use these abstractions.
Serial device and console management improvements:
SerialManagerstruct (SERIAL_DEVICES) to encapsulate and safely manage the array of UART devices, replacing the previous globalUART_DEVICESstatic. This adds methods for adding devices and retrieving the default console. [1] [2] [3] [4]KernelConsolestruct (KCONSOLE) to manage the kernel console in a thread-safe manner, replacing the previous global mutable static. Methods for setting and getting the console were added. [1] [2]printandwrite_fmtfunctions insrc/print.rsto use the newSerialManagerandKernelConsoleabstractions, ensuring safer access to shared resources. [1] [2]Code quality and safety improvements:
#![warn(static_mut_refs)]lint, as the new abstractions eliminate the need for directstatic mutreferences.CopyandClonederives toDriverRegionandNs16550structs for easier and safer usage. [1] [2]API and naming consistency:
_default_consolefield inUartDevicetodefault_consolefor clarity and consistency. [1] [2]These changes collectively make serial device and console management more robust and idiomatic in Rust, reducing the risk of data races and undefined behavior.