Avoid generating Cmp_rm32_imm32 instruction

This commit is contained in:
Hsy-Intel
2024-08-09 18:35:41 +08:00
committed by Tate, Hongliang Tian
parent 7b4c13f5d7
commit 7527d20d25

View File

@ -63,8 +63,8 @@ fn iter_range(range: Range<usize>) {
while current > range.start { while current > range.start {
current -= 0x100; current -= 0x100;
// SAFETY: It only read the value and judge if the magic value fit 0x74726976 // SAFETY: It only read the value and judge if the magic value fit 0x74726976
let value = unsafe { *(paddr_to_vaddr(current) as *const u32) }; let magic = unsafe { core::ptr::read_volatile(paddr_to_vaddr(current) as *const u32) };
if value == VIRTIO_MMIO_MAGIC { if magic == VIRTIO_MMIO_MAGIC {
// SAFETY: It only read the device id // SAFETY: It only read the device id
let device_id = unsafe { *(paddr_to_vaddr(current + 8) as *const u32) }; let device_id = unsafe { *(paddr_to_vaddr(current + 8) as *const u32) };
device_count += 1; device_count += 1;