[Novalug] Linux, asm, hardware, protected mode

Ed James edjames@greenbelt.com
Tue Feb 19 05:35:02 EST 2008


Quoting DonJr <djr1952@hotpop.com>:

> Try googling on: GCC asm ".intel_syntax noprefix" parameter

did that already, lotta info, but not for my specific question.  I
did get a specific answer for the .att_syntax, though, which
is close to what I want, but doesn't work (yet?) for the .intel
format.  Basically, I have extended asm working for .att, but
not for .intel - might just mean I'm doing something wrong.


> Or: <http://article.gmane.org/gmane.comp.video.mjpeg.devel/2530>
>    "Gmane -- Mail To News And Back Again"

He had the same question that I did, but I didn't see an answer to
not using static variables. I sorta goofed in my original post in
that by global, I had meant static, having used global static
variables in one test case for the .intel style.  I agree with
him that there *should* be a way to pass data via a more local
memory representation, especially since the .ATT format can,
although is a somewhat messy manner.  His method of using local
static variables does work, of course.  It just adds overhead
which shouldn't need to be added, and perhaps ends up making the
asm version slower than a straight C version.

> Or "Mixing C and assembler"
> <http://courses.ece.uiuc.edu/ece390/books/labmanual/c-prog-mixing.html>

Pulling parm values from the stack is something interesting.  Not quite
as clean as I want, but certainly works efficiently.  This article  
goesinto detail on parm passing via the stack, and returning a parm  
via a register.
At this point, this appears to be my best shot, and earns a Tip of
The Hat. :)


> Note unless it involves some form of transformation of data that the
> code will be doing over and over with new data sets each time it most
> likely not worth coding in assembler.
>
>   Even for graphics at anything but the primitive object levels it just
> doesn't make any real difference in overall timing.

I agree with ya 100% here, and thus the "mindset infects the compiler".
Since the compiler writers aim to make their compiled code perform as well
as assembly (or darn close to it), their focus (and rightly so) is on
efficient compiled code.  This means there really isn't much need to use
assembly inline at all, so there's no need to do extensive compiler-
writing to enhance the use of assembly.  I understand this position, and
agree with it.

Ed James



More information about the Novalug mailing list