mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-30 13:24:27 +01:00
asm: start x86 intrinsics examples
Split userland/arch/<arch>/c/ into inline_asm and intrinsics, and move programs that don't match either up.
This commit is contained in:
18
userland/arch/arm/inline_asm/inc.c
Normal file
18
userland/arch/arm/inline_asm/inc.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* Increment a variable in inline assembly.
|
||||
*
|
||||
* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
int main(void) {
|
||||
uint32_t my_local_var = 1;
|
||||
__asm__ (
|
||||
"add %[my_local_var], %[my_local_var], #1;"
|
||||
: [my_local_var] "+r" (my_local_var)
|
||||
:
|
||||
:
|
||||
);
|
||||
assert(my_local_var == 2);
|
||||
}
|
||||
Reference in New Issue
Block a user