Mail Archives: djgpp-workers/1999/06/01/03:56:14
Eli Zaretskii wrote:
>
> On Mon, 31 May 1999, Bill Currie wrote:
>
> > I'm currently working on __attribute__((naked)) for *ALL* egcs ports.
> > This will produce functions that have *NO* entry or exit code (main code
> > only), not even a `ret', I believe.
>
> That's not exactly what I had in mind, as you probably understand.
Actually, I didn't, but that's because I came into the conversation
late.
> This
> attribute((naked)) seems to be for people who know what they are doing
> and want to avoid the overhead of the C function call.
For people that know what they're doing, most definitly. For avoiding C
function call overheads, not bloody likely. Call one of these suckers
without due care, and you'll be dealing with dragons (cf C 10
Commandments on null pointers:). A naked function won't evan have a
`ret' statement at the end of it, just full frontal, naked code. ie
what you write is what you get.
> I meant quite the
> opposite: to relieve a naive user from the need to know assembly in simple
> interrupt-driven code.
Ah, no, attribute((naked)) is definitely not for the naeive user. Hrmm,
I can think of several requirements for an attribute((interrupt)) for
djgpp: pushad/popad;nop (my 386 has that bug, but it's busy as my
firewall, now:), pop it into the locked text section (no way I can
think of automating locking of data in this case), and iret instead of
ret. However, I think I remeber someone on the egcs list discussing
interrupt attributes of the 386.
Actually, attribute((nakedt)) *could* (potentially) do what you want,
just use appropriate macros at the start and end of the function. Not
fool-proof, but it's arguably that fools (ie those that refuse to rtfm)
shouldn't be writing interrupt code in the first place.
That said, I still like the idea of an attribute((interrupt)) myself, I
just thought you would be interrested. BTW, it's now to the stage of
finding the emission of the `ret' statement so I can kill it, then it's
test, test, test.
Bill
--
Leave others their otherness.
- Raw text -