mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 04:24:26 +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:
20
userland/arch/x86_64/binutils_hack.c
Normal file
20
userland/arch/x86_64/binutils_hack.c
Normal file
@@ -0,0 +1,20 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#your-first-binutils-hack */
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
int main(void) {
|
||||
#if 0
|
||||
uint64_t in = 0xFFFFFFFF;
|
||||
uint64_t out = 0;
|
||||
__asm__ (
|
||||
"mov %[in], %%rax;"
|
||||
"myinc %%rax;"
|
||||
"movq %%rax, %[out]"
|
||||
: [out] "=g" (out)
|
||||
: [in] "g" (in)
|
||||
: "rax"
|
||||
);
|
||||
assert(out == in + 1);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user