I wrote a kernel module for a character device however, when I try to compile it I get an assembler error, could this be a problem of the code or is it internal?
Any help would be highly appreciated.
beg_g@pop:~ > make
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c char.c -I/lib/modules/`uname
/tmp/ccaELEEv.s: Assembler messages:
/tmp/ccaELEEv.s:219: Error: `%al' not allowed with `movl'
make: *** [char.o] Error 1
I think you want to use movw.
movl expects a 32 bit register (%eax for example)
movw expects a 16 bit register (%ax)
movb expects a 8 bit register (%al, %ah)
easy, isn't it? ;)
(it is if you remember that b -> byte, w -> word, l -> longword)
Yea, I use nasm if I do any assembly so I don't have that problem :).
But gcc doesn't accept nasm-like-syntax in inline assembly...