GCC's inline assembler, and it's apparent lack of knowledge 
Author Message
 GCC's inline assembler, and it's apparent lack of knowledge

Does anyone know why gcc claims that lidt and int are not i386
instructions for:

  __asm__( "LIDT %0" : : "r" (&new_idt) );

or even for

  __asm__( "INT 33" : : );

I could (begrudgingly) accept that gcc doesn't know about LIDT, but it
must know about INT, surely!  What am I doing wrong?

The error message seems a little odd too -
/tmp/cca08544.s:244: Error: operands given don't match any known 386
instruction

I can't work if maybe its talking about operands or instructions.

Any pointers most appreciated,

Greg.



Sat, 07 Jul 2001 03:00:00 GMT  
 GCC's inline assembler, and it's apparent lack of knowledge

Quote:

> Does anyone know why gcc claims that lidt and int are not i386
> instructions for:

>   __asm__( "LIDT %0" : : "r" (&new_idt) );

lidt <general register> is indeed invalid. Get the 386 reference manual.

It must be a memory reference pointing to a

struct tidtdesc {
  unsigned short limit;
  void *base;

Quote:
}
> or even for

>   __asm__( "INT 33" : : );

int $33 maybe?

Quote:
> I could (begrudgingly) accept that gcc doesn't know about LIDT, but it
> must know about INT, surely!  What am I doing wrong?

> The error message seems a little odd too -
> /tmp/cca08544.s:244: Error: operands given don't match any known 386
> instruction

> I can't work if maybe its talking about operands or instructions.

> Any pointers most appreciated,

> Greg.

--

M.vr.gr. / Best regards,


This e-mail message is 100% electronically degradeable and produced
on a GNU/Linux system.



Sat, 07 Jul 2001 03:00:00 GMT  
 GCC's inline assembler, and it's apparent lack of knowledge
Mind-control rays from black helicopters made Greg Law

Quote:
>  __asm__( "LIDT %0" : : "r" (&new_idt) );

Change this to
   __asm__( "LIDT %0" : : "m" (&new_idt) );

The  "r" constraint indicates that the %0 operand is a register;
"m" indicates that it's a memory location.

Quote:
>  __asm__( "INT 33" : : );

Change this to
   __asm__( "INT $33" : : );

$ means an immediate operand.

--

execpc.com | Engineering fears to tread
pmode tutorial, homebrew OS: http://www.execpc.com/~geezer/os



Sun, 08 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. inline assembler syntax error in 'opcode'

2. gcc inline asm, can't do even simple things :-(

3. Borland Pascal's Inline assembler

4. Graphics with VC++'s inline assembler

5. Problems with GCC inline assembler

6. Trying to activate Gcc inline assembler in C++ operator on a class

7. MMX Inline Assembler with GCC

8. Book for learning 'Assembler'..

9. PC Assembler like asm'm'one from the amiga

10. Assembler vs 'C'

11. Response to Matt Kisler's reply regarding the lack of a labview zoom feature

12. Camlp4's (lack of) hygiene (was Re: Macros)

 

 
Powered by phpBB® Forum Software