summary refs log tree commit diff stats
path: root/results/classifier/zero-shot/118/all/1708
blob: fd5b90492a1da90579c498b6b43f8230c0de65d5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
permissions: 0.970
architecture: 0.959
arm: 0.958
performance: 0.956
register: 0.956
device: 0.955
debug: 0.952
files: 0.943
graphic: 0.943
PID: 0.939
user-level: 0.938
assembly: 0.936
risc-v: 0.935
semantic: 0.933
virtual: 0.926
vnc: 0.918
VMM: 0.914
kernel: 0.906
mistranslation: 0.900
ppc: 0.895
peripherals: 0.891
x86: 0.881
i386: 0.879
TCG: 0.879
boot: 0.876
network: 0.876
KVM: 0.870
hypervisor: 0.868
socket: 0.838

RISCV: Illegal instruction delegated to VS mode sets the wrong vscause value
Description of problem:
When delegating an illegal instruction exception caused in VS-mode to VS-mode, the vscause value for an illegal instruction is set incorrectly.

Steps to reproduce:
1. Delegate 2(,6,10) in medeleg and hedeleg.
2. Enter VS-mode
3. Cause an illegal instruction fault, cause 6 can't happen in QEMU since there is misaligned support and 10 can't be delegated to VS mode.
4. The (v)scause CSR is then set to 1, i.e. instruction access fault which isn't correct.

I have located the issue in the code @ cpu_helper.c:1703
```
if ((cause == IRQ_VS_TIMER || cause == IRQ_VS_SOFT ||
    cause == IRQ_VS_EXT)) {
    cause = cause - 1;
}
```

The if statement should include a check for the async otherwise the cause shouldn't be altered. The patch I propose is simply to **and** the current statement with async.
```
if (async & (cause == IRQ_VS_TIMER || cause == IRQ_VS_SOFT ||
    cause == IRQ_VS_EXT)) {
    cause = cause - 1;
}
```
Additional information:
Log where the incorrect cause is set. Note this line: `DEBUG: [src/trap_handling.c: 105] Instruction access fault exception: SEPC = 0x80008850, STVAL = 0x0`
```
TRACE: [src/hart_ctrl.c:35] STARTING CPU 0
TRACE: [src/page_tables.c:343] Setting up page tables between 0x80000000 -> 0x81c00000
TRACE: [src/page_tables.c:359] Setting up page tables between 0x81c01000 -> 0x81c02000
TRACE: [src/page_tables.c:374] Setting up page tables for UART 0x10000000
TRACE: [src/page_tables.c:386] Setting up page tables for CLINT 0x2000000
DEBUG: [src/page_tables.c: 406] Mapping IMISIC 0x24000000
DEBUG: [src/page_tables.c: 406] Mapping IMISIC 0x28000000
DEBUG: [src/page_tables.c: 406] Mapping IMISIC 0x28001000
TRACE: [src/main.c:32] STARTING HYPERVISOR TESTS
DEBUG: [src/util_fn.c:1175] pmpcfg0 = 0x00000000000f000f 
DEBUG: [src/util_fn.c:1176] pmpcfg2 = 0x0000000000000000 
PMP Entry     : 0
Low Address   : 0x0
High Address  : 0x81c00000
Address Range : 0x0 - 0x81c00000
Mode          : TOR
Executable    : Yes
Writable      : Yes
Readable      : Yes
Locked        : No
--------------------------------------
PMP Entry     : 2
Low Address   : 0x82000000
High Address  : 0xfffffffffffffffc
Address Range : 0x82000000 - 0xfffffffffffffffc
Mode          : TOR
Executable    : Yes
Writable      : Yes
Readable      : Yes
Locked        : No
--------------------------------------
DEBUG: [src/trap_trigger.c:  85] Switching mode to VS
riscv_cpu_do_interrupt: hart:0, async:0, cause:0000000000000002, epc:0x00000000800062a4, tval:0x0000000000000000, desc=illegal_instruction
DEBUG: [src/trap_handling.c: 102] Illegal instruction exception: MEPC = 0x800062a4, MTVAL = 0x0
TRACE: [src/util_fn.c:374] Done switching mode
riscv_cpu_do_interrupt: hart:0, async:0, cause:0000000000000002, epc:0x0000000080008850, tval:0x0000000000000000, desc=illegal_instruction
DEBUG: [src/trap_handling.c: 105] Instruction access fault exception: SEPC = 0x80008850, STVAL = 0x0
ERROR: [src/trap_handling.c:158] The following assert failed: mask_cause == cause2check
mask_cause = 0x1