Cross gcc Mailing List Archive
[Prev][Next][Index][Thread]
Re: 68040 inline asm code problems
>
>
>Hello,
>
>I'm having a problem either in compiling or undestanding the
>gcc compiler. I'm running a 68k-rtems cross for my RTEMS project
>which works well. However, in adding some bus error handlers that
>I got from the HIDEOS MVME162 project, I ran into problems getting
>them to compile. Here is an example:
>
>
>IRQHANDLER* SysGetVbr()
>{
> unsigned long x;
> asm volatile ("movec vbr,%0" : "=g" (x) );
> return (IRQHANDLER*)x;
>}
>
>/**************************** access exception ************************/
> asm (" .text");
> asm ("_irq_access:");
>
> /* Save context */
> asm ("moveml #0xfffe,sp@-"); /* Save regs */
> asm ("movel sp@(62),a2 "); /* this is pc */
> asm ("addql #2,sp@(62)"); /* pc+x to skip illegal instruction */
> asm ("movl #1,_int_occurred");
> asm ("moveml sp@+,#0x7fff");
> asm ("rte");
>
>
>compiled with "m68k-rtems-gcc -c"
>
>produces this:
>/tmp/cca14729.s: Assembler messages:
>/tmp/cca14729.s:10: Error: operands mismatch -- statement `movec vbr,-4(%a6)' ignored
>/tmp/cca14729.s:20: Error: parse error -- statement `moveml #0xfffe,sp@-' ignored
>/tmp/cca14729.s:21: Error: parse error -- statement `movel sp@(62),a2' ignored
>/tmp/cca14729.s:22: Error: parse error -- statement `addql #2,sp@(62)' ignored
>/tmp/cca14729.s:24: Error: parse error -- statement `moveml sp@+,#0x7fff' ignored
>
>
>Am I missing something in the command line, or in the file itself?
I think that for the first error, your output constraint "=g" is too general.
The movec instruction requires a register, but the C compiler was trying to
use a stack location (-4(%a6)). Try using "=r".
For the others, try using %sp instead of sp to reference the stack pointer.
Art
Follow-Ups:
Home |
Subject Index |
Thread Index