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

Clarify LPAD exceptions #199

Closed
wants to merge 1 commit into from
Closed

Conversation

henry-hsieh
Copy link
Contributor

@henry-hsieh henry-hsieh commented Dec 12, 2023

The spec said:

When Zicfilp is enabled, LPAD is the only instruction allowed to execute when the ELP state is LP_EXPECTED.

It's expected that non-LPAD instructions will also raise the software-check exceptions. I added the descriptions in both the listings and the operations.

@ved-rivos
Copy link
Collaborator

This change is not required and is not accurate. The property that the next instruction in the instruction stream must be LPAD is a decode time property. Whereas the listing modified by this PR is for the LPAD instruction. So the check else if (inst[6:0] != 23 || inst[11:7] != 0) is always false since this instruction has already been decoded as LPAD.

The rule that the next instruction in the stream must be LPAD has been established here:

When ELP is set to LP_EXPECTED, if the next instruction in the instruction stream is not 4-byte aligned, or is not LPAD, or if the landing pad label encoded in LPAD is not zero and does not match the expected landing pad label in bits 31:12 of the x7 register, then a software-check exception (cause=18) with xtval set to "landing pad fault (code=2)" is raised else the ELP is updated to NO_LP_EXPECTED.

The "is not LPAD" is a decode check. Once it has been decoded as a LPAD, the operations in listing 7 apply.

@henry-hsieh
Copy link
Contributor Author

Thanks! I misunderstood the checks. I'll close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants