Re: [PATCH v3 07/17] riscv: Maintain epc on misaligned emulation error
From: Damien Le Moal
Date: Thu Aug 06 2026 - 12:41:15 EST
On 2026/08/06 1:38, Nam Cao wrote:
> Charlie Jenkins <thecharlesjenkins@xxxxxxxxx> writes:
>> Currently the epc is set to zero when there is a misaligned emulation
>> error. This will print a misleading error message with the current epc
>> value of zero instead of the epc value that triggered the emulation.
>> Avoid setting epc to zero to maintain the state of epc.
>>
>> Signed-off-by: Charlie Jenkins <thecharlesjenkins@xxxxxxxxx>
>
> I see no reason why epc must be set to zero, so:
> Reviewed-by: Nam Cao <namcao@xxxxxxxxxxxxx>
>
> But to be sure, I add to CC: Damien Le Moal <damien.lemoal@xxxxxxx>
>
> Damien, any reason that epc must be cleared?
It has been a while since I touched this, and frankly, I do not remember at all.
As the original commit 956d705dd279f says: Code heavily inspired from the
OpenSBI project. So I may have copied this without thinking too much. That's
likely Anup's code, so maybe Anup can weight in here.
--
Damien Le Moal
Western Digital Research