Skip to content

Commit c8eb43a

Browse files
committed
Upgrade toolchain channel to nightly-2021-11-01
The kernel's target os was removed in rust-lang/rust#90404. It is only used for x86_64 and not for aarch64. Adjust filter on __rg_oom since the filter for `target_os = "hermit"` does not work anymore for the kernel target: rust-lang/rust@bc6b2ac
1 parent a8a788d commit c8eb43a

18 files changed

+85
-71
lines changed

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel = "nightly-2021-10-20"
2+
channel = "nightly-2021-11-01"
33
components = [
44
"rust-src",
55
"llvm-tools-preview",

src/arch/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ pub use crate::arch::x86_64::*;
4444

4545
#[cfg(target_arch = "x86_64")]
4646
pub use crate::arch::x86_64::kernel::apic::{set_oneshot_timer, wakeup_core};
47-
#[cfg(all(target_arch = "x86_64", target_os = "hermit", feature = "smp"))]
47+
#[cfg(all(
48+
target_arch = "x86_64",
49+
any(target_os = "none", target_os = "hermit"),
50+
feature = "smp"
51+
))]
4852
pub use crate::arch::x86_64::kernel::application_processor_init;
4953
#[cfg(target_arch = "x86_64")]
5054
pub use crate::arch::x86_64::kernel::gdt::set_current_kernel_stack;
@@ -60,7 +64,7 @@ pub use crate::arch::x86_64::kernel::scheduler;
6064
pub use crate::arch::x86_64::kernel::switch;
6165
#[cfg(target_arch = "x86_64")]
6266
pub use crate::arch::x86_64::kernel::systemtime::get_boot_time;
63-
#[cfg(all(target_arch = "x86_64", target_os = "hermit"))]
67+
#[cfg(all(target_arch = "x86_64", any(target_os = "none", target_os = "hermit")))]
6468
pub use crate::arch::x86_64::kernel::{boot_application_processors, boot_processor_init};
6569
#[cfg(target_arch = "x86_64")]
6670
pub use crate::arch::x86_64::kernel::{

src/arch/x86_64/kernel/apic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::arch;
22
#[cfg(feature = "acpi")]
33
use crate::arch::x86_64::kernel::acpi;
44
use crate::arch::x86_64::kernel::irq::IrqStatistics;
5-
#[cfg(all(target_os = "hermit", feature = "smp"))]
5+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "smp"))]
66
use crate::arch::x86_64::kernel::smp_boot_code::SMP_BOOT_CODE;
77
use crate::arch::x86_64::kernel::IRQ_COUNTERS;
88
use crate::arch::x86_64::mm::paging::{BasePageSize, PageSize, PageTableEntryFlags};
@@ -568,7 +568,7 @@ extern "C" {
568568
/// This algorithm is derived from Intel MultiProcessor Specification 1.4, B.4, but testing has shown
569569
/// that a second STARTUP IPI and setting the BIOS Reset Vector are no longer necessary.
570570
/// This is partly confirmed by https://wiki.osdev.org/Symmetric_Multiprocessing
571-
#[cfg(all(target_os = "hermit", feature = "smp"))]
571+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "smp"))]
572572
pub fn boot_application_processors() {
573573
// We shouldn't have any problems fitting the boot code into a single page, but let's better be sure.
574574
assert!(

src/arch/x86_64/kernel/irq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn disable() {
9090
/// were not activated before calling this function.
9191
#[inline]
9292
pub fn nested_disable() -> bool {
93-
cfg!(target_os = "hermit") && {
93+
cfg!(any(target_os = "none", target_os = "hermit")) && {
9494
let ret = rflags::read().contains(RFlags::FLAGS_IF);
9595
disable();
9696
ret

src/arch/x86_64/kernel/mod.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ impl BootInfo {
119119
}
120120

121121
/// Kernel header to announce machine features
122-
#[cfg(not(target_os = "hermit"))]
122+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
123123
static mut BOOT_INFO: *mut BootInfo = ptr::null_mut();
124124

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

129-
#[cfg(all(target_os = "hermit", feature = "newlib"))]
129+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "newlib"))]
130130
#[link_section = ".mboot"]
131131
static mut BOOT_INFO: *mut BootInfo = ptr::null_mut();
132132

@@ -298,7 +298,10 @@ pub fn message_output_init() {
298298
}
299299
}
300300

301-
#[cfg(all(not(target_os = "hermit"), not(target_os = "windows")))]
301+
#[cfg(all(
302+
not(any(target_os = "none", target_os = "hermit")),
303+
not(target_os = "windows")
304+
))]
302305
pub fn output_message_byte(byte: u8) {
303306
extern "C" {
304307
fn write(fd: i32, buf: *const u8, count: usize) -> isize;
@@ -320,7 +323,7 @@ pub fn output_message_byte(byte: u8) {
320323
}
321324
}
322325

323-
#[cfg(not(target_os = "hermit"))]
326+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
324327
#[test]
325328
fn test_output() {
326329
output_message_byte('t' as u8);
@@ -330,7 +333,7 @@ fn test_output() {
330333
output_message_byte('\n' as u8);
331334
}
332335

333-
#[cfg(target_os = "hermit")]
336+
#[cfg(any(target_os = "none", target_os = "hermit"))]
334337
pub fn output_message_byte(byte: u8) {
335338
if environment::is_single_kernel() {
336339
// Output messages to the serial port and VGA screen in unikernel mode.
@@ -348,15 +351,15 @@ pub fn output_message_byte(byte: u8) {
348351
}
349352
}
350353

351-
//#[cfg(target_os = "hermit")]
354+
//#[cfg(any(target_os = "none", target_os = "hermit"))]
352355
pub fn output_message_buf(buf: &[u8]) {
353356
for byte in buf {
354357
output_message_byte(*byte);
355358
}
356359
}
357360

358361
/// Real Boot Processor initialization as soon as we have put the first Welcome message on the screen.
359-
#[cfg(target_os = "hermit")]
362+
#[cfg(any(target_os = "none", target_os = "hermit"))]
360363
pub fn boot_processor_init() {
361364
processor::detect_features();
362365
processor::configure();
@@ -403,15 +406,15 @@ pub fn boot_processor_init() {
403406

404407
/// Boots all available Application Processors on bare-metal or QEMU.
405408
/// Called after the Boot Processor has been fully initialized along with its scheduler.
406-
#[cfg(target_os = "hermit")]
409+
#[cfg(any(target_os = "none", target_os = "hermit"))]
407410
pub fn boot_application_processors() {
408411
#[cfg(feature = "smp")]
409412
apic::boot_application_processors();
410413
apic::print_information();
411414
}
412415

413416
/// Application Processor initialization
414-
#[cfg(all(target_os = "hermit", feature = "smp"))]
417+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "smp"))]
415418
pub fn application_processor_init() {
416419
percore::init();
417420
processor::configure();
@@ -466,7 +469,7 @@ pub fn print_statistics() {
466469
}
467470
}
468471

469-
#[cfg(target_os = "hermit")]
472+
#[cfg(any(target_os = "none", target_os = "hermit"))]
470473
#[inline(never)]
471474
#[no_mangle]
472475
unsafe fn pre_init(boot_info: &'static mut BootInfo) -> ! {

src/arch/x86_64/kernel/percore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ impl<T: Is32BitVariable> PerCoreVariableMethods<T> for PerCoreVariable<T> {
137137
}
138138
}
139139

140-
#[cfg(target_os = "hermit")]
140+
#[cfg(any(target_os = "none", target_os = "hermit"))]
141141
#[inline]
142142
pub fn core_id() -> CoreId {
143143
unsafe { PERCORE.core_id.get() }
144144
}
145145

146-
#[cfg(not(target_os = "hermit"))]
146+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
147147
pub fn core_id() -> CoreId {
148148
0
149149
}

src/arch/x86_64/kernel/processor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,14 @@ impl CpuFrequency {
337337
pic::eoi(pit::PIT_INTERRUPT_NUMBER);
338338
}
339339

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

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

868-
/*#[cfg(not(target_os = "hermit"))]
868+
/*#[cfg(not(any(target_os = "none", target_os = "hermit")))]
869869
#[test]
870870
fn print_cpu_information() {
871871
::logging::init();

src/arch/x86_64/kernel/scheduler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,12 @@ impl Clone for TaskTLS {
305305
}
306306
}
307307

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

313-
#[cfg(target_os = "hermit")]
313+
#[cfg(any(target_os = "none", target_os = "hermit"))]
314314
#[naked]
315315
extern "C" fn task_start(_f: extern "C" fn(usize), _arg: usize, _user_stack: u64) -> ! {
316316
// `f` is in the `rdi` register

src/console.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Console {
3131

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

34-
#[cfg(not(target_os = "hermit"))]
34+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
3535
#[test]
3636
fn test_console() {
3737
println!("HelloWorld");

src/lib.rs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@
3030
#![feature(llvm_asm)]
3131
#![feature(global_asm)]
3232
#![no_std]
33-
#![cfg_attr(target_os = "hermit", feature(custom_test_frameworks))]
34-
#![cfg_attr(target_os = "hermit", cfg_attr(test, test_runner(crate::test_runner)))]
3533
#![cfg_attr(
36-
target_os = "hermit",
34+
any(target_os = "none", target_os = "hermit"),
35+
feature(custom_test_frameworks)
36+
)]
37+
#![cfg_attr(
38+
any(target_os = "none", target_os = "hermit"),
39+
cfg_attr(test, test_runner(crate::test_runner))
40+
)]
41+
#![cfg_attr(
42+
any(target_os = "none", target_os = "hermit"),
3743
cfg_attr(test, reexport_test_harness_main = "test_main")
3844
)]
39-
#![cfg_attr(target_os = "hermit", cfg_attr(test, no_main))]
45+
#![cfg_attr(any(target_os = "none", target_os = "hermit"), cfg_attr(test, no_main))]
4046

4147
// EXTERNAL CRATES
4248
#[macro_use]
@@ -47,7 +53,7 @@ extern crate bitflags;
4753
extern crate log;
4854
#[macro_use]
4955
extern crate num_derive;
50-
#[cfg(not(target_os = "hermit"))]
56+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
5157
#[macro_use]
5258
extern crate std;
5359
#[cfg(target_arch = "aarch64")]
@@ -88,7 +94,7 @@ mod errno;
8894
mod ffi;
8995
mod kernel_message_buffer;
9096
mod mm;
91-
#[cfg(target_os = "hermit")]
97+
#[cfg(any(target_os = "none", target_os = "hermit"))]
9298
mod runtime_glue;
9399
mod scheduler;
94100
mod synch;
@@ -102,7 +108,7 @@ pub fn _print(args: ::core::fmt::Arguments<'_>) {
102108
}
103109

104110
#[cfg(test)]
105-
#[cfg(target_os = "hermit")]
111+
#[cfg(any(target_os = "none", target_os = "hermit"))]
106112
#[no_mangle]
107113
extern "C" fn runtime_entry(_argc: i32, _argv: *const *const u8, _env: *const *const u8) -> ! {
108114
println!("Executing hermit unittests. Any arguments are dropped");
@@ -120,14 +126,14 @@ pub fn test_runner(tests: &[&dyn Fn()]) {
120126
sys_exit(0);
121127
}
122128

123-
#[cfg(target_os = "hermit")]
129+
#[cfg(any(target_os = "none", target_os = "hermit"))]
124130
#[test_case]
125131
fn trivial_test() {
126132
println!("Test test test");
127133
panic!("Test called");
128134
}
129135

130-
#[cfg(target_os = "hermit")]
136+
#[cfg(any(target_os = "none", target_os = "hermit"))]
131137
#[global_allocator]
132138
static ALLOCATOR: LockedHeap = LockedHeap::empty();
133139

@@ -137,7 +143,7 @@ static ALLOCATOR: LockedHeap = LockedHeap::empty();
137143
/// Returning a null pointer indicates that either memory is exhausted or
138144
/// `size` and `align` do not meet this allocator's size or alignment constraints.
139145
///
140-
#[cfg(target_os = "hermit")]
146+
#[cfg(any(target_os = "none", target_os = "hermit"))]
141147
pub extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
142148
let layout_res = Layout::from_size_align(size, align);
143149
if layout_res.is_err() || size == 0 {
@@ -179,7 +185,7 @@ pub extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
179185
/// # Errors
180186
/// Returns null if the new layout does not meet the size and alignment constraints of the
181187
/// allocator, or if reallocation otherwise fails.
182-
#[cfg(target_os = "hermit")]
188+
#[cfg(any(target_os = "none", target_os = "hermit"))]
183189
pub extern "C" fn __sys_realloc(
184190
ptr: *mut u8,
185191
size: usize,
@@ -224,7 +230,7 @@ pub extern "C" fn __sys_realloc(
224230
///
225231
/// # Errors
226232
/// May panic if debug assertions are enabled and invalid parameters `size` or `align` where passed.
227-
#[cfg(target_os = "hermit")]
233+
#[cfg(any(target_os = "none", target_os = "hermit"))]
228234
pub extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
229235
unsafe {
230236
let layout_res = Layout::from_size_align(size, align);
@@ -247,7 +253,7 @@ pub extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
247253
}
248254
}
249255

250-
#[cfg(target_os = "hermit")]
256+
#[cfg(any(target_os = "none", target_os = "hermit"))]
251257
extern "C" {
252258
static mut __bss_start: usize;
253259
}
@@ -259,7 +265,7 @@ fn has_ipdevice() -> bool {
259265
}
260266

261267
/// Entry point of a kernel thread, which initialize the libos
262-
#[cfg(target_os = "hermit")]
268+
#[cfg(any(target_os = "none", target_os = "hermit"))]
263269
extern "C" fn initd(_arg: usize) {
264270
extern "C" {
265271
#[cfg(not(test))]
@@ -319,7 +325,7 @@ fn synch_all_cores() {
319325
}
320326

321327
/// Entry Point of HermitCore for the Boot Processor
322-
#[cfg(target_os = "hermit")]
328+
#[cfg(any(target_os = "none", target_os = "hermit"))]
323329
fn boot_processor_main() -> ! {
324330
// Initialize the kernel and hardware.
325331
arch::message_output_init();
@@ -372,7 +378,7 @@ fn boot_processor_main() -> ! {
372378
}
373379

374380
/// Entry Point of HermitCore for an Application Processor
375-
#[cfg(all(target_os = "hermit", feature = "smp"))]
381+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "smp"))]
376382
fn application_processor_main() -> ! {
377383
arch::application_processor_init();
378384
scheduler::add_current_core();

src/mm/allocator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ pub struct Heap {
3131
index: usize,
3232
bottom: usize,
3333
size: usize,
34-
#[cfg(target_os = "hermit")]
34+
#[cfg(any(target_os = "none", target_os = "hermit"))]
3535
holes: HoleList,
36-
#[cfg(not(target_os = "hermit"))]
36+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
3737
pub holes: HoleList,
3838
}
3939

src/mm/freelist.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl FreeList {
190190
}
191191
}
192192

193-
#[cfg(not(target_os = "hermit"))]
193+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
194194
#[test]
195195
fn add_element() {
196196
let mut freelist = FreeList::new();
@@ -208,7 +208,7 @@ fn add_element() {
208208
}
209209
}
210210

211-
#[cfg(not(target_os = "hermit"))]
211+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
212212
#[test]
213213
fn allocate() {
214214
let mut freelist = FreeList::new();
@@ -241,7 +241,7 @@ fn allocate() {
241241
}
242242
}
243243

244-
#[cfg(not(target_os = "hermit"))]
244+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
245245
#[test]
246246
fn deallocate() {
247247
let mut freelist = FreeList::new();

0 commit comments

Comments
 (0)