Skip to content

Commit

Permalink
Merge pull request #801 from mkroening/nightly-2023-07-15
Browse files Browse the repository at this point in the history
Upgrade toolchain to nightly-2023-07-15
  • Loading branch information
mkroening authored Jul 22, 2023
2 parents 296346c + 37b643b commit 80ac9fa
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 20 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-2023-06-19 \
RUST_VERSION=nightly-2023-07-15 \
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-2023-06-19"
channel = "nightly-2023-07-15"
components = [
"llvm-tools-preview",
"rust-src",
Expand Down
8 changes: 4 additions & 4 deletions src/arch/aarch64/mm/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,15 @@ pub fn get_page_table_entry<S: PageSize>(virtual_address: VirtAddr) -> Option<Pa
trace!("Looking up Page Table Entry for {:p}", virtual_address);

let page = Page::<S>::including_address(virtual_address);
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr() as *mut PageTable<L0Table>) };
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr::<PageTable<L0Table>>()) };
root_pagetable.get_page_table_entry(page)
}

pub fn get_physical_address<S: PageSize>(virtual_address: VirtAddr) -> Option<PhysAddr> {
trace!("Getting physical address for {:p}", virtual_address);

let page = Page::<S>::including_address(virtual_address);
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr() as *mut PageTable<L0Table>) };
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr::<PageTable<L0Table>>()) };
let address = root_pagetable.get_page_table_entry(page)?.address();
let offset = virtual_address & (S::SIZE - 1);
Some(PhysAddr(address.as_u64() | offset.as_u64()))
Expand Down Expand Up @@ -597,7 +597,7 @@ pub fn map<S: PageSize>(
);

let range = get_page_range::<S>(virtual_address, count);
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr() as *mut PageTable<L0Table>) };
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr::<PageTable<L0Table>>()) };
root_pagetable.map_pages(range, physical_address, flags);
}

Expand All @@ -624,7 +624,7 @@ pub fn unmap<S: PageSize>(virtual_address: VirtAddr, count: usize) {
);

let range = get_page_range::<S>(virtual_address, count);
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr() as *mut PageTable<L0Table>) };
let root_pagetable = unsafe { &mut *(L0TABLE_ADDRESS.as_mut_ptr::<PageTable<L0Table>>()) };
root_pagetable.map_pages(range, PhysAddr::zero(), PageTableEntryFlags::BLANK);
}

Expand Down
3 changes: 1 addition & 2 deletions src/arch/x86_64/kernel/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use hermit_sync::{without_interrupts, OnceCell, SpinMutex};
#[cfg(feature = "smp")]
use x86::controlregs::*;
use x86::msr::*;
use x86_64::structures::idt::InterruptDescriptorTable;

use super::interrupts::IDT;
#[cfg(feature = "acpi")]
Expand Down Expand Up @@ -467,7 +466,7 @@ pub fn init() {

// Set gates to ISRs for the APIC interrupts we are going to enable.
unsafe {
let idt = &mut *(&mut IDT as *mut _ as *mut InterruptDescriptorTable);
let idt = &mut IDT;
idt[ERROR_INTERRUPT_NUMBER as usize]
.set_handler_fn(error_interrupt_handler)
.set_stack_index(0);
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn load_idt() {
}

pub fn install() {
let idt = unsafe { &mut *(&mut IDT as *mut _ as *mut InterruptDescriptorTable) };
let idt = unsafe { &mut IDT };

set_general_handler!(idt, abort, 0..32);
set_general_handler!(idt, unhandle, 32..64);
Expand Down Expand Up @@ -110,7 +110,7 @@ pub extern "C" fn irq_install_handler(
) {
debug!("Install handler for interrupt {}", irq_number);

let idt = unsafe { &mut *(&mut IDT as *mut _ as *mut InterruptDescriptorTable) };
let idt = unsafe { &mut IDT };
unsafe {
idt[(32 + irq_number) as usize]
.set_handler_addr(x86_64::VirtAddr::new(
Expand Down
3 changes: 1 addition & 2 deletions src/arch/x86_64/kernel/pic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use x86::io::*;
use x86_64::structures::idt::InterruptDescriptorTable;

use super::interrupts::IDT;
use crate::arch::x86_64::kernel::interrupts::ExceptionStackFrame;
Expand Down Expand Up @@ -32,7 +31,7 @@ pub fn init() {
// Even if we mask all interrupts, spurious interrupts may still occur.
// This is especially true for real hardware. So provide a handler for them.
unsafe {
let idt = &mut *(&mut IDT as *mut _ as *mut InterruptDescriptorTable);
let idt = &mut IDT;
idt[(PIC1_INTERRUPT_OFFSET + SPURIOUS_IRQ_NUMBER) as usize]
.set_handler_fn(spurious_interrupt_on_master)
.set_stack_index(0);
Expand Down
4 changes: 1 addition & 3 deletions src/arch/x86_64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ impl CpuFrequency {

#[cfg(target_os = "none")]
fn measure_frequency(&mut self) -> Result<(), ()> {
use x86_64::structures::idt::InterruptDescriptorTable;

use crate::arch::x86_64::kernel::interrupts::IDT;

// The PIC is not initialized for uhyve, so we cannot measure anything.
Expand All @@ -413,7 +411,7 @@ impl CpuFrequency {
// Use the Programmable Interval Timer (PIT) for this measurement, which is the only
// system timer with a known constant frequency.
unsafe {
let idt = &mut *(&mut IDT as *mut _ as *mut InterruptDescriptorTable);
let idt = &mut IDT;
idt[pit::PIT_INTERRUPT_NUMBER as usize]
.set_handler_fn(Self::measure_frequency_timer_handler)
.set_stack_index(0);
Expand Down
3 changes: 1 addition & 2 deletions src/arch/x86_64/kernel/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use core::arch::asm;
use core::{mem, ptr, slice};

use align_address::Align;
use x86_64::structures::idt::InterruptDescriptorTable;

use super::interrupts::{IDT, IST_SIZE};
use crate::arch::x86_64::kernel::core_local::*;
Expand Down Expand Up @@ -376,7 +375,7 @@ extern "x86-interrupt" fn timer_handler(_stack_frame: interrupts::ExceptionStack

pub fn install_timer_handler() {
unsafe {
let idt = &mut *(&mut IDT as *mut _ as *mut InterruptDescriptorTable);
let idt = &mut IDT;
idt[apic::TIMER_INTERRUPT_NUMBER as usize]
.set_handler_fn(timer_handler)
.set_stack_index(0);
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/virtio/transport/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl NotifCtrl {

pub fn notify_dev(&self, notif_data: &[u8]) {
if self.f_notif_data {
let ptr = self.notif_addr as *mut u32;
let ptr = self.notif_addr;

unsafe {
unaligned_volatile_store(
Expand Down
4 changes: 3 additions & 1 deletion src/scheduler/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ impl PriorityTaskQueue {
.iter()
.position(|current_task| current_task.borrow().id == handle.id)
{
let Some(task) = self.remove_from_queue(index, old_priority) else { return Err(()) };
let Some(task) = self.remove_from_queue(index, old_priority) else {
return Err(());
};
task.borrow_mut().prio = prio;
self.push(task);
return Ok(());
Expand Down
4 changes: 3 additions & 1 deletion src/syscalls/entropy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ fn generate_park_miller_lehmer_random_number() -> u32 {
}

unsafe extern "C" fn __sys_read_entropy(buf: *mut u8, len: usize, flags: u32) -> isize {
let Some(flags) = Flags::from_bits(flags) else { return -EINVAL as isize };
let Some(flags) = Flags::from_bits(flags) else {
return -EINVAL as isize;
};

let buf = unsafe {
// Cap the number of bytes to be read at a time to isize::MAX to uphold
Expand Down

0 comments on commit 80ac9fa

Please sign in to comment.