Inline Assembly and qcc

I have this library that handles images. Particularly this one routine
which handles tri-chromatic images, and shading. Basically I am writing
to a 32bit color buffer, and am imputting from a 32bit color buffer.
The input color has the MSB disregarded, and each other byte is a scalar
between 0 and 255 of a 32bit color index. Each byte (normally red/green/
blue) is used to scale a different color… all of this works…
However, I have coded this in assembly. The C code was just hideous
when I first wrote it. I have lost the original C code which performed
the same functions.

All I want is to be able to use all my registers.

If I compile with the -fPIC flag (enabled with qcc by default), then
it complains … well I don’t have the exact error but paraphrased that
I can’t load EBX. I have a line routine which doesn’t load EBX via…
asm( “…” : : “value”(b) ); however, since it does modify EBX, when
it calls the plot() function bad things happen. Since apparnelty with
the -fPIC flag, ebx is constantly a pointer to the current module’s
link table and global data table… that’s fine… I understand that…
However, this routine I’m modifying the colors in, doesn’t call external
functions, nor does it reference global data. If I compile without the
-fPIC flag, then the library causes a segment violation on load (before
main() )… and if I try and build with the -fPIC it doesn’t let me use
my registers even though I KNOW that it does not require that reference
it keeps in EBX.

I’ll probably ponder this a while and write soemthing that makes sense…

Until then - anyone have a clue?

panther@panther.darktech.org wrote:

If I compile with the -fPIC flag (enabled with qcc by default), then
it complains … well I don’t have the exact error but paraphrased that
I can’t load EBX. I have a line routine which doesn’t load EBX via…
asm( “…” : : “value”(b) ); however, since it does modify EBX, when
it calls the plot() function bad things happen. Since apparnelty with
the -fPIC flag, ebx is constantly a pointer to the current module’s
link table and global data table… that’s fine… I understand that…
However, this routine I’m modifying the colors in, doesn’t call external
functions, nor does it reference global data. If I compile without the
-fPIC flag, then the library causes a segment violation on load (before
main() )… and if I try and build with the -fPIC it doesn’t let me use
my registers even though I KNOW that it does not require that reference
it keeps in EBX.

Maybe if you save and restore ebx?


cburgess@qnx.com