Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Dec 1999 13:13:26 +0100
From:      Marcel Moolenaar <marcel@scc.nl>
To:        Ville-Pertti Keinonen <will@iki.fi>
Cc:        dillon@apollo.backplane.com, bde@zeta.org.au, current@FreeBSD.ORG
Subject:   Re: kernel: -mpreferred-stack-boundary=2 ??
Message-ID:  <384510E6.6FB29574@scc.nl>
References:  <19991201114859.29382.qmail@ns.demophon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ville-Pertti Keinonen wrote:

> Perhaps crt1.c should call main like this (I can't immediately figure
> out whether the stack pointer should be correctly aligned before the
> return address is pushed or after the previous stack frame is pushed,
> this is assuming the former, s/subl/addl/ would change it).

The stack must be aligned before the return address is pushed:

The following C fragment
        f(1);
        f(2);

Translates to

        addl $-12,%esp
        pushl $1
        call f
        addl $16,%esp
        addl $-12,%esp
        pushl $2
        call f
        addl $16,%esp

This assumes the stack is already aligned, of course.

-- 
Marcel Moolenaar                        mailto:marcel@scc.nl
SCC Internetworking & Databases           http://www.scc.nl/
The FreeBSD project                mailto:marcel@FreeBSD.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?384510E6.6FB29574>