(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这个设计很好,在一些库里可以看到。这个设计让我们可以很方便地扩展三方库给的一些功能,同时不破坏这个库本身的代码和结构。
协作式调度的特点是,任务若不主动让出执行权(yield),就会持续执行下去。与之相反,抢占式调度则是任务随时可能被切换出去。现代操作系统出于避免恶意程序长时间占用 CPU 的考量,大多采用抢占式调度方式。然而,抢占式调度存在明显缺点,由于任务随时可能被切换,所以必须保存任务的堆栈,如此一来,当任务再次被切回时,才能恢复到切换出去时的状态。这就导致在大规模并发场景下,需要耗费大量内存来保存众多任务的堆栈。
pubstructProgramHeader { /// Program segment type pub p_type: u32, /// Offset into the ELF file where this segment begins pub p_offset: u64, /// Virtual adress where this segment should be loaded pub p_vaddr: u64, /// Physical address where this segment should be loaded pub p_paddr: u64, /// Size of this segment in the file pub p_filesz: u64, /// Size of this segment in memory pub p_memsz: u64, /// Flags for this segment pub p_flags: u32, /// file and memory alignment pub p_align: u64, }
pubstructSectionHeader { /// Section Name,对应字符串在string table段中的偏移 pub sh_name: u32, /// Section Type pub sh_type: u32, /// Section Flags pub sh_flags: u64, /// in-memory address where this section is loaded pub sh_addr: u64, /// Byte-offset into the file where this section starts pub sh_offset: u64, /// Section size in bytes pub sh_size: u64, /// Defined by section type pub sh_link: u32, /// Defined by section type pub sh_info: u32, /// address alignment pub sh_addralign: u64, /// size of an entry if section data is an array of entries pub sh_entsize: u64, }