Added noreturn, removed logs

master
vhaudiquet 11 months ago
parent 5727356559
commit ce89df1ed4
  1. 8
      src/cpu/rv32cpu.c
  2. 2
      src/cpu/rv32cpu.h

@ -501,7 +501,7 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
case OPCODE_NOP: case OPCODE_NOP:
{ {
// TODO : Implement PAUSE, FENCE, FENCE.TSO // TODO : Implement PAUSE, FENCE, FENCE.TSO
fprintf(stderr, "Warning: Unsupported NOP instruction\n"); // fprintf(stderr, "Warning: Unsupported NOP instruction\n");
break; break;
} }
case OPCODE_SYSTEM: case OPCODE_SYSTEM:
@ -602,14 +602,14 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
// Load-Reserved Word // Load-Reserved Word
cpu->regs.x[instruction->rd] = mem_read32(address); cpu->regs.x[instruction->rd] = mem_read32(address);
// TODO register reservation set that subsumes the bytes in word // TODO register reservation set that subsumes the bytes in word
fprintf(stderr, "LR.W\n"); // fprintf(stderr, "LR.W\n");
break; break;
case FUNC75_SCW: case FUNC75_SCW:
// Store-Conditional Word // Store-Conditional Word
// TODO succeed only if the reservation is still valid and the reservation set contains the bytes written // TODO succeed only if the reservation is still valid and the reservation set contains the bytes written
mem_write32(address, cpu->regs.x[instruction->rs2]); mem_write32(address, cpu->regs.x[instruction->rs2]);
cpu->regs.x[instruction->rd] = 0; // TODO write 1 in rd on failure cpu->regs.x[instruction->rd] = 0; // TODO write 1 in rd on failure
fprintf(stderr, "SC.W\n"); // fprintf(stderr, "SC.W\n");
break; break;
case FUNC75_AMOSWAPW: case FUNC75_AMOSWAPW:
// Atomic Memory Operation SWAP Word // Atomic Memory Operation SWAP Word
@ -681,7 +681,7 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction)
} }
} }
void cpu_loop(rv32_cpu_t* cpu) __attribute__((noreturn)) void cpu_loop(rv32_cpu_t* cpu)
{ {
while(1) while(1)
{ {

@ -201,6 +201,6 @@ typedef struct RV32_CPU
extern rv32_cpu_t* cpu0; extern rv32_cpu_t* cpu0;
extern pthread_mutex_t cpu0_mutex; extern pthread_mutex_t cpu0_mutex;
void cpu_init(); void cpu_init();
void cpu_loop(rv32_cpu_t* cpu); __attribute__((noreturn)) void cpu_loop(rv32_cpu_t* cpu);
#endif #endif

Loading…
Cancel
Save