delete unused comments/output

This commit is contained in:
DeathWish5 2022-03-24 17:50:34 +08:00
parent 3559a39b1f
commit 974c5a887a
30 changed files with 59 additions and 59 deletions

View File

@ -16,10 +16,4 @@ exclude = [
] ]
[profile.release] [profile.release]
lto = true lto = true
[patch.'https://github.com/DeathWish5/kernel-sync']
lock = { path = "../../ASYNC/kernel-sync" }
# [patch.'https://github.com/rcore-os/executor']
# executor = { path = "../../ASYNC/PreemptiveScheduler" }

View File

@ -4,7 +4,7 @@ ROOTFS_URL := http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/$(ROOTF
RISCV64_ROOTFS_TAR := prebuild.tar.xz RISCV64_ROOTFS_TAR := prebuild.tar.xz
RISCV64_ROOTFS_URL := https://github.com/rcore-os/libc-test-prebuilt/releases/download/0.1/$(RISCV64_ROOTFS_TAR) RISCV64_ROOTFS_URL := https://github.com/rcore-os/libc-test-prebuilt/releases/download/0.1/$(RISCV64_ROOTFS_TAR)
ARCH ?= riscv64 ARCH ?= x86_64
rcore_fs_fuse_revision := 7f5eeac rcore_fs_fuse_revision := 7f5eeac
OUT_IMG := zCore/$(ARCH).img OUT_IMG := zCore/$(ARCH).img
TMP_ROOTFS := /tmp/rootfs TMP_ROOTFS := /tmp/rootfs

View File

@ -89,7 +89,7 @@ impl<M: IoMapper> DevicetreeDriverBuilder<M> {
match comp { match comp {
#[cfg(feature = "virtio")] #[cfg(feature = "virtio")]
c if c.contains("virtio,mmio") => self.parse_virtio(node, props), c if c.contains("virtio,mmio") => self.parse_virtio(node, props),
// c if c.contains("allwinner,sunxi-gmac") => self.parse_ethernet(node, comp, props), c if c.contains("allwinner,sunxi-gmac") => self.parse_ethernet(node, comp, props),
c if c.contains("ns16550a") => self.parse_uart(node, comp, props), c if c.contains("ns16550a") => self.parse_uart(node, comp, props),
c if c.contains("allwinner,sun20i-uart") => self.parse_uart(node, comp, props), c if c.contains("allwinner,sun20i-uart") => self.parse_uart(node, comp, props),
_ => Err(DeviceError::NotSupported), _ => Err(DeviceError::NotSupported),

View File

@ -1,6 +1,5 @@
use alloc::{boxed::Box, sync::Arc}; use alloc::{boxed::Box, sync::Arc};
// use spin::Mutex;
use lock::mutex::Mutex; use lock::mutex::Mutex;
use crate::prelude::{CapabilityType, InputEvent, InputEventType}; use crate::prelude::{CapabilityType, InputEvent, InputEventType};

View File

@ -5,8 +5,10 @@ use crate::net::get_sockets;
use alloc::sync::Arc; use alloc::sync::Arc;
use alloc::string::String; use alloc::string::String;
// use spin::Mutex; use spin::Mutex;
use lock::mutex::Mutex;
// TODO: fix this, should use no-irq lock, but can't pass build of libos
// use lock::mutex::Mutex;
use crate::scheme::{NetScheme, Scheme}; use crate::scheme::{NetScheme, Scheme};
use crate::{DeviceError, DeviceResult}; use crate::{DeviceError, DeviceResult};

View File

@ -19,7 +19,7 @@ spin = "0.9"
lock = { git = "https://github.com/DeathWish5/kernel-sync" } lock = { git = "https://github.com/DeathWish5/kernel-sync" }
cfg-if = "1.0" cfg-if = "1.0"
bitflags = "1.3" bitflags = "1.3"
trapframe = "0.9" trapframe = "0.9.0"
git-version = "0.3" git-version = "0.3"
numeric-enum-macro = "0.2" numeric-enum-macro = "0.2"
lazy_static = { version = "1.4", features = ["spin_no_std"] } lazy_static = { version = "1.4", features = ["spin_no_std"] }
@ -36,21 +36,20 @@ bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator", rev =
# Bare-metal mode # Bare-metal mode
[target.'cfg(target_os = "none")'.dependencies] [target.'cfg(target_os = "none")'.dependencies]
executor = { path = "../../../ASYNC/PreemptiveScheduler" } executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler" }
# executor = { git = "https://github.com/rcore-os/executor.git", rev = "85b9335" }
naive-timer = "0.2.0" naive-timer = "0.2.0"
# All mode on x86_64 # All mode on x86_64
[target.'cfg(target_arch = "x86_64")'.dependencies] [target.'cfg(target_arch = "x86_64")'.dependencies]
x86 = "0.46" x86 = "0.47"
x86_64 = "0.14" x86_64 = "0.14"
# Bare-metal mode on x86_64 # Bare-metal mode on x86_64
[target.'cfg(all(target_os = "none", target_arch = "x86_64"))'.dependencies] [target.'cfg(all(target_os = "none", target_arch = "x86_64"))'.dependencies]
uefi = "0.11" uefi = "0.11"
raw-cpuid = "9.0" raw-cpuid = "9.0"
x86-smpboot = { git = "https://github.com/rcore-os/x86-smpboot", rev = "1069df3" } x86-smpboot = { git = "https://github.com/rcore-os/x86-smpboot", rev = "43ffedf" }
# Bare-metal mode on riscv64 # Bare-metal mode on riscv64
[target.'cfg(all(target_os = "none", target_arch = "riscv64"))'.dependencies] [target.'cfg(all(target_os = "none", target_arch = "riscv64"))'.dependencies]
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "cd31989", features = ["inline-asm"] } riscv = { git = "https://github.com/rust-embedded/riscv", rev = "cd31989ba1", features = ["inline-asm"] }

View File

@ -91,6 +91,6 @@ pub(super) fn intc_init() -> DeviceResult {
Box::new(super::trap::super_timer), Box::new(super::trap::super_timer),
)?; )?;
irq.unmask(ScauseIntCode::SupervisorSoft as _)?; irq.unmask(ScauseIntCode::SupervisorSoft as _)?;
irq.unmask(ScauseIntCode::SupervisorTimer as _)?; irq.unmask(ScauseIntCode::SupervisorTimer as _)?;
Ok(()) Ok(())
} }

View File

@ -17,7 +17,6 @@ hal_fn_impl! {
fn handle_irq(cause: usize) { fn handle_irq(cause: usize) {
trace!("Handle irq cause: {}", cause); trace!("Handle irq cause: {}", cause);
warn!("Handle irq cause: {}", cause);
crate::drivers::all_irq().first_unwrap().handle_irq(cause) crate::drivers::all_irq().first_unwrap().handle_irq(cause)
} }

View File

@ -10,7 +10,11 @@ use x86_64::instructions::interrupts;
hal_fn_impl! { hal_fn_impl! {
impl mod crate::hal_fn::interrupt { impl mod crate::hal_fn::interrupt {
fn wait_for_interrupt() { fn wait_for_interrupt() {
interrupts::hlt(); let enable = interrupts::are_enabled();
interrupts::enable_and_hlt();
if !enable {
interrupts::disable();
}
} }
fn is_valid_irq(gsi: usize) -> bool { fn is_valid_irq(gsi: usize) -> bool {

View File

@ -4,5 +4,3 @@ pub fn timer_now() -> Duration {
let cycle = unsafe { core::arch::x86_64::_rdtsc() }; let cycle = unsafe { core::arch::x86_64::_rdtsc() };
Duration::from_nanos(cycle * 1000 / super::cpu::cpu_frequency() as u64) Duration::from_nanos(cycle * 1000 / super::cpu::cpu_frequency() as u64)
} }
pub fn timer_init

View File

@ -32,7 +32,10 @@ pub extern "C" fn trap_handler(tf: &mut TrapFrame) {
super::cpu::cpu_id() super::cpu::cpu_id()
); );
trace!("trap happened: {:?}", TrapReason::from(tf.trap_num, tf.error_code)); trace!(
"trap happened: {:?}",
TrapReason::from(tf.trap_num, tf.error_code)
);
match TrapReason::from(tf.trap_num, tf.error_code) { match TrapReason::from(tf.trap_num, tf.error_code) {
TrapReason::HardwareBreakpoint | TrapReason::SoftwareBreakpoint => breakpoint(), TrapReason::HardwareBreakpoint | TrapReason::SoftwareBreakpoint => breakpoint(),

View File

@ -11,8 +11,8 @@ use alloc::vec::Vec;
use alloc::sync::Arc; use alloc::sync::Arc;
use alloc::string::String; use alloc::string::String;
// use spin::Mutex; use spin::Mutex;
use lock::mutex::Mutex; // use lock::mutex::Mutex;
use crate::drivers::add_device; use crate::drivers::add_device;
use crate::drivers::all_net; use crate::drivers::all_net;

View File

@ -5,8 +5,8 @@ use core::time::Duration;
use naive_timer::Timer; use naive_timer::Timer;
// use spin::Mutex; // use spin::Mutex;
use lock::mutex::Mutex;
use core::sync::atomic::{AtomicBool, Ordering}; use core::sync::atomic::{AtomicBool, Ordering};
use lock::mutex::Mutex;
#[allow(dead_code)] #[allow(dead_code)]
pub(super) const TICKS_PER_SEC: u64 = 100; pub(super) const TICKS_PER_SEC: u64 = 100;

View File

@ -463,7 +463,6 @@ impl Syscall<'_> {
// Sys::INIT_MODULE => self.sys_init_module(a0.into(), a1 as usize, a2.into()), // Sys::INIT_MODULE => self.sys_init_module(a0.into(), a1 as usize, a2.into()),
Sys::FINIT_MODULE => self.unimplemented("finit_module", Err(LxError::ENOSYS)), Sys::FINIT_MODULE => self.unimplemented("finit_module", Err(LxError::ENOSYS)),
// Sys::DELETE_MODULE => self.sys_delete_module(a0.into(), a1 as u32), // Sys::DELETE_MODULE => self.sys_delete_module(a0.into(), a1 as u32),
Sys::BLOCK_IN_KERNEL => self.sys_block_in_kernel(), Sys::BLOCK_IN_KERNEL => self.sys_block_in_kernel(),
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]

View File

@ -346,3 +346,5 @@
#define __NR_pidfd_open 434 #define __NR_pidfd_open 434
#define __NR_clone3 435 #define __NR_clone3 435
// JUST FOR TEST
#define __NR_block_in_kernel 600

View File

@ -64,7 +64,10 @@ impl Syscall<'_> {
continue; continue;
} }
old = sec; old = sec;
warn!("1 seconds past intr = {}", kernel_hal::interrupt::intr_get()); warn!(
"1 seconds past intr = {}",
kernel_hal::interrupt::intr_get()
);
} }
} }
@ -104,4 +107,3 @@ impl Syscall<'_> {
Ok(tick as usize) Ok(tick as usize)
} }
} }

View File

@ -16,8 +16,7 @@ zircon-object = { path = "../zircon-object", features = ["elf"] }
linux-object = { path = "../linux-object", optional = true } linux-object = { path = "../linux-object", optional = true }
zircon-syscall = { path = "../zircon-syscall", optional = true } zircon-syscall = { path = "../zircon-syscall", optional = true }
linux-syscall = { path = "../linux-syscall", optional = true } linux-syscall = { path = "../linux-syscall", optional = true }
# executor = { git = "https://github.com/rcore-os/executor.git", rev = "04b6b7b" } executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler" }
executor = { path = "../../../ASYNC/PreemptiveScheduler" }
[features] [features]
default = ["libos", "linux", "zircon"] default = ["libos", "linux", "zircon"]

View File

@ -65,8 +65,7 @@ rcore-fs-hostfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7c232ec
# Bare-metal mode # Bare-metal mode
[target.'cfg(target_os = "none")'.dependencies] [target.'cfg(target_os = "none")'.dependencies]
buddy_system_allocator = "0.7" buddy_system_allocator = "0.7"
# executor = { git = "https://github.com/rcore-os/executor.git", rev = "85b9335" } executor = { git = "https://github.com/DeathWish5/PreemptiveScheduler" }
executor = { path = "../../../ASYNC/PreemptiveScheduler" }
# Bare-metal mode on x86_64 # Bare-metal mode on x86_64
[target.'cfg(all(target_os = "none", target_arch = "x86_64"))'.dependencies] [target.'cfg(all(target_os = "none", target_arch = "x86_64"))'.dependencies]

View File

@ -4,7 +4,7 @@ ARCH ?= x86_64
PLATFORM ?= qemu PLATFORM ?= qemu
MODE ?= release MODE ?= release
LOG ?= warn LOG ?= warn
LINUX ?= 1 LINUX ?=
LIBOS ?= LIBOS ?=
TEST ?= TEST ?=
GRAPHIC ?= GRAPHIC ?=
@ -18,10 +18,16 @@ ZBI ?= bringup
SMP ?= 1 SMP ?= 1
ACCEL ?= ACCEL ?=
# OBJDUMP ?= rust-objdump --print-imm-hex --x86-asm-syntax=intel
OBJDUMP ?= riscv64-linux-musl-objdump OBJDUMP :=
OBJCOPY ?= rust-objcopy --binary-architecture=$(ARCH) OBJCOPY ?= rust-objcopy --binary-architecture=$(ARCH)
ifeq ($(ARCH), x86_64)
OBJDUMP := rust-objdump --print-imm-hex --x86-asm-syntax=intel
else ifeq ($(ARCH), riscv64)
OBJDUMP := riscv64-linux-musl-objdump
endif
ifeq ($(LINUX), 1) ifeq ($(LINUX), 1)
CMDLINE ?= LOG=$(LOG) CMDLINE ?= LOG=$(LOG)
else else

View File

@ -5,13 +5,11 @@ use log::{self, Level, LevelFilter, Log, Metadata, Record};
pub fn init() { pub fn init() {
static LOGGER: SimpleLogger = SimpleLogger; static LOGGER: SimpleLogger = SimpleLogger;
log::set_logger(&LOGGER).unwrap(); log::set_logger(&LOGGER).unwrap();
log::set_max_level(LevelFilter::Info); log::set_max_level(LevelFilter::Warn);
} }
/// Reset max log level. /// Reset max log level.
pub fn set_max_level(_level: &str) { pub fn set_max_level(level: &str) {
// log::set_max_level(LevelFilter::Off);
// log::set_max_level(LevelFilter::Info);
log::set_max_level(level.parse().unwrap_or(LevelFilter::Warn)); log::set_max_level(level.parse().unwrap_or(LevelFilter::Warn));
} }

View File

@ -39,8 +39,6 @@ fn primary_main(config: kernel_hal::KernelConfig) {
STARTED.store(true, Ordering::SeqCst); STARTED.store(true, Ordering::SeqCst);
kernel_hal::interrupt::intr_on(); kernel_hal::interrupt::intr_on();
// info!("wait for time interrupt");
// kernel_hal::interrupt::wait_for_interrupt();
cfg_if! { cfg_if! {
if #[cfg(all(feature = "linux", feature = "zircon"))] { if #[cfg(all(feature = "linux", feature = "zircon"))] {

View File

@ -120,11 +120,10 @@ pub fn wait_for_exit(proc: Option<Arc<Process>>) -> ! {
pub fn wait_for_exit(proc: Option<Arc<Process>>) -> ! { pub fn wait_for_exit(proc: Option<Arc<Process>>) -> ! {
kernel_hal::timer::timer_set_first(); kernel_hal::timer::timer_set_first();
loop { loop {
executor::run_until_idle(); let has_task = executor::run_until_idle();
if cfg!(feature = "baremetal-test") && !has_task { if cfg!(feature = "baremetal-test") && !has_task {
proc.map(check_exit_code); proc.map(check_exit_code);
kernel_hal::cpu::reset(); kernel_hal::cpu::reset();
} }
kernel_hal::interrupt::wait_for_interrupt();
} }
} }

View File

@ -1,6 +1,6 @@
use kernel_hal::interrupt; use kernel_hal::interrupt;
use { use {
super::*, super::*,
spin::Mutex, spin::Mutex,
// lock::mutex::Mutex, // lock::mutex::Mutex,
}; };

View File

@ -3,7 +3,7 @@ use {
alloc::collections::VecDeque, alloc::collections::VecDeque,
alloc::sync::{Arc, Weak}, alloc::sync::{Arc, Weak},
bitflags::bitflags, bitflags::bitflags,
// lock::mutex::Mutex, // lock::mutex::Mutex,
spin::Mutex, spin::Mutex,
}; };

View File

@ -105,7 +105,7 @@ use {
task::{Context, Poll}, task::{Context, Poll},
}, },
downcast_rs::{impl_downcast, DowncastSync}, downcast_rs::{impl_downcast, DowncastSync},
// lock::mutex::Mutex, // lock::mutex::Mutex,
spin::Mutex, spin::Mutex,
}; };

View File

@ -6,7 +6,7 @@ use {
crate::task::Task, crate::task::Task,
alloc::sync::{Arc, Weak}, alloc::sync::{Arc, Weak},
alloc::vec::Vec, alloc::vec::Vec,
// lock::mutex::Mutex, // lock::mutex::Mutex,
spin::Mutex, spin::Mutex,
}; };

View File

@ -1,10 +1,10 @@
use { use {
super::*, super::*,
crate::object::*, crate::object::*,
alloc::sync::Arc, alloc::sync::Arc,
// lock::mutex::Mutex,
spin::Mutex,
numeric_enum_macro::numeric_enum, numeric_enum_macro::numeric_enum,
// lock::mutex::Mutex,
spin::Mutex,
}; };
/// A readable, writable, seekable interface to some underlying storage /// A readable, writable, seekable interface to some underlying storage

View File

@ -9,7 +9,7 @@ use {
bitflags::bitflags, bitflags::bitflags,
core::ops::Deref, core::ops::Deref,
kernel_hal::CachePolicy, kernel_hal::CachePolicy,
// lock::mutex::Mutex, // lock::mutex::Mutex,
spin::Mutex, spin::Mutex,
}; };

View File

@ -1,6 +1,6 @@
use { use {
super::*, super::*,
alloc::sync::Arc, alloc::sync::Arc,
lock::mutex::Mutex, lock::mutex::Mutex,
// spin::Mutex, // spin::Mutex,
}; };

View File

@ -1,7 +1,7 @@
use { use {
super::*, super::*,
alloc::{string::String, vec::Vec}, alloc::{string::String, vec::Vec},
// lock::mutex::Mutex, // lock::mutex::Mutex,
spin::Mutex, spin::Mutex,
zircon_object::{ zircon_object::{
ipc::{Channel, MessagePacket}, ipc::{Channel, MessagePacket},