Assembler error [Archive] - C Board

PDA

View Full Version : Assembler error


beg_g
04-03-2002, 07:20 AM
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?


beg_g@pop:~ > make
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c char.c -I/lib/modules/`uname
-r`/build/include
/tmp/ccaELEEv.s: Assembler messages:
/tmp/ccaELEEv.s:219: Error: `%al' not allowed with `movl'
make: *** [char.o] Error 1


Any help would be highly appreciated.

Gerald

Nick
04-03-2002, 07:09 PM
I think you want to use movw.

alex
04-04-2002, 04:33 AM
No, movb.

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)

alex

Nick
04-04-2002, 02:30 PM
Yea, I use nasm if I do any assembly so I don't have that problem :).

alex
04-06-2002, 08:29 AM
But gcc doesn't accept nasm-like-syntax in inline assembly...