|
|
@ -517,12 +517,23 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) |
|
|
|
cpu->sim_ticks_left = 1; |
|
|
|
cpu->sim_ticks_left = 1; |
|
|
|
cpu->pc -= 4; |
|
|
|
cpu->pc -= 4; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
switch(instruction->func7) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case FUNC7_SFENCEVMA: |
|
|
|
|
|
|
|
fprintf(stderr, "SFENCE.VMA: Guest kernel must think we have an MMU. We have none.\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case FUNC7_WFI: |
|
|
|
|
|
|
|
fprintf(stderr, "WFI: Guest kernel must think we have interrupts. We have none.\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
fprintf(stderr, "FATAL: Unknown IMM for ECALL/EBREAK instruction while executing (IMM=0x%x)\n", instruction->immediate); |
|
|
|
fprintf(stderr, "FATAL: Unknown IMM for ECALL/EBREAK instruction while executing (IMM=0x%x)\n", instruction->immediate); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
exit(EXIT_FAILURE); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
case FUNC3_CSRRW: |
|
|
|
case FUNC3_CSRRW: |
|
|
|
fprintf(stderr, "CSRRW\n"); |
|
|
|
fprintf(stderr, "CSRRW\n"); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1052,11 +1063,39 @@ static void cpu_print_instruction(instruction_t* instruction) |
|
|
|
case IMM_EBREAK: |
|
|
|
case IMM_EBREAK: |
|
|
|
printf("ebreak\n"); |
|
|
|
printf("ebreak\n"); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
switch(instruction->func7) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case FUNC7_WFI: |
|
|
|
|
|
|
|
printf("wfi\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case FUNC7_SFENCEVMA: |
|
|
|
|
|
|
|
printf("sfence.vma\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case FUNC7_SINVALVMA: |
|
|
|
|
|
|
|
printf("sinval.vma\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case FUNC7_SFENCEWINVAL_SFENCEINVALIR: |
|
|
|
|
|
|
|
switch(instruction->immediate & 0x1F) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case IMM5_SFENCEWINVAL: |
|
|
|
|
|
|
|
printf("sfence.w.inval\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case IMM5_SFENCEINVALIR: |
|
|
|
|
|
|
|
printf("sfence.inval.ir\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
fprintf(stderr, "Warning: Unknown IMM for SFENCEWINVAL/SFENCEINVALIR instruction (IMM=0x%x)\n", instruction->immediate); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
fprintf(stderr, "Warning: Unknown IMM for ECALL/EBREAK instruction (IMM=0x%x)\n", instruction->immediate); |
|
|
|
fprintf(stderr, "Warning: Unknown IMM for ECALL/EBREAK instruction (IMM=0x%x)\n", instruction->immediate); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
case FUNC3_CSRRW: |
|
|
|
case FUNC3_CSRRW: |
|
|
|
printf("csrrw csr[0x%x], x%u, x%u\n", instruction->immediate, instruction->rd, instruction->rs1); |
|
|
|
printf("csrrw csr[0x%x], x%u, x%u\n", instruction->immediate, instruction->rd, instruction->rs1); |
|
|
|
break; |
|
|
|
break; |
|
|
|