示例#1
0
文件: arch.c 项目: M1cha/lk
void arm_cm_irq_entry(void)
{
	inc_critical_section();

	THREAD_STATS_INC(interrupts);
	KEVLOG_IRQ_ENTER(__get_IPSR());
}
示例#2
0
文件: exceptions.c 项目: chychc/lk
static void busfault(struct arm_cm_exception_frame *frame)
{
    inc_critical_section();
    printf("busfault: ");
    dump_frame(frame);

    platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
示例#3
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
}
示例#4
0
文件: exceptions.c 项目: chychc/lk
static void hardfault(struct arm_cm_exception_frame *frame)
{
    inc_critical_section();
    printf("hardfault: ");
    dump_frame(frame);

    printf("HFSR 0x%x\n", SCB->HFSR);

    platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
示例#5
0
文件: faults.c 项目: M1cha/lk
static void exception_die(struct x86_iframe *frame, const char *msg)
{
	inc_critical_section();
	dprintf(CRITICAL, msg);
	dump_fault_frame(frame);

	for (;;) {
		x86_cli();
		x86_hlt();
	}
}
示例#6
0
文件: debug.c 项目: offchooffcho/lk
void sam3_uart_irq(void)
{
	inc_critical_section();

	unsigned char c;
	if (uart_read(UART, &c) == 0) {
		cbuf_write(&debug_rx_buf, &c, 1, false);
		cm3_trigger_preempt();
	}

	dec_critical_section();
}
示例#7
0
文件: main.c 项目: M1cha/lk
void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3)
{
	inc_critical_section();

	// 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_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");
	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_init_level(LK_INIT_LEVEL_HEAP - 1);
	heap_init();

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

	lk_init_level(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);
	thread_detach(t);
	thread_resume(t);

	// become the idle thread and enable interrupts to start the scheduler
	thread_become_idle();
}
示例#8
0
文件: faults.c 项目: jaehyek/lk
static void exception_die(struct arm_fault_frame *frame, int pc_off, const char *msg)
{
	inc_critical_section();
	frame->pc += pc_off;
	dprintf(CRITICAL, msg);
	dump_fault_frame(frame);
	
#ifdef LGE_WITH_CRASH_HANDLER
	platform_halt();
#else
	halt();
#endif
	for(;;);
}
示例#9
0
文件: timer.c 项目: offchooffcho/lk
/* use systick as the kernel tick */
void _systick(void)
{
	inc_critical_section();

	bool resched = false;
	ticks += 10;
	if (cb) {
		if (cb(cb_args, ticks) == INT_RESCHEDULE)
			resched = true;
	}

	if (resched) {
		// have the cortex-m3 queue a preemption
		cm3_trigger_preempt();
	}

	dec_critical_section();
}
示例#10
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();
}
示例#11
0
文件: exceptions.c 项目: chychc/lk
void _memmanage(void)
{
    inc_critical_section();
    printf("memmanage\n");
    platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
示例#12
0
文件: exceptions.c 项目: chychc/lk
void _nmi(void)
{
    inc_critical_section();
    printf("nmi\n");
    platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}
示例#13
0
文件: exceptions.c 项目: chychc/lk
/* systick handler */
void __WEAK _systick(void)
{
    inc_critical_section();
    printf("systick\n");
    platform_halt(HALT_ACTION_HALT, HALT_REASON_SW_PANIC);
}