Exemplo n.º 1
0
void _benmain(void)
{
	struct FIFO32 fifo;
	int keybuf[128]={0};
	fifo32_init(&fifo, 128, keybuf);
	struct TSS32 tss_a = {0};
	cons_init();
	env_init();

	/* keyboard setting */
	init_kb(&fifo, 256);

	tss_a.ldtr = 0;
	tss_a.iomap = 0x40000000;
	set_segmdesc(gdt + 0, 103, (int) &tss_a, AR_TSS32);

	task_init(memman);
	/* Unfortunate try the switch back to 0*8 (_benmain) with farjmp but not working.
	* And the reason still unknown.
	* So that I use another thread_kb_io() to catch the keyboard interrupt.
	*/
	load_tr(0 * 8); // record current working task to tss_a
	task_create((int) &thread_kb_io, memman, "bshell", 1);
	task_create((int) &thread_events, memman, "events", 0);

	/* strange issue encountered if run pci_init at the setup_hw() */
	puts("pci scan bus\n");
	pci_init();
	farjmp(0, 4*8);

	puts("\nSystem Halted                                    \n");
	_syshalt();
}
Exemplo n.º 2
0
void _benmain(void)
{
	int i;
	int c = 0;
	int keybuf[128]={0};
	struct FIFO32 fifo;
	struct TIMER *timer;
	fifo32_init(&fifo, 128, keybuf);
	struct TSS32 tss_a, tss_c;
	env_init();

	/* keyboard setting */
	init_kb(&fifo, 256);

	i=0;	

	timer = timer_alloc();
	timer_init(timer, &fifo, 1);
	timer_settime(timer, 50);

	tss_a.ldtr = 0;
	tss_a.iomap = 0x40000000;
	tss_c.ldtr = 0;
	tss_c.iomap = 0x40000000;
	set_segmdesc(gdt + 3, 103, (int) &tss_a, AR_TSS32);

	task_init(memman);

	/* Unfortunate try the switch back to 3*8 (_benmain) with farjmp but not working.
	* And the reason still unknown.
	* So that I use another thread_kb_io() to catch the keyboard interrupt.
	*/

	load_tr(3 * 8); // record current working task to tss_a
	task_create((int) &thread_kb_io, memman, "bshell");

	/* strange issue encountered if run pci_init at the setup_hw() */
	puts("pci scan bus\n");
	pci_init();
	for (;;) {
		asm_cli();
		if (fifo32_status(&fifo) == 0) {
			asm_stihlt(); // wake while keyboard input 
			// got a interrupt
		} else { /* scan_code input */
			c=fifo32_get(&fifo);
			asm_sti();
			if (c == 1) { 
				farjmp(0, 4*8);
			} else {
				puts("disabled boot options.\n");
			}
		}
	}
	puts("\nSystem Halted                                    \n");
	_syshalt();
}
Exemplo n.º 3
0
Arquivo: trap.c Projeto: benwei/bos
static void panic(const char *msg) {
	printf(msg);
	_syshalt();
}