comp.lang.ada
 help / color / mirror / Atom feed
From: Rolf <rolf.ebert_nospam_@gmx.net>
Subject: Re: Strip procedure prologue and epilogue
Date: Wed, 17 Dec 2008 00:11:58 -0800 (PST)
Date: 2008-12-17T00:11:58-08:00	[thread overview]
Message-ID: <08de154b-d0ce-42bd-b2b2-f5815ec7c2b1@w1g2000prk.googlegroups.com> (raw)
In-Reply-To: 0bc2447d-ee51-4fce-8bb5-18a0822b7099@r10g2000prf.googlegroups.com

On Dec 16, 11:52 pm, pini <zep...@gmail.com> wrote:
> A usual procedure like
>
> procedure Foo
> begin
>   -- some stuff here;
> end;
>
> generates a prologue like
>
> pushl %ebx
> -- generated code for some stuff here
> popl %ebx
>
> I have a very specific procedure whose purpose is to be called at
> bootloading time and set up a stack, so there is no need for the
> prologue and epilogue of this procedure to exist.
> Is there an ada-only way (through a pragma for instance) to strip the
> prologue and epilogue of this procedure ?
>
> Any help is welcome.

There is no general Ada solution for that, but a GNAT specific
pragma.  Gcc provides the attribute "naked" for some back-ends.  It is
used like this:

procedure Foo;
pragma Machine_Attribute (Entity         => Foo,
                          Attribute_Name => "naked");

The pragma is intended for start-up code like initialising some RAM
area or for writing your own task switching code.

Be very careful here and inspect the generated assembler code.  Naked
procedures will not only omit the prologue and epilogue but also the
ret statemant. You typically must not use any code that requires
support from the run time system at that stage.

   Rolf




  parent reply	other threads:[~2008-12-17  8:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 22:52 Strip procedure prologue and epilogue pini
2008-12-16 23:06 ` Ludovic Brenta
2008-12-17  0:01 ` Jeffrey R. Carter
2008-12-17  8:11 ` Rolf [this message]
2008-12-17  9:40   ` pini
2008-12-17  9:50     ` Ludovic Brenta
2008-12-19  0:01 ` Samuel Tardieu
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox