mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
Split userland/arch/<arch>/c/ into inline_asm and intrinsics, and move programs that don't match either up.
19 lines
342 B
C++
19 lines
342 B
C++
// https://stackoverflow.com/questions/3666013/how-to-write-multiline-inline-assembly-code-in-gcc-c/54575948#54575948
|
|
|
|
#include <assert.h>
|
|
#include <inttypes.h>
|
|
|
|
int main() {
|
|
uint64_t io = 0;
|
|
__asm__ (
|
|
R"(
|
|
add %[io], %[io], #1
|
|
add %[io], %[io], #1
|
|
)"
|
|
: [io] "+r" (io)
|
|
:
|
|
:
|
|
);
|
|
assert(io == 2);
|
|
}
|