dsb
Data Synchronization Barrier (Thumb)
DSB <option>
Sync barrier (Thumb).
Details
Data Synchronization Barrier ensures that all explicit data memory operations before the DSB complete before any subsequent memory, prefetch, or branch operations are executed. The option field specifies the barrier domain (SY, ISH, OSH, NSH). No condition flags are affected. This instruction is available in all privilege levels and execution states.
Pseudocode Operation
if option == SY then
DataSynchronizationBarrier(FullSystem)
else if option == ISH then
DataSynchronizationBarrier(InnerShareable)
else if option == OSH then
DataSynchronizationBarrier(OuterShareable)
else if option == NSH then
DataSynchronizationBarrier(NonShareable)
else
DataSynchronizationBarrier(FullSystem)
Example
DSB option
Encoding
Binary Layout
111100111011
1
1
1
1
10
0
0
1
1
1
1
0100
option
Operands
-
option
SY/ISH
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0xF57FF040 | DSB{<c>}{<q>} {<option>} | A32 | 111101010111 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0100 | option | ||
| 0xF3BF8F40 | DSB{<c>}{<q>} {<option>} | T32 | 111100111011 | 1 | 1 | 1 | 1 | 10 | 0 | 0 | 1 | 1 | 1 | 1 | 0100 | option |
Description
Data Synchronization Barrier is a memory barrier that ensures the completion of memory accesses, see Data Synchronization Barrier (DSB).
An AArch32 DSB instruction does not require the completion of any AArch64 TLB maintenance instructions, regardless of the nXS qualifier, appearing in program order before the AArch32 DSB.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
boolean nXS;
if HaveFeatXS() then
nXS = (PSTATE.EL IN {EL0, EL1} && !ELUsingAArch32(EL2) &&
IsHCRXEL2Enabled() && HCRX_EL2.FnXS == '1');
else
nXS = FALSE;
MBReqDomain domain;
MBReqTypes types;
case option of
when '0001' domain = MBReqDomain_OuterShareable; types = MBReqTypes_Reads;
when '0010' domain = MBReqDomain_OuterShareable; types = MBReqTypes_Writes;
when '0011' domain = MBReqDomain_OuterShareable; types = MBReqTypes_All;
when '0101' domain = MBReqDomain_Nonshareable; types = MBReqTypes_Reads;
when '0110' domain = MBReqDomain_Nonshareable; types = MBReqTypes_Writes;
when '0111' domain = MBReqDomain_Nonshareable; types = MBReqTypes_All;
when '1001' domain = MBReqDomain_InnerShareable; types = MBReqTypes_Reads;
when '1010' domain = MBReqDomain_InnerShareable; types = MBReqTypes_Writes;
when '1011' domain = MBReqDomain_InnerShareable; types = MBReqTypes_All;
when '1101' domain = MBReqDomain_FullSystem; types = MBReqTypes_Reads;
when '1110' domain = MBReqDomain_FullSystem; types = MBReqTypes_Writes;
otherwise
assert !(option IN {'0x00'});
domain = MBReqDomain_FullSystem; types = MBReqTypes_All;
if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then
if HCR.BSU == '11' then
domain = MBReqDomain_FullSystem;
if HCR.BSU == '10' && domain != MBReqDomain_FullSystem then
domain = MBReqDomain_OuterShareable;
if HCR.BSU == '01' && domain == MBReqDomain_Nonshareable then
domain = MBReqDomain_InnerShareable;
DataSynchronizationBarrier(domain, types, nXS);