Beispiel #1
0
void Startup::init()
{
    register unsigned long *pulSrc, *pulDest;

    // Init system clock
	clkInit();

    // Copy the data segment initializers from flash to SRAM.
    pulSrc = &_flash_data;
    for(pulDest = &_data; pulDest < &_edata; )
    {
        *(pulDest++) = *(pulSrc++);
    }

    // Zero fill the bss segment.
    for(pulDest = &_bss; pulDest < &_ebss; )
    {
        *(pulDest++) = 0;
    }

/*    // Fill the stack with a known value.
    for(pulDest = pulStack; pulDest < pulStack + STACK_SIZE; )
    {
    	*pulDest++ = 0xA5A5;
    }
*/

    // Call global/static constructors (used with arm-none-eabi toolchain)
	init_array();

    //
	__do_global_ctors();
}
Beispiel #2
0
	//------------------------------------------------------------------------------
	void __main (void)
	{
		if( !initialized )
		{
			initialized = 1;
			__do_global_ctors();
		}
	}
Beispiel #3
0
void
__main (void)
{
  /* Support recursive calls to `main': run initializers just once.  */
  static int initialized;
  if (! initialized)
    {
      initialized = 1;
      __do_global_ctors ();
    }
}
Beispiel #4
0
int __init startup_init(void)
{
	__init_atexit( 128 );

#ifdef USE_MAIN
	kernel_thread(main_thread, NULL , CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
#else
	__do_global_ctors();
#endif
	return 0;
}
Beispiel #5
0
__std_startup(void)
{
        void (**vbr)(void);

        /* First added, last called */
        atexit(__do_global_dtors);

        /* Do all constructors */
        __do_global_ctors();

        /* Set hardware exception handling routines */
        vbr = cpu_intc_vector_base_get();

        vbr[0x04] = exception_illegal_instruction;
        vbr[0x06] = exception_illegal_slot;
        vbr[0x09] = exception_cpu_address_error;
        vbr[0x0A] = exception_dma_address_error;
}
Beispiel #6
0
/*#**************************************************************************
*#
*# FUNCTION NAME: startc
*#
*# PARAMETERS   : None
*#
*# RETURNS      : Nothing
*#
*# SIDE EFFECTS : 
*#
*# DESCRIPTION  : Is called from the startup assembler file of the
*#                box, after initialization of registers, stack pointers etc.
*#                Performs a copy of data from PROM into RAM, then starts
*#                the OS.
*#
*#---------------------------------------------------------------------------
*# HISTORY                                                    
*#
*# DATE          NAME             CHANGES                       
*# ----          ----             -------                       
*# Jun 12 1995   Jens Johansson   Added 530 fix. After the analog ethernet
*#                                circuit was replaced with the same circuit 
*#                                as in the 550r, the reset signal was NOT 
*#                                taken from the same pin (P15), but from TXD2
*#                                instead. It is set to low here.
*# Jun 20 1995    Jens Johansson  Hardware is the same now. The above fix
*#                                removed.
*# Nov 30 1995   Sven Ekstrom     Added unconditional printout of product
*#                                name, version, and creation information.
*#
*#**************************************************************************/
void startc(void)
{
	flashled();
	ax_printf("\r\n\r\nServer boot.\r\n");
	ax_printf("heapbase %08x heaptop %08x heapsize %08x\n",
		__heapbase,__heaptop,__heaptop - __heapbase);

	aheap_init(__heapbase, __heaptop - __heapbase);

	/* Now after we've shown that we're alive, we can let in
	interrupts.  */
	__asm__ ("ei");

	__do_global_ctors();

	ax_printf("\n\nStarting OSYS.\n");
	os_start();
	// will never return here!
} 	/* startc */
Beispiel #7
0
BOOL APIENTRY DllMain( HANDLE hModule,
                        DWORD ul_reason_for_call,
                        LPVOID lpReserved )
{
	_NXLogError( "DllMain got called!\n" );

    switch( ul_reason_for_call ) {
    case DLL_PROCESS_ATTACH:
		__do_global_ctors();
		break;
    case DLL_THREAD_ATTACH:
		break;
    case DLL_THREAD_DETACH:
		break;
    case DLL_PROCESS_DETACH:
		break;
    }
    return TRUE;
}
Beispiel #8
0
static int main_thread(void *unused){
	sigset_t tmpsig;
	int res = -1;

	sprintf(current->comm,"main");
	daemonize();

	/* Block all signals except SIGKILL and SIGSTOP */
	spin_lock_irq(&current->sigmask_lock);
	tmpsig = current->blocked;
	siginitsetinv(&current->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP) );
	recalc_sigpending(current);
	spin_unlock_irq(&current->sigmask_lock);

	__do_global_ctors();

	res = main(0,0);

	__do_global_dtors();
	__do_atexit();	
	
	return res;
}
Beispiel #9
0
void init_cpp( void )
{
	__init_atexit( 128 );
	__do_global_ctors();
}