/*
 * 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1986
 * LICENSED MATERIALS - PROPERTY OF IBM
 * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
 */
/* $Header:startup.c 12.0$ */
/* $ACIS:startup.c 12.0$ */
/* $Source: /ibm/acis/usr/sys/standca/RCS/startup.c,v $ */

#ifndef lint
static char *rcsid = "$Header:startup.c 12.0$";
#endif


extern int edata, end;		       /* ints are aligned so this won't hurt */

#undef main			       /* so we call the REAL main */
int openfirst = 1;		       /* so we will open on first sys call */

/*
 * This routine clears bss (via word stores to avoid ECC problems)
 */

startup()
{
	register x, y;		       /* r11, r10 pass-through */

	register int *i = &edata;
	register int *j = &end;

loop:
	/*
	 * Clear our BSS (well nobody else will do it!)
	 */
	while (i < j)
		*i++ = 0;
	_init();		       /* init everything */

	/*
	 * Go to it!
	 */
	main(0, 0);		       /* provide dummy argc argv */
	goto loop;
}
