Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an exception trap on the trap handler function address fetch cannot return to the instruction interrupted (smclicshv) #399

Open
hirooih opened this issue Jul 15, 2024 · 0 comments
Assignees
Labels
v1.0 resolve for 1.0

Comments

@hirooih
Copy link

hirooih commented Jul 15, 2024

8.2.1. smclicshv Changes to xtvec CSR Mode for CLIC

If the trap handler function address fetch is unsuccessful and a exception trap occurs, the xinhv bit in xcause of the exception handler privilege mode is set indicating that xepc of the exception handler privilege mode contains a trap handler function address instead of the virtual address of an instruction.

I thinks this will lose the virtual address of the instruction interrupted.

The last note on this section writes:

Interrupted context is lost on horizontal traps during table fetch where exceptions are the same privilege level as the interrupt handler.

But vVirtual traps also lose the interrupted context.

zcmt has similar issue.

Unprivileged Architecture, Version 20240411, 27.14.2. Table Jump Fault handling

If an exception occurs on either instruction fetch, xEPC is set to the PC of the table jump instruction, xCAUSE is set as expected for the type of fault and xTVAL (if not set to zero) contains the fetch address which caused the fault.

I think a similar simple approach would work well.

  • Set xepc to the address of next instruction interrupted as usual interrupt.
  • Set xtval to the addreess of the trap handler function address.
  • After xret from load access-fault or load page-fault (misaligned exception should not occurs, because trap vector table is aligned.) handler, the interrupt should occurs again.
  • In this method xinhv bit is not required.

I'm afraid that I'm missing something, but please let me know.

@hirooih hirooih changed the title an exception trap on the the trap handler function address fetch cannot return to the instruction interrupted (smclicshv) an exception trap on the trap handler function address fetch cannot return to the instruction interrupted (smclicshv) Jul 15, 2024
@jb-brelot-nxp jb-brelot-nxp added the v1.0 resolve for 1.0 label Oct 7, 2024
@jb-brelot-nxp jb-brelot-nxp removed their assignment Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.0 resolve for 1.0
Projects
None yet
Development

No branches or pull requests

3 participants