On Fri, Dec 05, 2014 at 01:32:35AM +0000, Jeff Haran wrote:
$ cat atomic_read.c
#include <asm/atomic.h> #include <asm/system.h>
int samp_atomic_read(atomic_t *v) { int val;
val = atomic_read(v); return val; } I couldn't get it to build with the #inclue <asm/system.h>, but it built when I removed it.
I dump the resultant .ko, I get this:
objdump -S -M intel atomic_read.ko
atomic_read.ko: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <samp_atomic_read>: #include <asm/atomic.h> #include <asm/system.h>
int samp_atomic_read(atomic_t *v) { 0: 55 push rbp 1: 48 89 e5 mov rbp,rsp 4: e8 00 00 00 00 call 9 <samp_atomic_read+0x9> * * Atomically reads the value of @v. */ static inline int atomic_read(const atomic_t *v) { return v->counter; 9: 8b 07 mov eax,DWORD PTR [rdi] int val;
val = atomic_read(v); return val; } b: c9 leave c: c3 ret d: 90 nop e: 90 nop f: 90 nop
My ouput differs: john@vega:~/foo$ objdump -S -M intel atomic_read.ko atomic_read.ko: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <samp_atomic_read>: 0: 55 push rbp 1: 8b 07 mov eax,DWORD PTR [rdi] 3: 48 89 e5 mov rbp,rsp 6: 5d pop rbp 7: c3 ret