Beispiel #1
0
/** Initialize descriptor tables for the current CPU.
 * @param cpu		CPU to initialize for. */
__init_text void descriptor_init(cpu_t *cpu) {
	/* Initialize and load the GDT/TSS. */
	gdt_init(cpu);
	tss_init(cpu);

	/* Point the CPU to the global IDT. */
	x86_lidt(kernel_idt, (sizeof(kernel_idt) - 1));
}
Beispiel #2
0
/** Reboot the system. */
void platform_reboot(void) {
	uint8_t val;

	arch_cpu_invalidate_caches();

	/* Try the keyboard controller. */
	do {
		val = in8(0x64);
		if(val & (1<<0))
			in8(0x60);
	} while(val & (1<<1));
	out8(0x64, 0xfe);
	spin(MSECS2NSECS(5));

	/* Fall back on a triple fault. */
	x86_lidt(NULL, 0);
	__asm__ volatile("ud2");
}