/* initialize the system Initialize the psr and vbr.  */
void SystemInit(void)
/* initialize the system Initialize the psr and vbr.  */
void SystemInit(void)
{
    int i;
    uint32_t mxstatus = __get_MXSTATUS();
    mxstatus |= (1 << 22);
    __set_MXSTATUS(mxstatus);
    g_system_clock = IHS_VALUE;
    PLIC->PLIC_PER = 0x1;
    for (i = 0; i < 32; i++) {
        PLIC->PLIC_IP[i] = 0;
    }
    for (i = 0; i < 1023; i++) {
        PLIC->PLIC_H0_MCLAIM = i;
    }
    for (i = 0; i < 1023; i++) {
        PLIC->PLIC_PRIO[i] = 31;
    }
    PLIC->PLIC_H0_MTH = 0;
    csi_dcache_enable();
    csi_icache_enable();
    PLIC->PLIC_H0_MIE[0] = 0xffffffff;
    _system_init_for_kernel();
}