aboutsummaryrefslogtreecommitdiff
path: root/src/zam.tex
blob: 16818f2654df6a692c9f8538fd4196431f9bd002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
\chapter{``Zam'' Standard Extension for Atomic Misaligned Memory Accesses, v0.2}
\label{sec:zam}

{\bf Warning! This draft specification may change before being
accepted as standard by RISC-V International.}

This chapter defines the ``Zam'' extension, which standardizes atomicity
guarantees for certain misaligned memory accesses.

\begin{commentary}
The Zam extension does not alter the specification of aligned memory accesses.
\end{commentary}

The Zam extension defines the concept of ``misaligned atomicity granule''
(MAG), an aligned power-of-two number of bytes within which a misaligned
memory access is guaranteed to execute atomically.
The MAG is specified by a memory region's PMAs, and it might be as small as
one byte, indicating that no misaligned memory accesses are guaranteed to
execute atomically.
Furthermore, reservation sets that include any byte within a MAG must
subsume the MAG.

If all bytes accessed by a misaligned explicit memory access lie within the
same MAG, then that memory access executes atomically.
Furthermore, that memory access will not raise any exceptions for reasons
of misalignment (even for AMO, LR, and SC instructions).

If a misaligned explicit memory access comprises bytes within multiple MAGs,
then that memory access proceeds as though the Zam extension were not
implemented.

\begin{commentary}
In other words, AMO, LR, SC instructions that explicitly access bytes within
multiple MAGs must raise an exception, whereas regular loads and
stores may either raise an exception or proceed non-atomically.
\end{commentary}

The Zam extension affects only the memory-access instructions defined in the
base ISAs and the A, F, D, Q, C, Zcb, Zfh, and hypervisor extensions, and only
those memory accesses no wider than XLEN bits.