예제 #1
0
파일: boot2.cpp 프로젝트: Mirmik/GenOS-old
extern "C" void boot2(){
printd("GenOS boot2 function successful load\r\n");
printd("Section info:\r\n");
printd("_text_begin :"); dpr_inthex((int)&_text_begin);dln;
printd("_text_end   :"); dpr_inthex((int)&_text_end);dln;
printd("_data_begin :"); dpr_inthex((int)&_data_begin);dln;
printd("_data_end   :"); dpr_inthex((int)&_data_end);dln;
printd("_bss_begin  :"); dpr_inthex((int)&_bss_begin);dln;
printd("_bss_end    :"); dpr_inthex((int)&_bss_end);dln;


printd("bss clean...   ");
//delay_cpu(10);

  for (unsigned int i = (unsigned int)&_bss_begin; i < (unsigned int)&_bss_end; i++)
  {
    *((char*) i)=0;
  }
printd("OK\r\n");
//delay_cpu(10);

printd("Constructor info:\r\n");
printd("__preinit_array_start:");dpr_inthex((int)&__preinit_array_start);dln
printd("__preinit_array_end  :");dpr_inthex((int)&__preinit_array_end);dln
printd("__init_array_start   :");dpr_inthex((int)&__init_array_start);dln
printd("__init_array_end     :");dpr_inthex((int)&__init_array_end);dln
printd("_ctor_start          :");dpr_inthex((int)&_ctor_start);dln
printd("_ctor_end            :");dpr_inthex((int)&_ctor_end);dln

printd("constr call:\r\n");
// BEGIN C++ support (2/2)
  //Call C++ global constructors
  call_constructors(&__preinit_array_start, &__preinit_array_end);
  call_constructors(&__init_array_start, &__init_array_end);
 call_constructors(&_ctor_start, &_ctor_end);
  // END C++ support (2/2)
printd("constr call OK\r\n");

delay_cpu(10);
//	second_init();


//	drivers_init();
printd("Call boot3 function...");

	boot3();
	
systemError("BOOT2 FUNCTION END. Kernel bewilderment :)");	
}
예제 #2
0
파일: main.c 프로젝트: sndnvaps/lk-1
void lk_main(void)
{
	inc_critical_section();

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	lk_init_level(LK_INIT_LEVEL_ARCH_EARLY - 1);
	arch_early_init();

	// do any super early platform initialization
	lk_init_level(LK_INIT_LEVEL_PLATFORM_EARLY - 1);
	platform_early_init();

	// do any super early target initialization
	lk_init_level(LK_INIT_LEVEL_TARGET_EARLY - 1);
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");
#if WITH_PLATFORM_MSM_SHARED
	bs_set_timestamp(BS_BL_START);
#endif

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	lk_init_level(LK_INIT_LEVEL_HEAP - 1);
	heap_init();

#if WITH_PLATFORM_MSM_SHARED
	__stack_chk_guard_setup();
#endif

	// initialize the kernel
	lk_init_level(LK_INIT_LEVEL_KERNEL - 1);
	kernel_init();

	lk_init_level(LK_INIT_LEVEL_THREADING - 1);

#if (!ENABLE_NANDWRITE)
	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
#else
	bootstrap_nandwrite();
#endif
}
예제 #3
0
파일: main.c 프로젝트: grub4android/lk
/* called from arch code */
void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3)
{
	// save the boot args
	lk_boot_args[0] = arg0;
	lk_boot_args[1] = arg1;
	lk_boot_args[2] = arg2;
	lk_boot_args[3] = arg3;

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	lk_primary_cpu_init_level(LK_INIT_LEVEL_EARLIEST, LK_INIT_LEVEL_ARCH_EARLY - 1);
	arch_early_init();

	// do any super early platform initialization
	lk_primary_cpu_init_level(LK_INIT_LEVEL_ARCH_EARLY, LK_INIT_LEVEL_PLATFORM_EARLY - 1);
	platform_early_init();

	// do any super early target initialization
	lk_primary_cpu_init_level(LK_INIT_LEVEL_PLATFORM_EARLY, LK_INIT_LEVEL_TARGET_EARLY - 1);
	target_early_init();

#if WITH_SMP
	dprintf(INFO, "\nwelcome to lk/MP\n\n");
#else
	dprintf(INFO, "\nwelcome to lk\n\n");
#endif
	dprintf(INFO, "boot args 0x%lx 0x%lx 0x%lx 0x%lx\n",
		lk_boot_args[0], lk_boot_args[1], lk_boot_args[2], lk_boot_args[3]);

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	lk_primary_cpu_init_level(LK_INIT_LEVEL_TARGET_EARLY, LK_INIT_LEVEL_HEAP - 1);
	heap_init();

	// initialize the kernel
	lk_primary_cpu_init_level(LK_INIT_LEVEL_HEAP, LK_INIT_LEVEL_KERNEL - 1);
	kernel_init();

	lk_primary_cpu_init_level(LK_INIT_LEVEL_KERNEL, LK_INIT_LEVEL_THREADING - 1);

	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	t->pinned_cpu = 0;
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}
예제 #4
0
파일: main.c 프로젝트: KortanZ/linux
void kmain(void)
{
	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	arch_early_init();

	// do any super early platform initialization
	platform_early_init();

	// do any super early target initialization
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");
	bs_set_timestamp(BS_BL_START);

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	heap_init();

	__stack_chk_guard_setup();

	// initialize the threading system
	dprintf(SPEW, "initializing threads\n");
	thread_init();

	// initialize the dpc system
	dprintf(SPEW, "initializing dpc\n");
	dpc_init();

	// initialize kernel timers
	dprintf(SPEW, "initializing timers\n");
	timer_init();

#if (!ENABLE_NANDWRITE)
	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_resume(thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE));

	// enable interrupts
	exit_critical_section();

	// become the idle thread
	thread_become_idle();
#else
        bootstrap_nandwrite();
#endif
}
예제 #5
0
파일: boot2.cpp 프로젝트: Mirmik/mvirt
extern "C" void boot2(){

	dln
printd("memset\r\n");
delay_cpu(10);
  for (int i = (int) _bss_start; i < (int)_bss_end; i++)
  {
    *((char*) i)=0;
  }


	dln
printd("boot2\r\n");
delay_cpu(10);

debug_serial_printhex_int((int)&__preinit_array_start);dln
debug_serial_printhex_int((int)&__preinit_array_end);dln
debug_serial_printhex_int((int)&__init_array_start);dln
debug_serial_printhex_int((int)&__init_array_end);dln
debug_serial_printhex_int((int)&_ctor_start);dln
debug_serial_printhex_int((int)&_ctor_end);dln


// BEGIN C++ support (2/2)
  //Call C++ global constructors
  call_constructors(&__preinit_array_start, &__preinit_array_end);
  call_constructors(&__init_array_start, &__init_array_end);
 call_constructors(&_ctor_start, &_ctor_end);
  // END C++ support (2/2)

dln
printd("callconstrend\r\n");
delay_cpu(10);

	second_init();
	drivers_init();
	hmain();
	
	systemError("MAIN FUNCTION END. Kernel bewilderment :)");	
}
예제 #6
0
//*****************************************************************************
//
//! \brief This is the code that gets called when the processor first
//! starts execution following a reset event. 
//!
//! \param None.
//!
//! Only the absolutely necessary set is performed, after which the 
//! application supplied main() routine is called. 
//!
//! \return None.
//
//*****************************************************************************
void Default_ResetHandler(void)
{
    //
    // Initialize data and bss
    //
    unsigned long *pulSrc, *pulDest;

    //
    // Copy the data segment initializers from flash to SRAM
    //
    pulSrc = &_sidata;

    for(pulDest = &_sdata; pulDest < &_edata; )
    {
        *(pulDest++) = *(pulSrc++);
    }

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

    //Call C++global constructors
    call_constructors(&__preinit_array_start,&__preinit_array_end);
    call_constructors(&__init_array_start,&__init_array_end);
    call_constructors(&_ctor_start,&_ctor_end);


    //
    // Call the application's entry point.
    //
    main();
}
예제 #7
0
파일: main.c 프로젝트: dna001/stm32-os
void lk_main(void)
{
	inc_critical_section();

	// get us into some sort of thread context
	thread_init_early();

	// early arch stuff
	arch_early_init();

	// do any super early platform initialization
	platform_early_init();

	// do any super early target initialization
	target_early_init();

	dprintf(INFO, "welcome to lk\n\n");

	// deal with any static constructors
	dprintf(SPEW, "calling constructors\n");
	call_constructors();

	// bring up the kernel heap
	dprintf(SPEW, "initializing heap\n");
	heap_init();

	// initialize the kernel
	kernel_init();

	// create a thread to complete system initialization
	dprintf(SPEW, "creating bootstrap completion thread\n");
	thread_t *t = thread_create("bootstrap2", &bootstrap2, NULL, DEFAULT_PRIORITY, DEFAULT_STACK_SIZE);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}
예제 #8
0
void CallConstructors(void)
{
	call_constructors(&__preinit_array_start, &__preinit_array_end);
	call_constructors(&__init_array_start, &__init_array_end);
	call_constructors(&__fini_array_start, &__fini_array_end);
}
예제 #9
0
void CallConstructors(void)
{
	call_constructors(&link_constructors_location, &link_constructors_end);
}