From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c7e469ccb3e8d0e7 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!postnews.google.com!w1g2000prk.googlegroups.com!not-for-mail From: Rolf Newsgroups: comp.lang.ada Subject: Re: Strip procedure prologue and epilogue Date: Wed, 17 Dec 2008 00:11:58 -0800 (PST) Organization: http://groups.google.com Message-ID: <08de154b-d0ce-42bd-b2b2-f5815ec7c2b1@w1g2000prk.googlegroups.com> References: <0bc2447d-ee51-4fce-8bb5-18a0822b7099@r10g2000prf.googlegroups.com> NNTP-Posting-Host: 217.89.139.138 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1229501519 9759 127.0.0.1 (17 Dec 2008 08:11:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 17 Dec 2008 08:11:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w1g2000prk.googlegroups.com; posting-host=217.89.139.138; posting-account=-RRRjAkAAAAGFvmHqTCN-L7gNQ7lRGfd User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 www-proxy-mozilla.vi.vector.int:8080 (squid/2.7.STABLE4), 1.0 vistrem1.vector-informatik.com:8080 (squid/2.6.STABLE18) Xref: g2news1.google.com comp.lang.ada:3017 Date: 2008-12-17T00:11:58-08:00 List-Id: On Dec 16, 11:52 pm, pini 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