@@ -1,4 +1,4 @@
-OUTPUT_ARCH(riscv)
+OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
BASE_ADDRESS = 0x200000;
@@ -43,5 +43,5 @@ SECTIONS
}
. = ALIGN(4K);
- PROVIDE(end = .);
+ PROVIDE(dma_region = .);
@@ -7,11 +7,12 @@ use log::trace;
use virtio_drivers::{BufferDirection, Hal, PhysAddr, PAGE_SIZE};
extern "C" {
- fn end();
+ static dma_region: u8;
lazy_static! {
- static ref DMA_PADDR: AtomicUsize = AtomicUsize::new(end as usize);
+ static ref DMA_PADDR: AtomicUsize =
+ AtomicUsize::new(unsafe { &dma_region as *const u8 as usize });
pub struct HalImpl;
@@ -15,8 +15,7 @@ struct Logger {
/// Initialises UART logger.
pub fn init(max_level: LevelFilter) -> Result<(), SetLoggerError> {
- // Safe because BASE_ADDRESS is the base of the MMIO region for a UART and is mapped as device
- // memory.
+ // Safe because `0x3f8` is COM1 I/O port.
let mut uart = unsafe { SerialPort::new(0x3f8) };
uart.init();
LOGGER.uart.lock().replace(uart);