Skip to content

Commit

Permalink
Clarify CJALR operation order
Browse files Browse the repository at this point in the history
Clarify that length violations are checked on the address after it has undergone invalid address conversion.

Also fix a typo in the title.

Fixes #9
  • Loading branch information
Timmmm committed Jan 23, 2024
1 parent 66b77c4 commit 1ae67d2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/insns/cjalr_jalr_32bit.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
See <<JALR>>

[#JALR,reftext="JALR"]
==== CJAL, JALR
==== CJALR, JALR

Synopsis::
Jump and link register
Expand All @@ -24,11 +24,20 @@ Capability Mode Description::
CJALR allows unconditional, indirect jumps to a target capability. The
target capability is obtained by unsealing `cs1` and incrementing its address by the
sign-extended 12-bit immediate, and then setting the least-significant bit of the
result to zero. The target capability may have
result to zero. The target address may then have
xref:section_invalid_addr_conv[xrefstyle=short]
performed and is then installed in <<pcc>>. The <<pcc>>
of the next instruction following the jump (<<pcc>> + 4) is sealed and written
to `cd`.
performed. The check for length violation is done next using the converted
address and the original bounds.

[NOTE]
====
When performing invalid address conversion the tag never needs to be cleared because
the earlier length violation check is a stricter condition than the representability
check, and the capability is always unsealed before invalid address conversion.
====

The capability is then installed in <<pcc>>. The <<pcc>> of the next instruction
following the jump (<<pcc>> + 4) is sealed and written to `cd`.

Legacy Mode Description::
JALR allows unconditional, indirect jumps to a target address. The target
Expand Down Expand Up @@ -72,4 +81,3 @@ JALR Operation::
--
TBD
--

0 comments on commit 1ae67d2

Please sign in to comment.