[tools-compilers] inline assembler using Sun Studio compiler

2008-07-05 Thread Roland Mainz
Mladen Nikitovic wrote: > Thanks, you are indeed right, I did not notice that. > > I'm compiling the solaris kernel and it seems like shadow compilation is > enabled, which means that both CC and GCC is used. > > I have tried to disable shadow compilation by setting CW_NO_SHADOW = 1 but > both

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-04 Thread Fedor Sergeev
On Fri, Jul 04, 2008 at 02:56:37AM -0700, Mladen Nikitovic wrote: > after some tests I came to this conclusion: > > regardless of the compiler the statement MAGIC(6000 + a) fails. > > The reason for this is that the generated code by the compiler becomes > > sethi %g1, %g0 > > this violates th

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-04 Thread Mladen Nikitovic
Hi, regarding your tip about writing it in pure assembler - I don't really see that solving the problem because I will eventually end up with a register as an operand anyway. Maybe you actually meant something similar to this... If I put the variable in g1 just before issuing the sethi instruct

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-04 Thread Mladen Nikitovic
after some tests I came to this conclusion: regardless of the compiler the statement MAGIC(6000 + a) fails. The reason for this is that the generated code by the compiler becomes sethi %g1, %g0 this violates the requirement that the parameter need to be an immediate value. So, I came to the

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Fedor Sergeev
On Thu, Jul 03, 2008 at 03:29:45PM +0200, Joerg Schilling wrote: > Fedor Sergeev wrote: > > > > I think my Sun Studio compiler is version 11 so that should work, right? > > > > Nope. You should use Studio 12 for gnu-style inline assembler to work. > > Strange, I needed to use Studio 11 to compil

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Fedor Sergeev
On Thu, Jul 03, 2008 at 05:16:59AM -0700, Mladen Nikitovic wrote: > Hi (again), > > could you please describe how you managed to compile and use the macro? > > I created a small test-file (in C) with the following content: > > #define MAGIC(service) do { \ > asm("sethi %0,%%g0" : : "g" (

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Joerg Schilling
Fedor Sergeev wrote: > > I think my Sun Studio compiler is version 11 so that should work, right? > > Nope. You should use Studio 12 for gnu-style inline assembler to work. Strange, I needed to use Studio 11 to compile gnu-style inline assembler in GNOME libs because Studio 12 gave me error mes

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Fedor Sergeev
On Thu, Jul 03, 2008 at 01:17:00AM -0700, Mladen Nikitovic wrote: > Hi, > > I'm trying to define a macro intended to be used in OpenSolaris kernel code > on a sparc architecture : > > #define MAGIC(service) do { \ > asm("sethi %0,%%g0" : : "g" (service)); \ > } while (0) > > But if i tr

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Mladen Nikitovic
Hi (again), could you please describe how you managed to compile and use the macro? I created a small test-file (in C) with the following content: #define MAGIC(service) do { \ asm("sethi %0,%%g0" : : "g" (service)); \ } while (0) #define ASMMAGIC(n) sethi n, %g0; #define MAGIC_BREAKP

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Mladen Nikitovic
Hi, Thanks, you are indeed right, I did not notice that. I'm compiling the solaris kernel and it seems like shadow compilation is enabled, which means that both CC and GCC is used. I have tried to disable shadow compilation by setting CW_NO_SHADOW = 1 but both compilers are still used. Strang

[tools-compilers] inline assembler using Sun Studio compiler

2008-07-03 Thread Mladen Nikitovic
Hi, I'm trying to define a macro intended to be used in OpenSolaris kernel code on a sparc architecture : #define MAGIC(service) do { \ asm("sethi %0,%%g0" : : "g" (service)); \ } while (0) But if i try to insert the MAGIC call (MAGIC(1000); for instance)in kernel code (inside disp.c)