Skip to content

Commit

Permalink
cargo fmt and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathWish5 committed May 20, 2022
1 parent bba9878 commit f1ffe1d
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions drivers/src/irq/riscv_intc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use riscv::register::sie;
use lock::Mutex;
use riscv::register::sie;

use crate::prelude::IrqHandler;
use crate::scheme::{IrqScheme, Scheme};
Expand Down Expand Up @@ -128,4 +128,4 @@ impl IrqScheme for Intc {
}
})
}
}
}
4 changes: 3 additions & 1 deletion drivers/src/irq/x86_apic/lapic.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion drivers/src/scheme/irq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ pub trait IrqScheme: Scheme {
/// [for x86_64] enable apic timer
fn apic_timer_enable(&self) {
unimplemented!()
}
}
}
2 changes: 1 addition & 1 deletion kernel-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions kernel-hal/src/bare/arch/x86_64/drivers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion kernel-hal/src/bare/arch/x86_64/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ pub fn init() {
let irq = crate::drivers::all_irq().first_unwrap();
irq.apic_timer_enable();
}

2 changes: 1 addition & 1 deletion loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion zCore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 11 additions & 7 deletions zCore/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
################ Arguments ################

ARCH ?= riscv64
ARCH ?= x86_64
PLATFORM ?= qemu
MODE ?= release
LOG ?= warn
LINUX ?= 1
LINUX ?=
LIBOS ?=
TEST ?=
GRAPHIC ?=
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f1ffe1d

Please sign in to comment.