kernels/linux-2.4.0/fs/binfmt_aout.c
/*
 * create_aout_tables() parses the env- and arg-strings in new user
 * memory and creates the pointer tables from them, and puts their
 * addresses on the "stack", returning the new stack pointer value.
 */
create_aout_tables() parses the env- and arg-strings in new user
memory and creates the pointer tables from them, and puts their
addresses on the "stack", returning the new stack pointer value.
create_aout_tables () parses the env - and arg - strings in new user memory and creates the pointer tables from them and puts their addresses on the " stack " returning the new stack pointer value .
static unsigned long * create_aout_tables(char * p, struct linux_binprm * bprm)
{
	char **argv, **envp;
	unsigned long * sp;
	int argc = bprm->argc;
	int envc = bprm->envc;
	sp = (unsigned long *) ((-(unsigned long)sizeof(char *)) & (unsigned long) p);
#ifdef __sparc__
	sp = (unsigned long *) (((unsigned long) sp) & ~7);
	if ((envc+argc+3)&1) --sp;
#endif
#ifdef __alpha__
	put_user(0, --sp);
	put_user(0, --sp);
	if (bprm->loader) {
		put_user(0, --sp);
		put_user(0x3eb, --sp);
		put_user(bprm->loader, --sp);
		put_user(0x3ea, --sp);
	}
	put_user(bprm->exec, --sp);
	put_user(0x3e9, --sp);
#endif
	sp -= envc+1;
	envp = (char **) sp;
	sp -= argc+1;
	argv = (char **) sp;
#if defined(__i386__) || defined(__mc68000__) || defined(__arm__)
	put_user((unsigned long) envp,--sp);
	put_user((unsigned long) argv,--sp);
#endif
	put_user(argc,--sp);
	current->mm->arg_start = (unsigned long) p;
	while (argc-->0) {
		char c;
		put_user(p,argv++);
		do {
			get_user(c,p++);
		} while (c);
	}
	put_user(NULL,argv);
	current->mm->arg_end = current->mm->env_start = (unsigned long) p;
	while (envc-->0) {
		char c;
		put_user(p,envp++);
		do {
			get_user(c,p++);
		} while (c);
	}
	put_user(NULL,envp);
	current->mm->env_end = (unsigned long) p;
	return sp;
}
static unsigned long * create_aout_tables ( char * p , struct linux_binprm * bprm ) { char * * argv , * * envp ; unsigned long * sp ; int argc = bprm -> argc ; int envc = bprm -> envc ; sp = ( unsigned long * ) ( ( - ( unsigned long ) sizeof ( char * ) ) & ( unsigned long ) p ) ; #ifdef __sparc__ sp = ( unsigned long * ) ( ( ( unsigned long ) sp ) & ~ 7 ) ; if ( ( envc + argc + 3 ) & 1 ) -- sp ; #endif #ifdef __alpha__ put_user ( 0 , -- sp ) ; put_user ( 0 , -- sp ) ; if ( bprm -> loader ) { put_user ( 0 , -- sp ) ; put_user ( 0x3eb , -- sp ) ; put_user ( bprm -> loader , -- sp ) ; put_user ( 0x3ea , -- sp ) ; } put_user ( bprm -> exec , -- sp ) ; put_user ( 0x3e9 , -- sp ) ; #endif sp -= envc + 1 ; envp = ( char * * ) sp ; sp -= argc + 1 ; argv = ( char * * ) sp ; #if defined ( __i386__ ) || defined ( __mc68000__ ) || defined ( __arm__ ) put_user ( ( unsigned long ) envp , -- sp ) ; put_user ( ( unsigned long ) argv , -- sp ) ; #endif put_user ( argc , -- sp ) ; current -> mm -> arg_start = ( unsigned long ) p ; while ( argc -- > 0 ) { char c ; put_user ( p , argv ++ ) ; do { get_user ( c , p ++ ) ; } while ( c ) ; } put_user ( NULL , argv ) ; current -> mm -> arg_end = current -> mm -> env_start = ( unsigned long ) p ; while ( envc -- > 0 ) { char c ; put_user ( p , envp ++ ) ; do { get_user ( c , p ++ ) ; } while ( c ) ; } put_user ( NULL , envp ) ; current -> mm -> env_end = ( unsigned long ) p ; return sp ; }
create_aout_tables() parses the env- and arg-strings in new user
 memory and creates the pointer tables from them, and puts their
 addresses on the "stack", returning the new stack pointer value.
create_aout_tables () parses the env - and arg - strings in new user memory and creates the pointer tables from them and puts their addresses on the " stack " returning the new stack pointer value .
/* This imposes the proper stack alignment for a new process. */ /* whee.. test-programs are so much fun. */