Skip to content

Commit

Permalink
Try #627:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Dec 12, 2022
2 parents 4a89f31 + 26440bd commit be7c33b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
# Manually sync this with rust-toolchain.toml!
RUST_VERSION=nightly-2022-10-19 \
RUST_VERSION=nightly-2022-12-12 \
RUST_COMPONENTS="llvm-tools-preview rust-src" \
RUST_TARGETS="x86_64-unknown-none"

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[toolchain]
# Manually sync this with Dockerfile!
channel = "nightly-2022-10-19"
channel = "nightly-2022-12-12"
components = [
"llvm-tools-preview",
"rust-src",
Expand Down
12 changes: 4 additions & 8 deletions src/arch/x86_64/kernel/acpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ fn parse_fadt(fadt: AcpiTable<'_>) {
);
assert!(
verify_checksum(dsdt.header_start_address(), dsdt.header.length as usize).is_ok(),
"DSDT at {:#X} has invalid checksum",
dsdt_address
"DSDT at {dsdt_address:#X} has invalid checksum"
);

// Try to find the "_S5_" object for SLP_TYPA in the DSDT AML bytecode.
Expand Down Expand Up @@ -503,8 +502,7 @@ pub fn init() {
// Check and save the entire APIC table for the get_apic_table() call.
assert!(
verify_checksum(table.header_start_address(), table.header.length as usize).is_ok(),
"MADT at {:#X} has invalid checksum",
table_physical_address
"MADT at {table_physical_address:#X} has invalid checksum"
);
unsafe {
MADT = Some(table);
Expand All @@ -514,15 +512,13 @@ pub fn init() {
// Check and parse this table for the poweroff() call.
assert!(
verify_checksum(table.header_start_address(), table.header.length as usize).is_ok(),
"FADT at {:#X} has invalid checksum",
table_physical_address
"FADT at {table_physical_address:#X} has invalid checksum"
);
parse_fadt(table);
} else if table.header.signature() == "SSDT" {
assert!(
verify_checksum(table.header_start_address(), table.header.length as usize).is_ok(),
"SSDT at {:#X} has invalid checksum",
table_physical_address
"SSDT at {table_physical_address:#X} has invalid checksum"
);
parse_ssdt(table);
}
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ impl fmt::Display for PciBar {
PciBar::IO(io_bar) => ("IOBar", io_bar.addr as usize, io_bar.size),
PciBar::Memory(mem_bar) => ("MemoryBar", mem_bar.addr, mem_bar.size),
};
write!(f, "{}: {:#x} (size {:#x})", typ, addr, size)?;
write!(f, "{typ}: {addr:#x} (size {size:#x})")?;

Ok(())
}
Expand Down Expand Up @@ -422,7 +422,7 @@ impl fmt::Display for PciAdapter {
}

for pci_bar in &self.base_addresses {
write!(f, ", {}", pci_bar)?;
write!(f, ", {pci_bar}")?;
}

Ok(())
Expand Down
7 changes: 2 additions & 5 deletions src/arch/x86_64/mm/physicalmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ pub fn allocate_aligned(size: usize, alignment: usize) -> Result<PhysAddr, Alloc
assert_eq!(
size % alignment,
0,
"Size {:#X} is not a multiple of the given alignment {:#X}",
size,
alignment
"Size {size:#X} is not a multiple of the given alignment {alignment:#X}"
);
assert_eq!(
alignment % BasePageSize::SIZE as usize,
Expand All @@ -157,8 +155,7 @@ pub fn allocate_aligned(size: usize, alignment: usize) -> Result<PhysAddr, Alloc
pub fn deallocate(physical_address: PhysAddr, size: usize) {
assert!(
physical_address >= PhysAddr(mm::kernel_end_address().as_u64()),
"Physical address {:#X} is not >= KERNEL_END_ADDRESS",
physical_address
"Physical address {physical_address:#X} is not >= KERNEL_END_ADDRESS"
);
assert!(size > 0);
assert_eq!(
Expand Down
10 changes: 3 additions & 7 deletions src/arch/x86_64/mm/virtualmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ pub fn allocate_aligned(size: usize, alignment: usize) -> Result<VirtAddr, Alloc
assert_eq!(
size % alignment,
0,
"Size {:#X} is not a multiple of the given alignment {:#X}",
size,
alignment
"Size {size:#X} is not a multiple of the given alignment {alignment:#X}"
);
assert_eq!(
alignment % BasePageSize::SIZE as usize,
Expand All @@ -68,13 +66,11 @@ pub fn allocate_aligned(size: usize, alignment: usize) -> Result<VirtAddr, Alloc
pub fn deallocate(virtual_address: VirtAddr, size: usize) {
assert!(
virtual_address >= VirtAddr(mm::kernel_end_address().as_u64()),
"Virtual address {:#X} is not >= KERNEL_END_ADDRESS",
virtual_address
"Virtual address {virtual_address:#X} is not >= KERNEL_END_ADDRESS"
);
assert!(
virtual_address < kernel_heap_end(),
"Virtual address {:#X} is not < kernel_heap_end()",
virtual_address
"Virtual address {virtual_address:#X} is not < kernel_heap_end()"
);
assert_eq!(
virtual_address % BasePageSize::SIZE,
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ pub mod error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
DriverError::InitVirtioDevFail(ref err) => {
write!(f, "Virtio driver failed: {:?}", err)
write!(f, "Virtio driver failed: {err:?}")
}
#[cfg(feature = "pci")]
DriverError::InitRTL8139DevFail(ref err) => {
write!(f, "RTL8139 driver failed: {:?}", err)
write!(f, "RTL8139 driver failed: {err:?}")
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/drivers/virtio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ pub mod error {
VirtioError::Unknown => write!(f, "Driver failed to initialize virtio device due to unknown reasosn!"),
#[cfg(feature = "pci")]
VirtioError::FromPci(pci_error) => match pci_error {
PciError::General(id) => write!(f, "Driver failed to initialize device with id: {:#x}. Due to unknown reasosn!", id),
PciError::NoBar(id ) => write!(f, "Driver failed to initialize device with id: {:#x}. Reason: No BAR's found.", id),
PciError::NoCapPtr(id) => write!(f, "Driver failed to initialize device with id: {:#x}. Reason: No Capabilities pointer found.", id),
PciError::BadCapPtr(id) => write!(f, "Driver failed to initialize device with id: {:#x}. Reason: Malformed Capabilities pointer.", id),
PciError::NoVirtioCaps(id) => write!(f, "Driver failed to initialize device with id: {:#x}. Reason: No Virtio capabilities were found.", id),
PciError::General(id) => write!(f, "Driver failed to initialize device with id: {id:#x}. Due to unknown reasosn!"),
PciError::NoBar(id ) => write!(f, "Driver failed to initialize device with id: {id:#x}. Reason: No BAR's found."),
PciError::NoCapPtr(id) => write!(f, "Driver failed to initialize device with id: {id:#x}. Reason: No Capabilities pointer found."),
PciError::BadCapPtr(id) => write!(f, "Driver failed to initialize device with id: {id:#x}. Reason: Malformed Capabilities pointer."),
PciError::NoVirtioCaps(id) => write!(f, "Driver failed to initialize device with id: {id:#x}. Reason: No Virtio capabilities were found."),
},
VirtioError::DevNotSupported(id) => write!(f, "Device with id {:#x} not supported.", id),
VirtioError::DevNotSupported(id) => write!(f, "Device with id {id:#x} not supported."),
VirtioError::NetDriver(net_error) => match net_error {
VirtioNetError::General => write!(f, "Virtio network driver failed due to unknown reasons!"),
VirtioNetError::NoDevCfg(id) => write!(f, "Network driver failed, for device {:x}, due to a missing or malformed device config!", id),
VirtioNetError::NoComCfg(id) => write!(f, "Network driver failed, for device {:x}, due to a missing or malformed common config!", id),
VirtioNetError::NoIsrCfg(id) => write!(f, "Network driver failed, for device {:x}, due to a missing or malformed ISR status config!", id),
VirtioNetError::NoNotifCfg(id) => write!(f, "Network driver failed, for device {:x}, due to a missing or malformed notification config!", id),
VirtioNetError::FailFeatureNeg(id) => write!(f, "Network driver failed, for device {:x}, device did not acknowledge negotiated feature set!", id),
VirtioNetError::NoDevCfg(id) => write!(f, "Network driver failed, for device {id:x}, due to a missing or malformed device config!"),
VirtioNetError::NoComCfg(id) => write!(f, "Network driver failed, for device {id:x}, due to a missing or malformed common config!"),
VirtioNetError::NoIsrCfg(id) => write!(f, "Network driver failed, for device {id:x}, due to a missing or malformed ISR status config!"),
VirtioNetError::NoNotifCfg(id) => write!(f, "Network driver failed, for device {id:x}, due to a missing or malformed notification config!"),
VirtioNetError::FailFeatureNeg(id) => write!(f, "Network driver failed, for device {id:x}, device did not acknowledge negotiated feature set!"),
VirtioNetError::FeatReqNotMet(feats) => write!(f, "Network driver tried to set feature bit without setting dependency feature. Feat set: {:x}", u64::from(*feats)),
VirtioNetError::IncompFeatsSet(drv_feats, dev_feats) => write!(f, "Feature set: {:x} , is incompatible with the device features: {:x}", u64::from(*drv_feats), u64::from(*dev_feats)),
VirtioNetError::ProcessOngoing => write!(f, "Driver performed an unsuitable operation upon an ongoging transfer."),
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Archive {
.collect::<String>();

let rename_path = archive.with_extension("redefine-syms");
sh.write_file(&rename_path, &symbol_renames)?;
sh.write_file(&rename_path, symbol_renames)?;

let objcopy = binutil("objcopy")?;
cmd!(sh, "{objcopy} --prefix-symbols={prefix}_ {archive}").run()?;
Expand Down

0 comments on commit be7c33b

Please sign in to comment.