mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Split userland/arch/<arch>/c/ into inline_asm and intrinsics, and move programs that don't match either up.
19 lines
334 B
C
19 lines
334 B
C
/* 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) {
|
|
uint64_t io = 1;
|
|
__asm__ (
|
|
"add %[io], %[io], 1;"
|
|
: [io] "+r" (io)
|
|
:
|
|
:
|
|
);
|
|
assert(io == 2);
|
|
}
|