From owner-freebsd-current Thu Dec 2 3:29:31 1999 Delivered-To: freebsd-current@freebsd.org Received: from post.mail.nl.demon.net (post-10.mail.nl.demon.net [194.159.73.20]) by hub.freebsd.org (Postfix) with ESMTP id E2C8214EAC for ; Thu, 2 Dec 1999 03:29:29 -0800 (PST) (envelope-from marcel@scc.nl) Received: from [212.238.132.94] (helo=scones.sup.scc.nl) by post.mail.nl.demon.net with esmtp (Exim 2.02 #1) id 11tUPi-0004C3-00; Thu, 2 Dec 1999 11:28:42 +0000 Received: from scc.nl (scones.sup.scc.nl [192.168.2.4]) by scones.sup.scc.nl (8.9.3/8.9.3) with ESMTP id MAA38472; Thu, 2 Dec 1999 12:28:39 +0100 (CET) (envelope-from marcel@scc.nl) Message-ID: <384657E7.B3E461D5@scc.nl> Date: Thu, 02 Dec 1999 12:28:39 +0100 From: Marcel Moolenaar Organization: SCC vof X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.5 i386) X-Accept-Language: en MIME-Version: 1.0 To: Ville-Pertti Keinonen Cc: current@freebsd.org, dillon@apollo.backplane.com, bde@zeta.org.au Subject: Re: kernel: -mpreferred-stack-boundary=2 ?? References: <19991202094037.4079.qmail@ns.demophon.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Ville-Pertti Keinonen wrote: > +++ crt1.c 1999/12/02 09:02:05 > @@ -92,7 +92,17 @@ > monstartup(&eprol, &etext); > #endif > _init(); > - exit( main(argc, argv, env) ); > + asm volatile("andl $~15,%%esp;" > + "addl $4,%%esp;" > + "pushl %2;" > + "pushl %1;" > + "pushl %0;" > + "call main;" > + "movl %%eax,(%%esp);" > + "call exit" > + : : "rm" (argc), "rm" (argv), "rm" (env)); AFAICT, it's enough to just align the stack before doing anything else. In this case it means aligning the stack somewhere before (exit(main(...)). gcc maintains proper alignment on an aligned stack. Maybe alignment can even be done in the kernel... -- 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