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:[EMAIL PROTECTED]
SCC Internetworking & Databases           http://www.scc.nl/
The FreeBSD project                mailto:[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to