예제 #1
0
파일: ap_main.c 프로젝트: zenhack/zero
void ap_main(void) {
	remap_8259pic();
	disable_8259pic();
	apic_setup();
	apic_timer_init(APIC_TIMER_INT_NO, 7, APIC_TIMER_PERIODIC);
	apic_timer_set(apic_timer_init_count);
	common_main();
}
예제 #2
0
파일: apic.c 프로젝트: tomoyat1/tomos
void initapic()
{
	/* Remap PIC */
	remap_pic();

	/* Detect APIC, panic if not found */
	int ret = 0;
	__asm__(
	"movl $0x1, %%eax\n\t"
	"cpuid\n\t"
	"movl %%edx, %%ecx\n\t"
	:"=c"(ret)
	:
	: "eax", "edx"
	);
	if (!(ret & (1 << 9)))
		panic("No APIC found.");

	/* Disable (mask) PIC*/
	mask_pic();

	/* Get APIC ID for first CPU */
	uint32_t apic_id = read_lapic_reg(0x20);

	write_ioapic_reg(0x10, 0x20);
	write_ioapic_reg(0x11, (apic_id << 24) & 0x0F000000);

	write_ioapic_reg(0x12, 0x21);
	write_ioapic_reg(0x13, (apic_id << 24) & 0x0F000000);

	/* mask mouse input */
	write_ioapic_reg(0x28, 0x100FF);
	write_ioapic_reg(0x29, (apic_id << 24) & 0x0F000000);

	/* Spurious Interrupt Vector */
	write_lapic_reg(0xF0, SPURIOUS_VECTOR + APIC_ENABLE);
	
	/* enable interrupts */
	__asm__("sti");

	/* APIC timer initialization */
	apic_timer_init();
}