Skip to content

Commit

Permalink
Upgrade toolchain channel to nightly-2021-11-01
Browse files Browse the repository at this point in the history
The kernel's target os was removed in rust-lang/rust#90404
Remove __rg_oom since the filter for `target_os = "hermit"` does not
work anymore: rust-lang/rust@bc6b2ac
  • Loading branch information
mkroening committed Dec 1, 2021
1 parent a074b89 commit d708174
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 77 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2021-10-20"
channel = "nightly-2021-11-01"
components = [
"rust-src",
"llvm-tools-preview",
Expand Down
4 changes: 2 additions & 2 deletions src/arch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub use crate::arch::x86_64::*;

#[cfg(target_arch = "x86_64")]
pub use crate::arch::x86_64::kernel::apic::{set_oneshot_timer, wakeup_core};
#[cfg(all(target_arch = "x86_64", target_os = "hermit", feature = "smp"))]
#[cfg(all(target_arch = "x86_64", target_os = "none", feature = "smp"))]
pub use crate::arch::x86_64::kernel::application_processor_init;
#[cfg(target_arch = "x86_64")]
pub use crate::arch::x86_64::kernel::gdt::set_current_kernel_stack;
Expand All @@ -60,7 +60,7 @@ pub use crate::arch::x86_64::kernel::scheduler;
pub use crate::arch::x86_64::kernel::switch;
#[cfg(target_arch = "x86_64")]
pub use crate::arch::x86_64::kernel::systemtime::get_boot_time;
#[cfg(all(target_arch = "x86_64", target_os = "hermit"))]
#[cfg(all(target_arch = "x86_64", target_os = "none"))]
pub use crate::arch::x86_64::kernel::{boot_application_processors, boot_processor_init};
#[cfg(target_arch = "x86_64")]
pub use crate::arch::x86_64::kernel::{
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::arch;
#[cfg(feature = "acpi")]
use crate::arch::x86_64::kernel::acpi;
use crate::arch::x86_64::kernel::irq::IrqStatistics;
#[cfg(all(target_os = "hermit", feature = "smp"))]
#[cfg(all(target_os = "none", feature = "smp"))]
use crate::arch::x86_64::kernel::smp_boot_code::SMP_BOOT_CODE;
use crate::arch::x86_64::kernel::IRQ_COUNTERS;
use crate::arch::x86_64::mm::paging::{BasePageSize, PageSize, PageTableEntryFlags};
Expand Down Expand Up @@ -568,7 +568,7 @@ extern "C" {
/// This algorithm is derived from Intel MultiProcessor Specification 1.4, B.4, but testing has shown
/// that a second STARTUP IPI and setting the BIOS Reset Vector are no longer necessary.
/// This is partly confirmed by https://wiki.osdev.org/Symmetric_Multiprocessing
#[cfg(all(target_os = "hermit", feature = "smp"))]
#[cfg(all(target_os = "none", feature = "smp"))]
pub fn boot_application_processors() {
// We shouldn't have any problems fitting the boot code into a single page, but let's better be sure.
assert!(
Expand Down
2 changes: 1 addition & 1 deletion src/arch/x86_64/kernel/irq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn disable() {
/// were not activated before calling this function.
#[inline]
pub fn nested_disable() -> bool {
cfg!(target_os = "hermit") && {
cfg!(target_os = "none") && {
let ret = rflags::read().contains(RFlags::FLAGS_IF);
disable();
ret
Expand Down
22 changes: 11 additions & 11 deletions src/arch/x86_64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ impl BootInfo {
}

/// Kernel header to announce machine features
#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
static mut BOOT_INFO: *mut BootInfo = ptr::null_mut();

#[cfg(all(target_os = "hermit", not(feature = "newlib")))]
#[cfg(all(target_os = "none", not(feature = "newlib")))]
#[link_section = ".data"]
static mut BOOT_INFO: *mut BootInfo = ptr::null_mut();

#[cfg(all(target_os = "hermit", feature = "newlib"))]
#[cfg(all(target_os = "none", feature = "newlib"))]
#[link_section = ".mboot"]
static mut BOOT_INFO: *mut BootInfo = ptr::null_mut();

Expand Down Expand Up @@ -292,7 +292,7 @@ pub fn message_output_init() {
}
}

#[cfg(all(not(target_os = "hermit"), not(target_os = "windows")))]
#[cfg(all(not(target_os = "none"), not(target_os = "windows")))]
pub fn output_message_byte(byte: u8) {
extern "C" {
fn write(fd: i32, buf: *const u8, count: usize) -> isize;
Expand All @@ -314,7 +314,7 @@ pub fn output_message_byte(byte: u8) {
}
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[test]
fn test_output() {
output_message_byte('t' as u8);
Expand All @@ -324,7 +324,7 @@ fn test_output() {
output_message_byte('\n' as u8);
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub fn output_message_byte(byte: u8) {
if environment::is_single_kernel() {
// Output messages to the serial port and VGA screen in unikernel mode.
Expand All @@ -342,15 +342,15 @@ pub fn output_message_byte(byte: u8) {
}
}

//#[cfg(target_os = "hermit")]
//#[cfg(target_os = "none")]
pub fn output_message_buf(buf: &[u8]) {
for byte in buf {
output_message_byte(*byte);
}
}

/// Real Boot Processor initialization as soon as we have put the first Welcome message on the screen.
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub fn boot_processor_init() {
processor::detect_features();
processor::configure();
Expand Down Expand Up @@ -397,15 +397,15 @@ pub fn boot_processor_init() {

/// Boots all available Application Processors on bare-metal or QEMU.
/// Called after the Boot Processor has been fully initialized along with its scheduler.
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub fn boot_application_processors() {
#[cfg(feature = "smp")]
apic::boot_application_processors();
apic::print_information();
}

/// Application Processor initialization
#[cfg(all(target_os = "hermit", feature = "smp"))]
#[cfg(all(target_os = "none", feature = "smp"))]
pub fn application_processor_init() {
percore::init();
processor::configure();
Expand Down Expand Up @@ -460,7 +460,7 @@ pub fn print_statistics() {
}
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
#[inline(never)]
#[no_mangle]
unsafe fn pre_init(boot_info: &'static mut BootInfo) -> ! {
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/percore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ impl<T: Is32BitVariable> PerCoreVariableMethods<T> for PerCoreVariable<T> {
}
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
#[inline]
pub fn core_id() -> CoreId {
unsafe { PERCORE.core_id.get() }
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
pub fn core_id() -> CoreId {
0
}
Expand Down
6 changes: 3 additions & 3 deletions src/arch/x86_64/kernel/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,14 @@ impl CpuFrequency {
pic::eoi(pit::PIT_INTERRUPT_NUMBER);
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
fn measure_frequency(&mut self) -> Result<(), ()> {
// return just Ok because the real implementation must run in ring 0
self.source = CpuFrequencySources::Measurement;
Ok(())
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
fn measure_frequency(&mut self) -> Result<(), ()> {
// The PIC is not initialized for uhyve, so we cannot measure anything.
if environment::is_uhyve() {
Expand Down Expand Up @@ -865,7 +865,7 @@ pub fn print_information() {
infofooter!();
}

/*#[cfg(not(target_os = "hermit"))]
/*#[cfg(not(target_os = "none"))]
#[test]
fn print_cpu_information() {
::logging::init();
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/kernel/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ impl Clone for TaskTLS {
}
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
extern "C" fn task_start(_f: extern "C" fn(usize), _arg: usize, _user_stack: u64) -> ! {
unimplemented!()
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
#[naked]
extern "C" fn task_start(_f: extern "C" fn(usize), _arg: usize, _user_stack: u64) -> ! {
// `f` is in the `rdi` register
Expand Down
2 changes: 1 addition & 1 deletion src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Console {

pub static CONSOLE: SpinlockIrqSave<Console> = SpinlockIrqSave::new(Console(()));

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[test]
fn test_console() {
println!("HelloWorld");
Expand Down
32 changes: 16 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#![feature(llvm_asm)]
#![feature(global_asm)]
#![no_std]
#![cfg_attr(target_os = "hermit", feature(custom_test_frameworks))]
#![cfg_attr(target_os = "hermit", cfg_attr(test, test_runner(crate::test_runner)))]
#![cfg_attr(target_os = "none", feature(custom_test_frameworks))]
#![cfg_attr(target_os = "none", cfg_attr(test, test_runner(crate::test_runner)))]
#![cfg_attr(
target_os = "hermit",
target_os = "none",
cfg_attr(test, reexport_test_harness_main = "test_main")
)]
#![cfg_attr(target_os = "hermit", cfg_attr(test, no_main))]
#![cfg_attr(target_os = "none", cfg_attr(test, no_main))]

// EXTERNAL CRATES
#[macro_use]
Expand All @@ -46,7 +46,7 @@ extern crate bitflags;
extern crate log;
#[macro_use]
extern crate num_derive;
#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[macro_use]
extern crate std;
#[cfg(target_arch = "aarch64")]
Expand Down Expand Up @@ -87,7 +87,7 @@ mod errno;
mod ffi;
mod kernel_message_buffer;
mod mm;
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
mod runtime_glue;
mod scheduler;
mod synch;
Expand All @@ -101,7 +101,7 @@ pub fn _print(args: ::core::fmt::Arguments<'_>) {
}

#[cfg(test)]
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
#[no_mangle]
extern "C" fn runtime_entry(_argc: i32, _argv: *const *const u8, _env: *const *const u8) -> ! {
println!("Executing hermit unittests. Any arguments are dropped");
Expand All @@ -119,14 +119,14 @@ pub fn test_runner(tests: &[&dyn Fn()]) {
sys_exit(0);
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
#[test_case]
fn trivial_test() {
println!("Test test test");
panic!("Test called");
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
#[global_allocator]
static ALLOCATOR: LockedHeap = LockedHeap::empty();

Expand All @@ -136,7 +136,7 @@ static ALLOCATOR: LockedHeap = LockedHeap::empty();
/// Returning a null pointer indicates that either memory is exhausted or
/// `size` and `align` do not meet this allocator's size or alignment constraints.
///
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
let layout_res = Layout::from_size_align(size, align);
if layout_res.is_err() || size == 0 {
Expand Down Expand Up @@ -178,7 +178,7 @@ pub extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
/// # Errors
/// Returns null if the new layout does not meet the size and alignment constraints of the
/// allocator, or if reallocation otherwise fails.
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub extern "C" fn __sys_realloc(
ptr: *mut u8,
size: usize,
Expand Down Expand Up @@ -223,7 +223,7 @@ pub extern "C" fn __sys_realloc(
///
/// # Errors
/// May panic if debug assertions are enabled and invalid parameters `size` or `align` where passed.
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
unsafe {
let layout_res = Layout::from_size_align(size, align);
Expand All @@ -246,7 +246,7 @@ pub extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
}
}

#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
extern "C" {
static mut __bss_start: usize;
}
Expand All @@ -258,7 +258,7 @@ fn has_ipdevice() -> bool {
}

/// Entry point of a kernel thread, which initialize the libos
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
extern "C" fn initd(_arg: usize) {
extern "C" {
#[cfg(not(test))]
Expand Down Expand Up @@ -318,7 +318,7 @@ fn synch_all_cores() {
}

/// Entry Point of HermitCore for the Boot Processor
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
fn boot_processor_main() -> ! {
// Initialize the kernel and hardware.
arch::message_output_init();
Expand Down Expand Up @@ -371,7 +371,7 @@ fn boot_processor_main() -> ! {
}

/// Entry Point of HermitCore for an Application Processor
#[cfg(all(target_os = "hermit", feature = "smp"))]
#[cfg(all(target_os = "none", feature = "smp"))]
fn application_processor_main() -> ! {
arch::application_processor_init();
scheduler::add_current_core();
Expand Down
4 changes: 2 additions & 2 deletions src/mm/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ pub struct Heap {
index: usize,
bottom: usize,
size: usize,
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
holes: HoleList,
#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
pub holes: HoleList,
}

Expand Down
6 changes: 3 additions & 3 deletions src/mm/freelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl FreeList {
}
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[test]
fn add_element() {
let mut freelist = FreeList::new();
Expand All @@ -208,7 +208,7 @@ fn add_element() {
}
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[test]
fn allocate() {
let mut freelist = FreeList::new();
Expand Down Expand Up @@ -241,7 +241,7 @@ fn allocate() {
}
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[test]
fn deallocate() {
let mut freelist = FreeList::new();
Expand Down
6 changes: 3 additions & 3 deletions src/mm/hole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl HoleList {
}

/// Returns information about the first hole for test purposes.
#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
#[cfg(test)]
pub fn first_hole(&self) -> Option<(usize, usize)> {
self.first
Expand All @@ -91,13 +91,13 @@ impl HoleList {
}

/// A block containing free memory. It points to the next hole and thus forms a linked list.
#[cfg(target_os = "hermit")]
#[cfg(target_os = "none")]
pub struct Hole {
size: usize,
next: Option<&'static mut Hole>,
}

#[cfg(not(target_os = "hermit"))]
#[cfg(not(target_os = "none"))]
pub struct Hole {
pub size: usize,
pub next: Option<&'static mut Hole>,
Expand Down
Loading

0 comments on commit d708174

Please sign in to comment.