Skip to content

Commit 2dcb944

Browse files
committed
src/mte_tag: add checktag instruction to Zimt spec
Signed-off-by: Deepak Gupta <[email protected]>
1 parent e128976 commit 2dcb944

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/mte_tag.adoc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ better clarity and will be used in the rest of the specification.
3535
Load and store operating on a page with permissions `--R`, `X-R`, `-WR` and
3636
`XWR` are termed as a `regular load` and `regular store`. Regular load and
3737
regular store memory operations are generated from an instruction (except
38-
`settag`) defined by ISA to perform memory accesses.
38+
`settag` and `checktag`) defined by ISA to perform memory accesses.
3939

4040
==== Checked load and store
4141
Regular load and store which is subject to tag check is termed as checked load
@@ -295,6 +295,33 @@ local to a function. These accesses are deemed to be safe and thus are not
295295
subject to tag checks.
296296
=====
297297

298+
==== Explicit tag check
299+
Zimt defines an explicit tag check instruction taken from `MOP.RR.1` of zimop
300+
extension, `checktag rs1, #chunk_count`. If memory tagging is disabled in the
301+
execution environment then `checktag` instruction reverts to zimop behavior. If
302+
memory tagging is enabled in the execution environment then `checktag`
303+
instruction extracts `pointer_tag` from `rs1` and performs load tag operation
304+
for memory chunks (count = `#chunk_count`) starting at virtual address `rs1`.
305+
If any of the loaded `mc_tag` value(s) mismatches with the `pointer_tag`
306+
specified in `rs1`, then software check exception is raised with tval = 4. If
307+
memory tagging is enabled in the execution environment then `checktag`
308+
instruction always makes the check irrespective of `PTE.MTAG` bit setting for
309+
the code page from where `checktag` instuction is fetched or for data page
310+
virtual address specified in `rs1`.
311+
312+
[wavedrom, ,svg]
313+
....
314+
{reg: [
315+
{bits: 7, name: 'opcode', attr:'SYSTEM'},
316+
{bits: 5, name: 'rd', attr:['00000']},
317+
{bits: 3, name: 'funct3', attr:['100']},
318+
{bits: 5, name: 'rs1', attr:['tagged_pointer']},
319+
{bits: 4, name: 'tag_imm4', attr:['chunk_count']},
320+
{bits: 1, name: '0', attr:['0']},
321+
{bits: 7, name: '1000011', attr:['gentag']},
322+
], config:{lanes: 1, hspace:1024}}
323+
....
324+
298325
[[ASYNC_SW_CHECK]]
299326
=== Asynchronous reporting for tag mismatches
300327

0 commit comments

Comments
 (0)