fix scause 15 bug
This commit is contained in:
parent
491f328f6e
commit
d9eacc6062
|
@ -90,7 +90,7 @@ impl<T, const N: usize> RingQueue<T, N> {
|
|||
}
|
||||
unsafe { *self.elem[self.tail].as_mut_ptr() = value };
|
||||
self.tail = self.tail.wrapping_add(1);
|
||||
if self.tail > N || self.tail == 0 {
|
||||
if self.tail >= N || self.tail == 0 {
|
||||
self.tail = self.tail.wrapping_sub(N);
|
||||
}
|
||||
None // success
|
||||
|
@ -101,7 +101,7 @@ impl<T, const N: usize> RingQueue<T, N> {
|
|||
}
|
||||
let value = unsafe { ptr::read(self.elem[self.front].as_ptr()) };
|
||||
self.front = self.front.wrapping_add(1); // assured non empty
|
||||
if self.front > N || self.front == 0 {
|
||||
if self.front >= N || self.front == 0 {
|
||||
self.front = self.front.wrapping_sub(N);
|
||||
}
|
||||
Some(value)
|
||||
|
|
|
@ -77,7 +77,7 @@ pub extern "C" fn virtio_virt_to_phys(vaddr: VirtualAddress) -> PhysicalAddress
|
|||
pub async fn async_virtio_blk_test() {
|
||||
let mut read_buf = [0u8; 512];
|
||||
let mut write_buf = [0u8; 512];
|
||||
for i in 0..50 {
|
||||
for i in 0..512 {
|
||||
write_buf.iter_mut().for_each(|byte| *byte = i as u8);
|
||||
BLOCK_DEVICE.write_block(i as usize, &write_buf).await;
|
||||
BLOCK_DEVICE.read_block(i as usize, &mut read_buf).await;
|
||||
|
|
Loading…
Reference in New Issue