From f1ffe1d60e9d6d6c042a70c327f02c538bb443ac Mon Sep 17 00:00:00 2001 From: DeathWish5 Date: Fri, 20 May 2022 20:16:54 +0800 Subject: [PATCH] cargo fmt and clippy --- drivers/src/irq/riscv_intc.rs | 4 ++-- drivers/src/irq/x86_apic/lapic.rs | 4 +++- drivers/src/scheme/irq.rs | 2 +- kernel-hal/Cargo.toml | 2 +- kernel-hal/src/bare/arch/x86_64/drivers.rs | 4 ++-- kernel-hal/src/bare/arch/x86_64/timer.rs | 1 - loader/Cargo.toml | 2 +- tests | 2 +- zCore/Cargo.toml | 2 +- zCore/Makefile | 18 +++++++++++------- 10 files changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/src/irq/riscv_intc.rs b/drivers/src/irq/riscv_intc.rs index 743bc4735..91a3dde98 100644 --- a/drivers/src/irq/riscv_intc.rs +++ b/drivers/src/irq/riscv_intc.rs @@ -1,5 +1,5 @@ -use riscv::register::sie; use lock::Mutex; +use riscv::register::sie; use crate::prelude::IrqHandler; use crate::scheme::{IrqScheme, Scheme}; @@ -128,4 +128,4 @@ impl IrqScheme for Intc { } }) } -} \ No newline at end of file +} diff --git a/drivers/src/irq/x86_apic/lapic.rs b/drivers/src/irq/x86_apic/lapic.rs index d2e171ea5..cc8d78199 100644 --- a/drivers/src/irq/x86_apic/lapic.rs +++ b/drivers/src/irq/x86_apic/lapic.rs @@ -1,4 +1,6 @@ -use x2apic::lapic::{xapic_base, LocalApic as LocalApicInner, LocalApicBuilder, TimerDivide, TimerMode}; +use x2apic::lapic::{ + xapic_base, LocalApic as LocalApicInner, LocalApicBuilder, TimerDivide, TimerMode, +}; use super::{consts, Phys2VirtFn}; diff --git a/drivers/src/scheme/irq.rs b/drivers/src/scheme/irq.rs index 5aaec8dde..c236032eb 100644 --- a/drivers/src/scheme/irq.rs +++ b/drivers/src/scheme/irq.rs @@ -80,5 +80,5 @@ pub trait IrqScheme: Scheme { /// [for x86_64] enable apic timer fn apic_timer_enable(&self) { unimplemented!() - } + } } diff --git a/kernel-hal/Cargo.toml b/kernel-hal/Cargo.toml index c14470137..3b8482639 100644 --- a/kernel-hal/Cargo.toml +++ b/kernel-hal/Cargo.toml @@ -57,7 +57,7 @@ bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator.git", r # Bare-metal mode [target.'cfg(target_os = "none")'.dependencies] -executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler", rev = "6f5b579" } +executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler", rev = "3b04ba4" } naive-timer = "0.2.0" # All mode on x86_64 diff --git a/kernel-hal/src/bare/arch/x86_64/drivers.rs b/kernel-hal/src/bare/arch/x86_64/drivers.rs index 0e70585b7..76c652a74 100644 --- a/kernel-hal/src/bare/arch/x86_64/drivers.rs +++ b/kernel-hal/src/bare/arch/x86_64/drivers.rs @@ -33,11 +33,11 @@ pub(super) fn init() -> DeviceResult { irq.unmask(trap::X86_ISA_IRQ_COM2)?; } } - + use x2apic::lapic::{TimerDivide, TimerMode}; irq.register_local_apic_handler(trap::X86_INT_APIC_TIMER, Box::new(super::trap::super_timer))?; - + // SAFETY: this will be called once and only once for every core Apic::local_apic().set_timer_mode(TimerMode::Periodic); Apic::local_apic().set_timer_divide(TimerDivide::Div256); // indeed it is Div1, the name is confusing. diff --git a/kernel-hal/src/bare/arch/x86_64/timer.rs b/kernel-hal/src/bare/arch/x86_64/timer.rs index 7ee592315..77d5a040c 100644 --- a/kernel-hal/src/bare/arch/x86_64/timer.rs +++ b/kernel-hal/src/bare/arch/x86_64/timer.rs @@ -9,4 +9,3 @@ pub fn init() { let irq = crate::drivers::all_irq().first_unwrap(); irq.apic_timer_enable(); } - diff --git a/loader/Cargo.toml b/loader/Cargo.toml index 114d627f9..4c8aa72a3 100644 --- a/loader/Cargo.toml +++ b/loader/Cargo.toml @@ -19,7 +19,7 @@ zircon-object = { path = "../zircon-object", features = ["elf"] } linux-object = { path = "../linux-object", optional = true } zircon-syscall = { path = "../zircon-syscall", optional = true } linux-syscall = { path = "../linux-syscall", optional = true } -executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler", rev = "6f5b579" } +executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler", rev = "3b04ba4" } [features] default = ["libos", "linux", "zircon"] diff --git a/tests b/tests index e2ffba5d0..1a13d6c6a 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit e2ffba5d07feb7011376ce721557cd20025b9093 +Subproject commit 1a13d6c6a1fe613771b205838b837dc6e4169ae5 diff --git a/zCore/Cargo.toml b/zCore/Cargo.toml index 9e12c3b71..bc38e72fb 100644 --- a/zCore/Cargo.toml +++ b/zCore/Cargo.toml @@ -65,7 +65,7 @@ linux-object = { path = "../linux-object", optional = true } rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "1a3246b", optional = true } rcore-fs-sfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "1a3246b", optional = true } lock = { git = "https://github.com/DeathWish5/kernel-sync", rev = "01b2e70" } -executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler", rev = "6f5b579" } +executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler", rev = "3b04ba4" } # LibOS mode [target.'cfg(not(target_os = "none"))'.dependencies] diff --git a/zCore/Makefile b/zCore/Makefile index 3cbb49732..49cad1cc7 100644 --- a/zCore/Makefile +++ b/zCore/Makefile @@ -1,10 +1,10 @@ ################ Arguments ################ -ARCH ?= riscv64 +ARCH ?= x86_64 PLATFORM ?= qemu MODE ?= release LOG ?= warn -LINUX ?= 1 +LINUX ?= LIBOS ?= TEST ?= GRAPHIC ?= @@ -188,11 +188,15 @@ else qemu_opts += -display none -nographic endif -ifeq ($(ACCEL), 1) - ifeq ($(shell uname), Darwin) - qemu_opts += -accel hvf - else - qemu_opts += -accel kvm -cpu host,migratable=no,+invtsc +ifeq ($(ARCH), x86_64) + ifeq ($(PLATFORM), qemu) + ifeq ($(ACCEL), 1) + ifeq ($(shell uname), Darwin) + qemu_opts += -accel hvf + else + qemu_opts += -accel kvm -cpu host,migratable=no,+invtsc + endif + endif endif endif