Skip to content

Commit 5131438

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. Remove __rg_oom since the filter for `target_os = "hermit"` does not work anymore: rust-lang/rust@bc6b2ac
1 parent a074b89 commit 5131438

File tree

18 files changed

+71
-77
lines changed

18 files changed

+71
-77
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ 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(target_arch = "x86_64", any(target_os = "none", target_os = "hermit"), feature = "smp"))]
4848
pub use crate::arch::x86_64::kernel::application_processor_init;
4949
#[cfg(target_arch = "x86_64")]
5050
pub use crate::arch::x86_64::kernel::gdt::set_current_kernel_stack;
@@ -60,7 +60,7 @@ pub use crate::arch::x86_64::kernel::scheduler;
6060
pub use crate::arch::x86_64::kernel::switch;
6161
#[cfg(target_arch = "x86_64")]
6262
pub use crate::arch::x86_64::kernel::systemtime::get_boot_time;
63-
#[cfg(all(target_arch = "x86_64", target_os = "hermit"))]
63+
#[cfg(all(target_arch = "x86_64", any(target_os = "none", target_os = "hermit")))]
6464
pub use crate::arch::x86_64::kernel::{boot_application_processors, boot_processor_init};
6565
#[cfg(target_arch = "x86_64")]
6666
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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ impl BootInfo {
117117
}
118118

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

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

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

@@ -292,7 +292,7 @@ pub fn message_output_init() {
292292
}
293293
}
294294

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

317-
#[cfg(not(target_os = "hermit"))]
317+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
318318
#[test]
319319
fn test_output() {
320320
output_message_byte('t' as u8);
@@ -324,7 +324,7 @@ fn test_output() {
324324
output_message_byte('\n' as u8);
325325
}
326326

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

345-
//#[cfg(target_os = "hermit")]
345+
//#[cfg(any(target_os = "none", target_os = "hermit"))]
346346
pub fn output_message_buf(buf: &[u8]) {
347347
for byte in buf {
348348
output_message_byte(*byte);
349349
}
350350
}
351351

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

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

407407
/// Application Processor initialization
408-
#[cfg(all(target_os = "hermit", feature = "smp"))]
408+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "smp"))]
409409
pub fn application_processor_init() {
410410
percore::init();
411411
processor::configure();
@@ -460,7 +460,7 @@ pub fn print_statistics() {
460460
}
461461
}
462462

463-
#[cfg(target_os = "hermit")]
463+
#[cfg(any(target_os = "none", target_os = "hermit"))]
464464
#[inline(never)]
465465
#[no_mangle]
466466
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
@@ -324,12 +324,12 @@ impl Clone for TaskTLS {
324324
}
325325
}
326326

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

332-
#[cfg(target_os = "hermit")]
332+
#[cfg(any(target_os = "none", target_os = "hermit"))]
333333
#[naked]
334334
extern "C" fn task_start(_f: extern "C" fn(usize), _arg: usize, _user_stack: u64) -> ! {
335335
// `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: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
#![feature(llvm_asm)]
3030
#![feature(global_asm)]
3131
#![no_std]
32-
#![cfg_attr(target_os = "hermit", feature(custom_test_frameworks))]
33-
#![cfg_attr(target_os = "hermit", cfg_attr(test, test_runner(crate::test_runner)))]
32+
#![cfg_attr(any(target_os = "none", target_os = "hermit"), feature(custom_test_frameworks))]
33+
#![cfg_attr(any(target_os = "none", target_os = "hermit"), cfg_attr(test, test_runner(crate::test_runner)))]
3434
#![cfg_attr(
35-
target_os = "hermit",
35+
any(target_os = "none", target_os = "hermit"),
3636
cfg_attr(test, reexport_test_harness_main = "test_main")
3737
)]
38-
#![cfg_attr(target_os = "hermit", cfg_attr(test, no_main))]
38+
#![cfg_attr(any(target_os = "none", target_os = "hermit"), cfg_attr(test, no_main))]
3939

4040
// EXTERNAL CRATES
4141
#[macro_use]
@@ -46,7 +46,7 @@ extern crate bitflags;
4646
extern crate log;
4747
#[macro_use]
4848
extern crate num_derive;
49-
#[cfg(not(target_os = "hermit"))]
49+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
5050
#[macro_use]
5151
extern crate std;
5252
#[cfg(target_arch = "aarch64")]
@@ -87,7 +87,7 @@ mod errno;
8787
mod ffi;
8888
mod kernel_message_buffer;
8989
mod mm;
90-
#[cfg(target_os = "hermit")]
90+
#[cfg(any(target_os = "none", target_os = "hermit"))]
9191
mod runtime_glue;
9292
mod scheduler;
9393
mod synch;
@@ -101,7 +101,7 @@ pub fn _print(args: ::core::fmt::Arguments<'_>) {
101101
}
102102

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

122-
#[cfg(target_os = "hermit")]
122+
#[cfg(any(target_os = "none", target_os = "hermit"))]
123123
#[test_case]
124124
fn trivial_test() {
125125
println!("Test test test");
126126
panic!("Test called");
127127
}
128128

129-
#[cfg(target_os = "hermit")]
129+
#[cfg(any(target_os = "none", target_os = "hermit"))]
130130
#[global_allocator]
131131
static ALLOCATOR: LockedHeap = LockedHeap::empty();
132132

@@ -136,7 +136,7 @@ static ALLOCATOR: LockedHeap = LockedHeap::empty();
136136
/// Returning a null pointer indicates that either memory is exhausted or
137137
/// `size` and `align` do not meet this allocator's size or alignment constraints.
138138
///
139-
#[cfg(target_os = "hermit")]
139+
#[cfg(any(target_os = "none", target_os = "hermit"))]
140140
pub extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
141141
let layout_res = Layout::from_size_align(size, align);
142142
if layout_res.is_err() || size == 0 {
@@ -178,7 +178,7 @@ pub extern "C" fn __sys_malloc(size: usize, align: usize) -> *mut u8 {
178178
/// # Errors
179179
/// Returns null if the new layout does not meet the size and alignment constraints of the
180180
/// allocator, or if reallocation otherwise fails.
181-
#[cfg(target_os = "hermit")]
181+
#[cfg(any(target_os = "none", target_os = "hermit"))]
182182
pub extern "C" fn __sys_realloc(
183183
ptr: *mut u8,
184184
size: usize,
@@ -223,7 +223,7 @@ pub extern "C" fn __sys_realloc(
223223
///
224224
/// # Errors
225225
/// May panic if debug assertions are enabled and invalid parameters `size` or `align` where passed.
226-
#[cfg(target_os = "hermit")]
226+
#[cfg(any(target_os = "none", target_os = "hermit"))]
227227
pub extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
228228
unsafe {
229229
let layout_res = Layout::from_size_align(size, align);
@@ -246,7 +246,7 @@ pub extern "C" fn __sys_free(ptr: *mut u8, size: usize, align: usize) {
246246
}
247247
}
248248

249-
#[cfg(target_os = "hermit")]
249+
#[cfg(any(target_os = "none", target_os = "hermit"))]
250250
extern "C" {
251251
static mut __bss_start: usize;
252252
}
@@ -258,7 +258,7 @@ fn has_ipdevice() -> bool {
258258
}
259259

260260
/// Entry point of a kernel thread, which initialize the libos
261-
#[cfg(target_os = "hermit")]
261+
#[cfg(any(target_os = "none", target_os = "hermit"))]
262262
extern "C" fn initd(_arg: usize) {
263263
extern "C" {
264264
#[cfg(not(test))]
@@ -318,7 +318,7 @@ fn synch_all_cores() {
318318
}
319319

320320
/// Entry Point of HermitCore for the Boot Processor
321-
#[cfg(target_os = "hermit")]
321+
#[cfg(any(target_os = "none", target_os = "hermit"))]
322322
fn boot_processor_main() -> ! {
323323
// Initialize the kernel and hardware.
324324
arch::message_output_init();
@@ -371,7 +371,7 @@ fn boot_processor_main() -> ! {
371371
}
372372

373373
/// Entry Point of HermitCore for an Application Processor
374-
#[cfg(all(target_os = "hermit", feature = "smp"))]
374+
#[cfg(all(any(target_os = "none", target_os = "hermit"), feature = "smp"))]
375375
fn application_processor_main() -> ! {
376376
arch::application_processor_init();
377377
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();

src/mm/hole.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl HoleList {
8080
}
8181

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

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

100-
#[cfg(not(target_os = "hermit"))]
100+
#[cfg(not(any(target_os = "none", target_os = "hermit")))]
101101
pub struct Hole {
102102
pub size: usize,
103103
pub next: Option<&'static mut Hole>,

0 commit comments

Comments
 (0)