Skip to content

Commit 626db1e

Browse files
committed
fix use qemu-5.2.0 interrupt issue
1 parent 9639e30 commit 626db1e

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Diff for: os/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
10+
riscv = { git = "https://github.com/rcore-os/riscv", rev = "21e32ee" }
1111
spin = "0.5.2"
1212
buddy_system_allocator = "0.3"
1313
xmas-elf = "0.6"

Diff for: os/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ qemu: build
3434
-machine virt \
3535
-nographic \
3636
-bios default \
37-
-device loader,file=$(bin),addr=0x80200000
37+
-kernel $(bin)
3838

3939
run: build qemu

Diff for: os/src/interrupt.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ pub fn init() {
3232
}
3333

3434
pub unsafe fn init_external_interrupt() {
35+
let hart0_s_mode_interrupt_mth: *mut u32 = access_pa_via_va(0x0c20_1000) as *mut u32;
36+
hart0_s_mode_interrupt_mth.write_volatile(0);
37+
38+
let hart0_s_mode_interrupt_priority_serial_irq: *mut u32 = access_pa_via_va(0x0c00_0000+4*0xa) as *mut u32;
39+
hart0_s_mode_interrupt_priority_serial_irq.write_volatile(1);
40+
3541
let hart0_s_mode_interrupt_enables: *mut u32 = access_pa_via_va(0x0c00_2080) as *mut u32;
36-
const SERIAL: u32 = 0xa;
37-
hart0_s_mode_interrupt_enables.write_volatile(1 << SERIAL);
42+
hart0_s_mode_interrupt_enables.write_volatile(1 << 0xa);
3843
}
3944

4045
pub unsafe fn enable_serial_interrupt() {

Diff for: os/src/memory/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ pub fn kernel_remap() {
5555
None,
5656
);
5757
memory_set.push(
58-
access_pa_via_va(0x0c00_2000),
59-
access_pa_via_va(0x0c00_3000),
58+
access_pa_via_va(0x0c00_0000),
59+
access_pa_via_va(0x0c20_2000),
6060
MemoryAttr::default(),
6161
Linear::new(PHYSICAL_MEMORY_OFFSET),
6262
None,

0 commit comments

Comments
 (0)