소스 검색

简单调整panic逻辑,并且更换依赖项为镜像源

longjin 4 달 전
부모
커밋
f720c89d80
4개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      kernel/Cargo.toml
  2. 2 2
      kernel/Makefile
  3. 2 1
      kernel/src/lib.rs
  4. 4 1
      kernel/src/syscall/mod.rs

+ 1 - 1
kernel/Cargo.toml

@@ -68,7 +68,7 @@ lru = "0.12.3"
 rbpf = { path = "crates/rbpf" }
 printf-compat = { version = "0.1.1", default-features = false }
 
-unwinding = { git = "https://github.com/Godones/unwinding.git", branch = "hook", default-features = false,  optional = true, features = [
+unwinding = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/unwinding", rev = "4eb845da62", default-features = false,  optional = true, features = [
     "unwinder",
     "fde-gnu-eh-frame-hdr",
     "panic",

+ 2 - 2
kernel/Makefile

@@ -27,7 +27,7 @@ clean:
 fmt:
 	RUSTFLAGS="$(RUSTFLAGS)" cargo fmt --all $(FMT_CHECK)
 ifeq ($(ARCH), x86_64)
-#	RUSTFLAGS="$(RUSTFLAGS)" cargo clippy --all-features
+	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 clippy --all-features
 endif
 
 
@@ -38,7 +38,7 @@ check: ECHO
 ifeq ($(ARCH), x86_64)
 	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON)
 else ifeq ($(ARCH), riscv64)
-	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON)
+	RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-11-05 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON)
 endif
 
 test:

+ 2 - 1
kernel/src/lib.rs

@@ -170,7 +170,8 @@ pub fn panic(info: &PanicInfo) -> ! {
         "Current PCB:\n\t{:?}",
         process::ProcessManager::current_pcb()
     );
-    process::ProcessManager::exit(usize::MAX)
+    process::ProcessManager::exit(usize::MAX);
+    loop {}
 }
 
 /// User hook for unwinding

+ 4 - 1
kernel/src/syscall/mod.rs

@@ -1,5 +1,6 @@
 use core::{
     ffi::{c_int, c_void},
+    hint::spin_loop,
     sync::atomic::{AtomicBool, Ordering},
 };
 
@@ -84,7 +85,9 @@ impl Syscall {
         frame: &mut TrapFrame,
     ) -> Result<usize, SystemError> {
         let res = unwinding::panic::catch_unwind(|| Self::handle(syscall_num, args, frame));
-        res.unwrap_or_else(|_| ProcessManager::exit(usize::MAX))
+        res.unwrap_or_else(|_| loop {
+            spin_loop();
+        })
     }
     /// @brief 系统调用分发器,用于分发系统调用。
     ///