From ca8b6e6696e279f56faacad39501019c3762a1b7 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Fri, 16 Dec 2022 23:36:05 -0600 Subject: Fix privilege escalation while in user mode --- rtl/core/control/control.sv | 1 + rtl/core/control/exception.sv | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'rtl/core/control') diff --git a/rtl/core/control/control.sv b/rtl/core/control/control.sv index 5f290d2..cbc7191 100644 --- a/rtl/core/control/control.sv +++ b/rtl/core/control/control.sv @@ -70,6 +70,7 @@ module core_control mul_start, mul_signed, coproc, + escalating, psr_saved, psr_write, psr_wr_flags, diff --git a/rtl/core/control/exception.sv b/rtl/core/control/exception.sv index ed7893e..387e9c1 100644 --- a/rtl/core/control/exception.sv +++ b/rtl/core/control/exception.sv @@ -2,10 +2,11 @@ module core_control_exception ( - input logic clk, - rst_n, + input logic clk, + rst_n, - input ctrl_cycle next_cycle, + input ctrl_cycle cycle, + next_cycle, input insn_decode dec, input psr_intmask intmask, input logic issue, @@ -15,10 +16,11 @@ module core_control_exception prefetch_abort, mem_fault, - output logic exception, - exception_offset_pc, - output psr_mode exception_mode, - output word exception_vector + output logic escalating, + exception, + exception_offset_pc, + output psr_mode exception_mode, + output word exception_vector ); logic pending_irq, syscall; @@ -27,6 +29,7 @@ module core_control_exception //TODO: fiq assign exception = undefined || syscall || prefetch_abort || mem_fault || pending_irq; + assign escalating = cycle.escalate; assign exception_vector = {{16{high_vectors}}, 11'b0, vector_offset, 2'b00}; always @(posedge clk or negedge rst_n) -- cgit v1.2.3