delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/01/03:56:14

Sender: bill AT taniwha DOT tssc DOT co DOT nz
Message-ID: <37539279.5C34B683@taniwha.tssc.co.nz>
Date: Tue, 01 Jun 1999 19:57:45 +1200
From: Bill Currie <bill AT taniwha DOT tssc DOT co DOT nz>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.2.6 i486)
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
CC: "Mark E." <snowball3 AT bigfoot DOT com>, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Subject: Re: gcc 3.0
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990531114017 DOT 19086C-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019