This intrinsic inserts an instruction of the form STREX[size] into
the instruction stream generated by the compiler. It enables you
to use an STREX instruction in your C or C++ code to
store data to memory.
Syntax
int __strex(unsigned int val, volatile void *ptr)
where:
val
is the value to be written to memory.
ptr
points to the address of the data to be written
to in memory. To specify the size of the data to be written, cast
the parameter to an appropriate integral type.
Table 18. Access widths supported by the __strex intrinsic
Instruction
Size of data stored
C cast
STREXB
unsigned byte
(char *)
STREXH
unsigned halfword
(short *)
STREX
word
(int *)
Return value
The __strex intrinsic returns:
0
if the STREX instruction succeeds
1
if
the STREX instruction is locked out.
Errors
The compiler does not recognize the __strex intrinsic
when compiling for a target that does not support the STREX instruction.
The compiler generates either a warning or an error in this case.
The __strex intrinsic does not support
access to doubleword data. The compiler generates an error if you
specify an access width that is not supported.
Example
int foo(void)
{
int loc=0xff;
return(!__strex(0x20, (volatile char *)loc));
}
Compiling this code with the command-line option --cpu=6k produces
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.