Thread: Assembler error

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    22

    Assembler error

    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?

    Code:
    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
    -------------------------
    Gerald.

  2. #2
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    I think you want to use movw.

  3. #3
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132
    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

  4. #4
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Yea, I use nasm if I do any assembly so I don't have that problem .

  5. #5
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132

    Unhappy

    But gcc doesn't accept nasm-like-syntax in inline assembly...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM