mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-29 13:04:27 +01:00
inline assembly: improve everywhere
This commit is contained in:
@@ -5,11 +5,11 @@ int main(void) {
|
||||
uint32_t in = 1;
|
||||
uint32_t out = 0;
|
||||
__asm__ (
|
||||
"movl %1, %%eax;"
|
||||
"mov %[in], %%eax;"
|
||||
"inc %%eax;"
|
||||
"movl %%eax, %0"
|
||||
: "=m" (out)
|
||||
: "m" (in)
|
||||
"mov %%eax, %[out]"
|
||||
: [out] "=g" (out)
|
||||
: [in] "g" (in)
|
||||
: "%eax"
|
||||
);
|
||||
assert(out == in + 1);
|
||||
|
||||
Reference in New Issue
Block a user