(1) POST( Power On Self Test):上电自检,BIOS 对计算机硬件(CPU、主板、内存等)的检测。 (2) POST 之后的初始化与启动相关硬件(磁盘、键盘控制器等)。 (3) 为 OS 创建一些参数,如 ACPI、E820 表等。 (4) 选择引导设备,从设备中加载 BootLoader,进而启动操作系统。
VmcsGuestNW::RIP.write(entry.as_usize() & 0xffff)?; VmcsGuest16::CS_SELECTOR.write(((entry.as_usize() >> 4) & 0xf000) asu16)?; // On Intel requires 'base' to be 'selector * 16' in real mode. VmcsGuestNW::CS_BASE.write(entry.as_usize() & 0xf0000)?;
实现了clone,但是具体的flags没有处理,只按照fork的语义+返回并且用给定的栈。这个位置应该加上Copy on Write的支持,在MemorySet的Backend里加上这个,给每个页一个标记,然后在处理Page Fault的时候如果这个标记有了,就把这个页给复制一份,然后取消共享(虽然因为时间的关系没有实现)。我觉得Backend这个设计很好,在一些库里可以看到。这个设计让我们可以很方便地扩展三方库给的一些功能,同时不破坏这个库本身的代码和结构。
/// Prints to the standard output, with a newline. #[macro_export] macro_rules! println { () => { $crate::print!("\n") }; ($($arg:tt)*) => { $crate::io::__print_impl(format_args!("\x1b[31m{}\n\x1b[0m", format_args!($($arg)*))); } }
/// Write a slice of bytes to the console. pubfnwrite_bytes(bytes: &[u8]) { let color_begin = "\x1b[31m"; let color_end = "\x1b[0m"; for c in color_begin.bytes() { putchar(c); } for c in bytes { putchar(*c); } for c in color_end.bytes() { putchar(c); } } } ... ...
warning: `/home/winddevil/.cargo/config` is deprecated in favor of `config.toml` note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` warning: `/home/winddevil/.cargo/config` is deprecated in favor of `config.toml` note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` warning: `/home/winddevil/.cargo/config` is deprecated in favor of `config.toml` note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` warning: `/home/winddevil/.cargo/config` is deprecated in favor of `config.toml` note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` Compiling log v0.4.21 Compiling cfg-if v1.0.0 Compiling tock-registers v0.8.1 Compiling bitflags v2.6.0 Compiling axerrno v0.1.0 Compiling byteorder v1.4.3 Compiling const-default v1.0.0 Compiling memory_addr v0.3.1 Compiling bit_field v0.10.2 Compiling percpu v0.1.3 Compiling lock_api v0.4.10 Compiling lazyinit v0.2.1 Compiling axconfig v0.1.0 (/home/winddevil/workspace/arceos/modules/axconfig) Compiling int_ratio v0.1.0 Compiling static_assertions v1.1.0 Compiling linkme v0.3.27 Compiling scopeguard v1.2.0 Compiling handler_table v0.1.1 Compiling kernel_guard v0.1.1 Compiling axdriver_base v0.1.0 (https://github.com/arceos-org/axdriver_crates.git?tag=v0.1.0#78686a7e) Compiling aarch64-cpu v9.4.0 Compiling rlsf v0.2.1 Compiling dw_apb_uart v0.1.0 Compiling arm_gicv2 v0.1.0 Compiling arm_pl011 v0.1.0 Compiling bitmap-allocator v0.1.0 Compiling heapless v0.7.16 Compiling kspin v0.1.0 Compiling zerocopy v0.7.35 Compiling hash32 v0.2.1 Compiling stable_deref_trait v1.2.0 Compiling smoltcp v0.10.0 (https://github.com/rcore-os/smoltcp.git?rev=2ade274#2ade2747) Compiling axdriver v0.1.0 (/home/winddevil/workspace/arceos/modules/axdriver) Compiling num-traits v0.2.16 Compiling managed v0.8.0 Compiling axlog v0.1.0 (/home/winddevil/workspace/arceos/modules/axlog) Compiling bitflags v1.3.2 Compiling axio v0.1.0 Compiling spin v0.9.8 Compiling allocator v0.1.0 (https://github.com/arceos-org/allocator.git?tag=v0.1.0#16496d88) Compiling axdriver_net v0.1.0 (https://github.com/arceos-org/axdriver_crates.git?tag=v0.1.0#78686a7e) Compiling axalloc v0.1.0 (/home/winddevil/workspace/arceos/modules/axalloc) Compiling virtio-drivers v0.7.4 Compiling axhal v0.1.0 (/home/winddevil/workspace/arceos/modules/axhal) Compiling chrono v0.4.38 Compiling page_table_entry v0.4.0 Compiling axdriver_virtio v0.1.0 (https://github.com/arceos-org/axdriver_crates.git?tag=v0.1.0#78686a7e) Compiling axdriver_pci v0.1.0 (https://github.com/arceos-org/axdriver_crates.git?tag=v0.1.0#78686a7e) Compiling page_table_multiarch v0.4.0 error[E0425]: cannot find function `init_boot_page_table` in module `crate::platform::mem` --> modules/axhal/src/platform/aarch64_common/boot.rs:100:27 | 100 | crate::platform::mem::init_boot_page_table(addr_of_mut!(BOOT_PT_L0), addr_of_mut!(BOOT_PT_L1)); | ^^^^^^^^^^^^^^^^^^^^ not found in `crate::platform::mem`
error[E0425]: cannot find value `rust_entry` in module `crate::platform` --> modules/axhal/src/platform/aarch64_common/boot.rs:139:38 | 139 | entry = sym crate::platform::rust_entry, | ^^^^^^^^^^ not found in `crate::platform`
error[E0425]: cannot find value `rust_entry_secondary` in module `crate::platform` --> modules/axhal/src/platform/aarch64_common/boot.rs:170:38 | 170 | entry = sym crate::platform::rust_entry_secondary, | ^^^^^^^^^^^^^^^^^^^^ not found in `crate::platform`
error[E0425]: cannot find value `PSCI_METHOD` in crate `axconfig` --> modules/axhal/src/platform/aarch64_common/psci.rs:82:31 | 82 | let ret = match axconfig::PSCI_METHOD { | ^^^^^^^^^^^ not found in `axconfig`
error[E0425]: cannot find value `PSCI_METHOD` in crate `axconfig` --> modules/axhal/src/platform/aarch64_common/psci.rs:85:58 | 85 | _ => panic!("Unknown PSCI method: {}", axconfig::PSCI_METHOD), | ^^^^^^^^^^^ not found in `axconfig`
error[E0425]: cannot find value `UART_PADDR` in crate `axconfig` --> modules/axhal/src/platform/aarch64_common/pl011.rs:9:43 | 9 | const UART_BASE: PhysAddr = pa!(axconfig::UART_PADDR); | ^^^^^^^^^^ not found in `axconfig`
For more information about this error, try `rustc --explain E0425`. error: could not compile `axhal` (lib) due to 6 previous errors warning: build failed, waiting for other jobs to finish...
随后worker2获取到双端队列之后,尝试输出队列最前边的内容.全部输出完之后,进入另一个分支输出worker2: nothing to do!,并且yield.但是由于vruntime仍然是worker2最小,因此又运行了两次,一共运行三次以后才切换回worker1.(这说明cfs调度算法的yield是考虑切换,而不是直接把当前任务放进队列最后)
#[macro_use] #[cfg(feature = "axstd")] externcrate axstd as std;
use core::{mem, str}; use std::os::arceos::modules::axhal::mem::phys_to_virt;
/// Physical address for pflash#1 const PFLASH_START: usize = 0x2200_0000;
#[cfg_attr(feature = "axstd", no_mangle)] fnmain() { // Makesure that we can access pflash region. let va = phys_to_virt(PFLASH_START.into()).as_usize(); let ptr = va as *constu32; unsafe { println!("Try to access dev region [{:#X}], got {:#X}", va, *ptr); let magic = mem::transmute::<u32, [u8; 4]>(*ptr); println!("Got pflash magic: {}", str::from_utf8(&magic).unwrap()); } }
#[macro_use] #[cfg(feature = "axstd")] externcrate axstd as std;
use core::{mem, str}; use std::thread; use std::os::arceos::modules::axhal::mem::phys_to_virt;
/// Physical address for pflash#1 const PFLASH_START: usize = 0x2200_0000;
#[cfg_attr(feature = "axstd", no_mangle)] fnmain() { println!("Multi-task is starting ...");
let worker = thread::spawn(move || { println!("Spawned-thread ...");
// Makesure that we can access pflash region. let va = phys_to_virt(PFLASH_START.into()).as_usize(); let ptr = va as *constu32; let magic = unsafe { mem::transmute::<u32, [u8; 4]>(*ptr) }; ifletOk(s) = str::from_utf8(&magic) { println!("Got pflash magic: {s}"); 0 } else { -1 } });
let ret = worker.join(); // Makesure that worker has finished its work. assert_eq!(ret, Ok(0));