chore: update rust toolchain

This commit is contained in:
llenotre 2024-09-19 21:18:27 +02:00
parent 150d61132b
commit 2bbb2b7079
14 changed files with 43 additions and 40 deletions

View File

@ -7,18 +7,18 @@ jobs:
- uses: actions/checkout@v4
- name: Macros
working-directory: macros
run: cargo clippy --all-features --tests
run: cargo clippy --all-features --all-targets
- name: Utils
working-directory: utils
run: cargo clippy --all-features --tests
run: cargo clippy --all-features --all-targets
- name: Kernel
working-directory: kernel
run: |
cp default.build-config.toml build-config.toml
cargo clippy --all-features --tests
cargo clippy --all-features --all-targets
- name: Integration tests
working-directory: inttest
run: cargo clippy --all-features --tests
run: cargo clippy --all-features --all-targets
format:
runs-on: [self-hosted, linux]
needs: clippy

View File

@ -155,7 +155,8 @@ impl ACPIData {
(self
.data
.as_ptr()
.add(*entries_ptr.add(i) as usize - self.off) as usize) as *const ACPITableHeader
.add(*entries_ptr.add(i) as usize - self.off) as usize)
as *const ACPITableHeader
};
let header = unsafe { &*header_ptr };
@ -199,7 +200,8 @@ impl ACPIData {
(self
.data
.as_ptr()
.add(*entries_ptr.add(i) as usize - self.off) as usize) as *const ACPITableHeader
.add(*entries_ptr.add(i) as usize - self.off) as usize)
as *const ACPITableHeader
};
let header = unsafe { &*header_ptr };

View File

@ -135,7 +135,7 @@ pub struct ArgsParser<'s> {
impl<'s> ArgsParser<'s> {
/// Parses the given command line and returns a new instance.
pub fn parse(cmdline: &'s [u8]) -> Result<Self, ParseError<'_>> {
pub fn parse(cmdline: &'s [u8]) -> Result<Self, ParseError<'s>> {
let mut s = Self {
root: None,
init: None,

View File

@ -30,21 +30,24 @@ macro_rules! rotl {
/// Performs a quarter round on the given values.
macro_rules! quarter_round {
($a:expr, $b:expr, $c:expr, $d:expr) => {
$a = $a.wrapping_add($b);
$d ^= $a;
$d = rotl!($d, 16);
#[allow(clippy::manual_rotate)]
{
$a = $a.wrapping_add($b);
$d ^= $a;
$d = rotl!($d, 16);
$c = $c.wrapping_add($d);
$b ^= $c;
$b = rotl!($b, 12);
$c = $c.wrapping_add($d);
$b ^= $c;
$b = rotl!($b, 12);
$a = $a.wrapping_add($b);
$d ^= $a;
$d = rotl!($d, 8);
$a = $a.wrapping_add($b);
$d ^= $a;
$d = rotl!($d, 8);
$c = $c.wrapping_add($d);
$b ^= $c;
$b = rotl!($b, 7);
$c = $c.wrapping_add($d);
$b ^= $c;
$b = rotl!($b, 7);
}
};
}

View File

@ -73,7 +73,7 @@ pub trait Relocation {
// The offset in the GOT entry for the symbol
let got_offset = 0u32; // TODO
// The offset in the PLT entry for the symbol
// The offset in the PLT entry for the symbol
let plt_offset = 0u32; // TODO
// The value of the symbol

View File

@ -167,11 +167,13 @@ macro_rules! format_content {
}};
}
/// A static symbolic link pointing to a constant target.
/// A static symbolic link.
///
/// The inner value is the target of the symbolic link.
#[derive(Debug, Default)]
pub struct StaticLink<const TARGET: &'static [u8]>;
pub struct StaticLink(pub &'static [u8]);
impl<const TARGET: &'static [u8]> NodeOps for StaticLink<TARGET> {
impl NodeOps for StaticLink {
fn get_stat(&self, _loc: &FileLocation) -> EResult<Stat> {
Ok(Stat {
mode: FileType::Link.to_mode() | 0o777,
@ -180,7 +182,7 @@ impl<const TARGET: &'static [u8]> NodeOps for StaticLink<TARGET> {
}
fn read_content(&self, _loc: &FileLocation, off: u64, buf: &mut [u8]) -> EResult<usize> {
format_content!(off, buf, "{}", DisplayableStr(TARGET))
format_content!(off, buf, "{}", DisplayableStr(self.0))
}
}
@ -221,7 +223,7 @@ pub fn box_wrap<'n, N: 'n + NodeOps>(ops: N) -> AllocResult<Box<dyn 'n + NodeOps
/// A read-only virtual directory used to point to other nodes.
#[derive(Debug)]
pub struct StaticDir<T: 'static + Clone + Debug = ()> {
/// The directory's entries, sorted alphabeticaly by name.
/// The directory's entries, sorted alphabetically by name.
///
/// **Warning**: If this array is not sorted correctly, the behaviour of
/// [`NodeOps::entry_by_name`] is undefined.

View File

@ -93,7 +93,7 @@ impl RootDir {
StaticEntryBuilder {
name: b"mounts",
entry_type: FileType::Link,
init: entry_init_default::<StaticLink<b"self/mounts">>,
init: |_| box_wrap(StaticLink(b"self/mounts")),
},
StaticEntryBuilder {
name: b"self",

View File

@ -30,12 +30,10 @@
#![feature(allocator_api)]
#![feature(allow_internal_unstable)]
#![feature(array_chunks)]
#![feature(asm_const)]
#![feature(core_intrinsics)]
#![feature(custom_test_frameworks)]
#![feature(lang_items)]
#![feature(once_cell_try)]
#![feature(panic_info_message)]
#![feature(pointer_is_aligned_to)]
#![feature(ptr_metadata)]
#![feature(strict_provenance)]

View File

@ -192,9 +192,8 @@ impl Module {
/// Loads a kernel module from the given image.
pub fn load(image: &[u8]) -> EResult<Self> {
let parser = ELFParser::new(image).map_err(|e| {
let parser = ELFParser::new(image).inspect_err(|_| {
crate::println!("Invalid ELF file as loaded module");
e
})?;
// Allocate memory for the module
let mem_size = Self::get_load_size(&parser);

View File

@ -47,9 +47,7 @@ fn panic(panic_info: &PanicInfo) -> ! {
crate::println!("--- KERNEL PANIC ---\n");
crate::println!("Kernel has been forced to halt due to internal problem, sorry :/");
if let Some(msg) = panic_info.message() {
crate::print!("Reason: {msg}");
}
crate::print!("Reason: {}", panic_info.message());
if let Some(loc) = panic_info.location() {
crate::println!(" (location: {loc})");
} else {

View File

@ -18,9 +18,10 @@
//! Under the x86 architecture, the TSS (Task State Segment) is a structure that
//! is mostly deprecated but that must still be used in order to perform
//! software context switching because it allows to store the pointers to the
//! stacks to use whenever an interruption happens and requires switching the
//! protection ring, and thus the stack.
//! software context switching.
//!
//! It allows to store the pointers to the stacks to use whenever an interruption happens and
//! requires switching the protection ring, and thus the stack.
//!
//! The structure has to be registered into the GDT into the TSS segment, and must be loaded using
//! instruction `ltr`.
@ -98,7 +99,7 @@ impl TSS {
/// Initializes the TSS.
pub fn init() {
let limit = size_of::<Self>() as u64;
let base = unsafe { addr_of!(TSS) as u64 };
let base = addr_of!(TSS) as u64;
let flags = 0b0100000010001001_u64;
let tss_value = (limit & 0xffff)
| ((base & 0xffffff) << 16)

View File

@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-05-24"
channel = "nightly-2024-09-18"
components = ["rustfmt", "rustc-dev", "rust-src", "clippy", "miri"]
targets = ["i686-unknown-linux-musl"]
profile = "minimal"

View File

@ -29,7 +29,7 @@ use macros::AnyRepr;
/// On PDP systems, long values (4 bytes) were stored as big endian, which means these values
/// need to be rotated to be read correctly.
pub fn rot_u32(v: u32) -> u32 {
(v >> 16) | (v << 16)
v.rotate_left(16)
}
/// A CPIO entry header.

View File

@ -197,7 +197,7 @@ impl<T: Eq> Eq for Arc<T> {}
impl<T: PartialEq> PartialEq for Arc<T> {
fn eq(&self, other: &Self) -> bool {
Self::as_ref(self).eq(&other)
Self::as_ref(self).eq(other)
}
}