[RFC PATCH v2 1/2] include: Move trap handle helper functions to sbi_trap.h

Jessica Clarke jrtc27 at jrtc27.com
Wed Sep 13 21:07:25 PDT 2023


On 14 Sep 2023, at 04:55, Inochi Amaoto <inochiama at outlook.com> wrote:
> 
>> On 14 Sep 2023, at 03:40, Inochi Amaoto <inochiama at outlook.com> wrote:
>>> 
>>> The trap handle helper macros can help platform make a compatible trap
>>> handler, this is helpful if a platform need a custom trap handler. So
>>> move these helper macro into sbi_trap.h to allow platforms to use them.
>> 
>> Why? What’s wrong with:
>> 
>> _thead_trap_handler:
>>   sfence.vma
>>   j _trap_handler
>> 
>> No modification of any code outside of T-HEAD platform code required.
>> 
>> Jess
>> 
> 
> The inst j only can access 1 MiB offset from the pc, I am not sure whether
> this will cause some problem in the future. If this does not matter, I agree
> to use direct jmp to get less code.

OpenSBI’s code is small so that probably works anyway, but it
definitely will if you put it in the .entry section like _trap_handler.

Jess




More information about the opensbi mailing list