mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
32-bit ones likely copy paste error from coming from arm v7. Also create userland/arch/aarch64/inline_asm/int_32.c: Also create aarch64_ldaxr_stlxr.cpp and start documenting LDAXR and STLXR.
16 lines
281 B
C
16 lines
281 B
C
/* https://cirosantilli.com/linux-kernel-module-cheat#gcc-inline-assembly */
|
|
|
|
#include <assert.h>
|
|
#include <inttypes.h>
|
|
|
|
int main(void) {
|
|
uint32_t io = 1;
|
|
__asm__ (
|
|
"add %w[io], %w[io], 1;"
|
|
: [io] "+r" (io)
|
|
:
|
|
:
|
|
);
|
|
assert(io == 2);
|
|
}
|