Skip to content

Commit 9492158

Browse files
p-wojadrabarek
authored andcommitted
[#59539] riscv: Add CLIC interrupt state
1 parent 80ddcbe commit 9492158

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

arch/riscv/cpu.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,17 @@ struct CPUState {
216216
int32_t pmp_napot_grain;
217217

218218
/* Supported modes:
219-
* 0 (INTERRUPT_MODE_AUTO) - chceck mtvec's LSB to detect mode: 0->direct, 1->vectored
219+
* 0 (INTERRUPT_MODE_AUTO) - check mtvec's LSB to detect mode: 0->direct, 1->vectored, 3->clic
220220
* 1 (INTERRUPT_MODE_DIRECT) - all exceptions set pc to mtvec's BASE
221221
* 2 (INTERRUPT_MODE_VECTORED) - asynchronous interrupts set pc to mtvec's BASE + 4 * cause
222222
*/
223223
int32_t interrupt_mode;
224224

225+
int32_t clic_interrupt_pending;
226+
uint32_t clic_interrupt_vectored;
227+
uint32_t clic_interrupt_level;
228+
uint32_t clic_interrupt_priv;
229+
225230
CPU_COMMON
226231

227232
int8_t are_post_opcode_execution_hooks_enabled;

arch/riscv/helper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ void cpu_reset(CPUState *env)
6060
env->mtvec = DEFAULT_MTVEC;
6161
env->pc = DEFAULT_RSTVEC;
6262
env->exception_index = EXCP_NONE;
63+
env->clic_interrupt_pending = EXCP_NONE;
64+
env->clic_interrupt_vectored = 0;
65+
env->clic_interrupt_level = 0;
66+
env->clic_interrupt_priv = 0;
6367
set_default_nan_mode(1, &env->fp_status);
6468
set_default_mstatus();
6569
env->custom_instructions_count = custom_instructions_count;

0 commit comments

Comments
 (0)