1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00

Remove reference when using ref

This commit is contained in:
Stephen Marz 2020-03-13 15:31:47 -04:00
parent 67f30af9a9
commit 8f55a9a6ec
2 changed files with 2 additions and 8 deletions

View File

@ -354,7 +354,7 @@ pub fn pending(bd: &mut BlockDevice) {
// Here we need to check the used ring and then free the resources // Here we need to check the used ring and then free the resources
// given by the descriptor id. // given by the descriptor id.
unsafe { unsafe {
let ref queue = &*bd.queue; let ref queue = *bd.queue;
while bd.ack_used_idx != queue.used.idx { while bd.ack_used_idx != queue.used.idx {
let ref elem = queue.used.ring[bd.ack_used_idx as usize]; let ref elem = queue.used.ring[bd.ack_used_idx as usize];
bd.ack_used_idx = (bd.ack_used_idx + 1) % VIRTIO_RING_SIZE as u16; bd.ack_used_idx = (bd.ack_used_idx + 1) % VIRTIO_RING_SIZE as u16;

View File

@ -186,15 +186,9 @@ extern "C" fn kinit_hart(hartid: usize) {
// We have to store the kernel's table. The tables will be moved // We have to store the kernel's table. The tables will be moved
// back and forth between the kernel's table and user // back and forth between the kernel's table and user
// applicatons' tables. // applicatons' tables.
cpu::mscratch_write(
(&mut cpu::KERNEL_TRAP_FRAME[hartid]
as *mut cpu::TrapFrame)
as usize,
);
// Copy the same mscratch over to the supervisor version of the // Copy the same mscratch over to the supervisor version of the
// same register. // same register.
cpu::sscratch_write(cpu::mscratch_read()); // cpu::KERNEL_TRAP_FRAME[hartid].hartid = hartid;
cpu::KERNEL_TRAP_FRAME[hartid].hartid = hartid;
// We can't do the following until zalloc() is locked, but we // We can't do the following until zalloc() is locked, but we
// don't have locks, yet :( cpu::KERNEL_TRAP_FRAME[hartid].satp // don't have locks, yet :( cpu::KERNEL_TRAP_FRAME[hartid].satp
// = cpu::KERNEL_TRAP_FRAME[0].satp; // = cpu::KERNEL_TRAP_FRAME[0].satp;