Page 1 of 1

Invalid GCC Inline?

Posted: Sat Jun 07, 2008 7:40 pm
by Alboin
In the wiki, there is code such as:

Code: Select all

asm ("lidt (%0)": :"p" (&IDTR));
However, has anyone noticed that with -O2 optimizations (gcc-4.1.2), it yields:

Code: Select all

 error: invalid 'asm': invalid expression as operand
Should we make note of this on the wiki? Fix?

Posted: Sat Jun 07, 2008 8:19 pm
by Brynet-Inc
My solution?

-asm ("lidt (%0)": :"p" (&IDTR));
+asm ("lidt (%0)": :"r" (&IDTR));

Just an idea, seems to work with optimizations.. 8)

Re: Invalid GCC Inline?

Posted: Sat Jun 21, 2008 12:01 am
by thepowersgang
I normally use __asm__ __volatile__ (...) for inline asm. It may be that -O2 removes the use of asm(...)

Re: Invalid GCC Inline?

Posted: Sat Jun 21, 2008 9:00 am
by lukem95
it depends on your compiler i think, DJGPP uses __asm__ __volatile__ ...

Re: Invalid GCC Inline?

Posted: Tue Jun 24, 2008 5:17 pm
by suthers
lukem95 wrote:it depends on your compiler i think, DJGPP uses __asm__ __volatile__ ...
So does gcc...
Jules

Re: Invalid GCC Inline?

Posted: Tue Jun 24, 2008 10:21 pm
by Brynet-Inc
DJGPP == GCC for DOS.

Re: Invalid GCC Inline?

Posted: Wed Jun 25, 2008 5:29 am
by suthers
Brynet-Inc wrote:DJGPP == GCC for DOS.
Sorry didn't know that (never used DJGPP...) :oops:
Jules