Skip to content

Commit

Permalink
Merge #473
Browse files Browse the repository at this point in the history
473: [Closes #311] Use `panic!` instead of `println!` in `devintr`. r=jeehoonkang a=travis1829

Closes #311 

기존처럼 `devintr()`안에서 `println!`을 쓰면 아주 가끔씩 stack overflow가 발생하는 것으로 보입니다.
xv6의 semantics를 그대로 따르려면 `println!`을 써야겠지만,
stack overflow가 자주 발생하는 것 같아 이를 `panic!`으로 변경한 후 관련 주석을 추가했습니다.

Co-authored-by: travis1829 <travis1829@naver.com>
  • Loading branch information
kaist-cp-bors[bot] and travis1829 authored Apr 1, 2021
2 parents 1e49214 + c1cd66d commit 744634d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel-rs/src/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ unsafe fn devintr(kernel: &Kernel) -> i32 {
} else if irq as usize == VIRTIO0_IRQ {
kernel.file_system.log.disk.lock().intr();
} else if irq != 0 {
println!("unexpected interrupt irq={}\n", irq);
// Use `panic!` instead of `println` to prevent stack overflow.
// https://github.com/kaist-cp/rv6/issues/311
panic!("unexpected interrupt irq={}\n", irq);
}

// The PLIC allows each device to raise at most one
Expand Down

0 comments on commit 744634d

Please sign in to comment.