Skip to content

Commit 71c3746

Browse files
committed
Unify naming scheme
1 parent c27d0de commit 71c3746

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

plic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void plic_read(vm_t *vm,
8989
vm_set_exception(vm, RV_EXC_LOAD_MISALIGN, vm->exc_val);
9090
return;
9191
default:
92-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
92+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
9393
return;
9494
}
9595
}
@@ -110,7 +110,7 @@ void plic_write(vm_t *vm,
110110
vm_set_exception(vm, RV_EXC_STORE_MISALIGN, vm->exc_val);
111111
return;
112112
default:
113-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
113+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
114114
return;
115115
}
116116
}

ram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void ram_read(vm_t *vm,
3838
RAM_FUNC(1, *value = (uint32_t) (int32_t) (int8_t) ((*cell) >> offset));
3939
break;
4040
default:
41-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
41+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
4242
return;
4343
}
4444
}
@@ -63,7 +63,7 @@ void ram_write(vm_t *vm,
6363
<< offset);
6464
break;
6565
default:
66-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
66+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
6767
return;
6868
}
6969
}

riscv.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ static void op_privileged(vm_t *vm, uint32_t insn)
391391
return;
392392
}
393393
if (insn & ((MASK(5) << 7) | (MASK(5) << 15))) {
394-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
394+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
395395
return;
396396
}
397397
switch (decode_i_unsigned(insn)) {
@@ -408,7 +408,7 @@ static void op_privileged(vm_t *vm, uint32_t insn)
408408
/* TODO: Implement this */
409409
break;
410410
default:
411-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
411+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
412412
break;
413413
}
414414
}
@@ -432,7 +432,7 @@ static void csr_read(vm_t *vm, uint16_t addr, uint32_t *value)
432432
if ((addr >> 8) == 0xC) {
433433
uint16_t idx = addr & MASK(7);
434434
if (idx >= 0x20 || !(vm->s_mode || ((vm->scounteren >> idx) & 1)))
435-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
435+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
436436
else {
437437
/* Use the instruction counter for all of the counters.
438438
* Ideally, reads should return the value before the increment,
@@ -445,7 +445,7 @@ static void csr_read(vm_t *vm, uint16_t addr, uint32_t *value)
445445
}
446446

447447
if (!vm->s_mode) {
448-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
448+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
449449
return;
450450
}
451451

@@ -488,14 +488,14 @@ static void csr_read(vm_t *vm, uint16_t addr, uint32_t *value)
488488
*value = vm->stval;
489489
break;
490490
default:
491-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
491+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
492492
}
493493
}
494494

495495
static void csr_write(vm_t *vm, uint16_t addr, uint32_t value)
496496
{
497497
if (!vm->s_mode) {
498-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
498+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
499499
return;
500500
}
501501

@@ -540,7 +540,7 @@ static void csr_write(vm_t *vm, uint16_t addr, uint32_t value)
540540
vm->stval = value;
541541
break;
542542
default:
543-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
543+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
544544
}
545545
}
546546

@@ -600,7 +600,7 @@ static void op_system(vm_t *vm, uint32_t insn)
600600
break;
601601

602602
default:
603-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
603+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
604604
return;
605605
}
606606
}
@@ -689,7 +689,7 @@ static bool op_jmp(vm_t *vm, uint32_t insn, uint32_t a, uint32_t b)
689689
case 0b101: /* BFUNC_BGE */
690690
return ((int32_t) a) >= ((int32_t) b);
691691
}
692-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
692+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
693693
return false;
694694
}
695695

@@ -724,15 +724,15 @@ static void op_jump_link(vm_t *vm, uint32_t insn, uint32_t addr)
724724
static void op_amo(vm_t *vm, uint32_t insn)
725725
{
726726
if (unlikely(decode_func3(insn) != 0b010 /* amo.w */))
727-
return vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
727+
return vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
728728
uint32_t addr = read_rs1(vm, insn);
729729
uint32_t value, value2;
730730
switch (decode_func5(insn)) {
731731
case 0b00010: /* AMO_LR */
732732
if (addr & 0b11)
733733
return vm_set_exception(vm, RV_EXC_LOAD_MISALIGN, addr);
734734
if (decode_rs2(insn))
735-
return vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
735+
return vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
736736
mmu_load(vm, addr, RV_MEM_LW, &value, true);
737737
if (vm->error)
738738
return;
@@ -775,7 +775,7 @@ static void op_amo(vm_t *vm, uint32_t insn)
775775
AMO_OP(value > value2 ? value : value2);
776776
break;
777777
default:
778-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
778+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
779779
return;
780780
}
781781
}
@@ -860,7 +860,7 @@ void vm_step(vm_t *vm)
860860
/* TODO: implement for multi-threading */
861861
break;
862862
default:
863-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
863+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
864864
break;
865865
}
866866
break;
@@ -871,7 +871,7 @@ void vm_step(vm_t *vm)
871871
op_system(vm, insn);
872872
break;
873873
default:
874-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
874+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
875875
break;
876876
}
877877
}

riscv_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ enum {
6262
enum {
6363
RV_EXC_PC_MISALIGN = 0, /**< Instruction address misaligned */
6464
RV_EXC_FETCH_FAULT = 1, /**< Instruction access fault */
65-
RV_EXC_ILLEGAL_INSTR = 2, /**< Illegal instruction */
65+
RV_EXC_ILLEGAL_INSN = 2, /**< Illegal instruction */
6666
RV_EXC_BREAKPOINT = 3, /**< Breakpoint */
6767
RV_EXC_LOAD_MISALIGN = 4, /**< Load address misaligned */
6868
RV_EXC_LOAD_FAULT = 5, /**< Load access fault */

uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void u8250_read(vm_t *vm,
182182
vm_set_exception(vm, RV_EXC_LOAD_MISALIGN, vm->exc_val);
183183
return;
184184
default:
185-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
185+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
186186
return;
187187
}
188188
}
@@ -202,7 +202,7 @@ void u8250_write(vm_t *vm,
202202
vm_set_exception(vm, RV_EXC_STORE_MISALIGN, vm->exc_val);
203203
return;
204204
default:
205-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
205+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
206206
return;
207207
}
208208
}

virtio-blk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ void virtio_blk_read(vm_t *vm,
403403
vm_set_exception(vm, RV_EXC_LOAD_MISALIGN, vm->exc_val);
404404
return;
405405
default:
406-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
406+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
407407
return;
408408
}
409409
}
@@ -424,7 +424,7 @@ void virtio_blk_write(vm_t *vm,
424424
vm_set_exception(vm, RV_EXC_STORE_MISALIGN, vm->exc_val);
425425
return;
426426
default:
427-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
427+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
428428
return;
429429
}
430430
}

virtio-net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void virtio_net_read(vm_t *vm,
407407
vm_set_exception(vm, RV_EXC_LOAD_MISALIGN, vm->exc_val);
408408
return;
409409
default:
410-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
410+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
411411
return;
412412
}
413413
}
@@ -428,7 +428,7 @@ void virtio_net_write(vm_t *vm,
428428
vm_set_exception(vm, RV_EXC_STORE_MISALIGN, vm->exc_val);
429429
return;
430430
default:
431-
vm_set_exception(vm, RV_EXC_ILLEGAL_INSTR, 0);
431+
vm_set_exception(vm, RV_EXC_ILLEGAL_INSN, 0);
432432
return;
433433
}
434434
}

0 commit comments

Comments
 (0)