riscv: Introduce set_kernel_memory helper