[lug] C++ inline asm on g++

Kelly Brock krbrock at pacbell.net
Thu Jan 10 21:46:38 MST 2002


Hi,

> Kelly> 	The simple reason is that I want to maintain
> the encapsulation
> Kelly> of the function.  It's 15 lines of assembly and it's the only
> Kelly> thing stopping an entire set of systems from working under
> Kelly> Linux.
>
> That makes sense.
> There may be a way to do it -- I'm not an expert on inline asm in gcc.
> However, if there is a way, it doesn't seem to be documented.

	Ack. =(  I really don't want two completely separate branches of the code
simply because of one function......  Everything else coexists nicely
without problems, but this *ONE* function is a problem..  =(  (It's mucks
with the stack *and* the program/stack pointers to get it's job done.
Prolog/Epilog screws that up big time.)

> One idea would be to extend __attribute__((naked)) to work for other
> targets.  I have no idea whether this would be accepted by the gcc
> maintainers.  Your best bet is to ask on the gcc list:

	Asking this means that I have to make the code 'version' dependant.  The
whole idea of this is to be version/platform independant.  So...  I'm not
sure what to do, the only answer right now seems to be make a .s file with
the assembly in it and change calling characteristics for *just* that one
function.  Considering that the entire set of systems depends on this single
function, it makes a mess of things.  Perhaps a macro can make it at least
*look* clean.  (Note:  I'm a stickler, I want effective, clean and generally
very easy to understand code as the basis to all of this.  This *one*
function is the only problem right now..)

	I'll try to figure out an alternative I guess.  Seems unlikely that this
particular item will have a clean conversion..  =(

	Regards,

	Kelly Brock
	The Sims Online
	Maxis - Electronic Arts




More information about the LUG mailing list