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.
18 lines
370 B
C
18 lines
370 B
C
/* https://github.com/cirosantilli/linux-kernel-module-cheat#gcc-inline-assembly-early-clobbers */
|
|
|
|
#include <assert.h>
|
|
#include <inttypes.h>
|
|
|
|
int main(void) {
|
|
uint64_t in = 1;
|
|
uint64_t out;
|
|
__asm__ (
|
|
"add %[out], %[in], 1;"
|
|
"add %[out], %[in], 1;"
|
|
: [out] "=&r" (out)
|
|
: [in] "r" (in)
|
|
:
|
|
);
|
|
assert(out == 2);
|
|
}
|