1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

Backed out previous commit (alignment suitable for RELENG_4) as planned

since it has been MFC'ed.  See the log message for the previous commit
for more details.  The alignment bug in gcc-3 has not been fixed, but
it is not very serious and the previous commit just moved it (as intended).

Approved by:	re (murray)
This commit is contained in:
Bruce Evans 2002-12-01 17:36:18 +00:00
parent d5d6dee1ca
commit 4ce32d5dee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107460
2 changed files with 0 additions and 66 deletions

View File

@ -100,40 +100,7 @@ _start(char *ap, ...)
monstartup(&eprol, &etext);
#endif
_init();
#ifndef __GNUC__
exit( main(argc, argv, env) );
#else
/*
* Some versions of gcc-2 expect the stack frame to be aligned as
* follows after it is set up in main():
*
* +--------------+ <--- aligned by PREFERRED_STACK_BOUNDARY
* +%ebp (if any) +
* +--------------+
* |return address|
* +--------------+
* | arguments |
* | : |
* | : |
* +--------------+
*
* We implement the above to fix just the usual case in FreeBSD-4.
* Alignment for main() is too compiler-dependent to handle correctly
* in all cases here (or in the kernel). E.g., a different alignment
* is required for at least gcc-2.95.4 even for the small variation
* of compiling main() with -fomit-frame-pointer.
*/
__asm__("
andl $~0xf, %%esp # align stack to 16-byte boundary
subl $12+12, %%esp # space for args and padding
movl %0, 0(%%esp)
movl %1, 4(%%esp)
movl %2, 8(%%esp)
call main
movl %%eax, 0(%%esp)
call exit
" : : "r" (argc), "r" (argv), "r" (env) : "ax", "cx", "dx", "memory");
#endif
}
#ifdef GCRT

View File

@ -100,40 +100,7 @@ _start(char *ap, ...)
monstartup(&eprol, &etext);
#endif
_init();
#ifndef __GNUC__
exit( main(argc, argv, env) );
#else
/*
* Some versions of gcc-2 expect the stack frame to be aligned as
* follows after it is set up in main():
*
* +--------------+ <--- aligned by PREFERRED_STACK_BOUNDARY
* +%ebp (if any) +
* +--------------+
* |return address|
* +--------------+
* | arguments |
* | : |
* | : |
* +--------------+
*
* We implement the above to fix just the usual case in FreeBSD-4.
* Alignment for main() is too compiler-dependent to handle correctly
* in all cases here (or in the kernel). E.g., a different alignment
* is required for at least gcc-2.95.4 even for the small variation
* of compiling main() with -fomit-frame-pointer.
*/
__asm__("
andl $~0xf, %%esp # align stack to 16-byte boundary
subl $12+12, %%esp # space for args and padding
movl %0, 0(%%esp)
movl %1, 4(%%esp)
movl %2, 8(%%esp)
call main
movl %%eax, 0(%%esp)
call exit
" : : "r" (argc), "r" (argv), "r" (env) : "ax", "cx", "dx", "memory");
#endif
}
#ifdef GCRT