|
|
|
@ -518,8 +518,19 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) |
|
|
|
|
cpu->pc -= 4; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
fprintf(stderr, "FATAL: Unknown IMM for ECALL/EBREAK instruction while executing (IMM=0x%x)\n", instruction->immediate); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
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: |
|
|
|
|
fprintf(stderr, "FATAL: Unknown IMM for ECALL/EBREAK instruction while executing (IMM=0x%x)\n", instruction->immediate); |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -1053,7 +1064,35 @@ static void cpu_print_instruction(instruction_t* instruction) |
|
|
|
|
printf("ebreak\n"); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
fprintf(stderr, "Warning: Unknown IMM for ECALL/EBREAK instruction (IMM=0x%x)\n", instruction->immediate); |
|
|
|
|
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: |
|
|
|
|
fprintf(stderr, "Warning: Unknown IMM for ECALL/EBREAK instruction (IMM=0x%x)\n", instruction->immediate); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|