diff --git a/abstract-machine/klib/include/klib-macros.h b/abstract-machine/klib/include/klib-macros.h index d943b06..1f7c370 100644 --- a/abstract-machine/klib/include/klib-macros.h +++ b/abstract-machine/klib/include/klib-macros.h @@ -17,7 +17,7 @@ #define io_read(reg) \ ({ reg##_T __io_param; \ - ioe_read(reg, (void*)&__io_param); \ + ioe_read(reg, &__io_param); \ __io_param; }) #define io_write(reg, ...) \ diff --git a/nemu/src/device/timer.c b/nemu/src/device/timer.c index 2aff819..98ced99 100644 --- a/nemu/src/device/timer.c +++ b/nemu/src/device/timer.c @@ -23,8 +23,8 @@ static void rtc_io_handler(uint32_t offset, int len, bool is_write) { assert(offset == 0 || offset == 4); if (!is_write && offset == 4) { uint64_t us = get_time(); - rtc_port_base[0] = (uint32_t)us; - rtc_port_base[1] = us >> 32; + ((volatile uint32_t*)rtc_port_base)[0] = (uint32_t)us; + ((volatile uint32_t*)rtc_port_base)[1] = us >> 32; } }