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

$ra is not used properly. #6

Open
MashPlant opened this issue Dec 23, 2019 · 0 comments
Open

$ra is not used properly. #6

MashPlant opened this issue Dec 23, 2019 · 0 comments

Comments

@MashPlant
Copy link
Collaborator

MashPlant commented Dec 23, 2019

MIPS standard says:

Format: JALR rs (rd = 31 implied)
JALR rd, rs
Restrictions:

Register specifiers rs and rd must not be equal, because such an instruction does not have the same effect when reexecuted. The result of executing such an instruction is UNPREDICTABLE.

This restriction permits an exception handler to resume execution by re-executing the branch when an exception occurs in the branch delay slot. ))

However, now $ra can be used like other general purpose registers, which means that it is possible to generate legal instructions like jalr $ra (equivalent to jalr $ra, $ra).

Currently, the SPIM simulator covers up the problem, because it can execute jalr $ra in the way we expect instead of rejecting it.

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

No branches or pull requests

1 participant