예제 #1
0
kmain() {
	int i,num;
	
	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0    */
	setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0);
	/* Carga de IDTR    */
	idtr.base = 0;
	idtr.base +=(dword) &idt;
	idtr.limit = sizeof(idt)-1;

	_lidt (&idtr);

	_Cli();

	/* Habilito interrupcion de timer tick*/
	//_mascaraPIC1(INT_08 & INT_09 & INT_80);
	_mascaraPIC1(0x00);
	_mascaraPIC2(NONE);
	_Sti();
	
	initKeyBoard();
	initVideo();
	initShell();
	doubleFlagsFix(1.1);
	while (1) {
		updateShell();
	}
	
}
예제 #2
0
kmain() {
	terminal_init();

	setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x74], 0x08, (dword)&_int_74_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0);
	

	/* IDTR Setting */ 

	idtr.base = 0;  
	idtr.base +=(dword) &idt;
	idtr.limit = sizeof(idt)-1;
	
	_lidt(&idtr);

	/* Interrupt unmasking */
	
	_cli();

	_maskPIC1(0xF8);           /*0XF8*/
	_maskPIC2(0xEF);		/*0XEF*/
	
	_sti();

	video_init();
	timertick_init();
	rtc_init();
	mouse_init();
	shell_run();
}
예제 #3
0
void
initializeIDT()
{
	setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x79], 0x08, (dword)&_int_79_hand, ACS_INT, 0);/*for block_process and kill*/
	idtr.base = 0;
	idtr.base += (dword)&idt;
	idtr.limit = sizeof(idt) - 1;
	_lidt (&idtr);

	return;
}
예제 #4
0
파일: kernel.c 프로젝트: kshmir/Arqui-2011
kmain() {

	int i, num;

	/* Borra la pantalla. */

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0    */

	setup_IDT_entry(&idt[0x08], 0x08, (dword) & _int_08_hand, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ1    */

	setup_IDT_entry(&idt[0x09], 0x08, (dword) & _int_09_hand, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE int80h    */

	setup_IDT_entry(&idt[0x80], 0x08, (dword) & _int_80_hand, ACS_INT, 0);
	
	
//TODO: CARGAR LA PAG DE TABLAS

	/* Carga de IDTR */

	idtr.base = 0;
	idtr.base += (dword) & idt;
	idtr.limit = sizeof(idt) - 1;

	_lidt(&idtr);

	_Cli();

	/* Habilito interrupcion de timer tick*/
	_mascaraPIC1(0xFC);
	_mascaraPIC2(0xFF);
	_Sti();

	startKeyboard();
	initVideo();
	shellStart();

	/* KeepAlive loop */
	while (1) {
		// Main del shell
		shellMain();
	}

}
예제 #5
0
void setUpSyscalls(){
    sysCalls[0] = &sys_clear;
    sysCalls[1] = &sys_allocate;
    sysCalls[2] = &sys_free;
    sysCalls[3] = &sys_read;
    sysCalls[4] = &sys_write;
    sysCalls[5] = &sys_timezone;
    sysCalls[6] = &sys_time;
    sysCalls[7] = &sys_date;
    sysCalls[8] = &sys_addTimerEvent;
    sysCalls[9] = &sys_removeTimerEvent;
    sysCalls[10] = &sys_sleep;
    sysCalls[11] = &sys_pixel;
    sysCalls[12] = &sys_line;
    sysCalls[13] = &sys_square;
    sysCalls[14] = &sys_cursor;
    sysCalls[15] = &sys_readData;
    sysCalls[16] = &sys_changeFont;
    sysCalls[17] = &sys_getConsoleSize;

    sysCalls[18] = &sys_allocatePages;
    sysCalls[19] = &sys_freePages;
    sysCalls[20] = &sys_reallocatePages;
    sysCalls[21] = &sys_allocateNewMemory;
    sysCalls[22] = &sys_reallocateNewMemory;

    sysCalls[23] = &sys_createMutex;
    sysCalls[24] = &sys_releaseMutex;
    sysCalls[25] = &sys_tryLock;
    sysCalls[26] = &sys_unlock;

    sysCalls[27] = &sys_exec;
    sysCalls[28] = &sys_ps;
    sysCalls[29] = &sys_kill;
    sysCalls[30] = &sys_leave;
    sysCalls[31] = &sys_yield;
    sysCalls[32] = &sys_myPID;

    sysCalls[33] = &sys_openPipe;
    sysCalls[34] = &sys_closePipe;

    sysCalls[35] = &sys_initCondVar;
    sysCalls[36] = &sys_signalCondVar;
    sysCalls[37] = &sys_waitCondVar;


    sysCalls[38] = &sys_circle;
    sysCalls[39] = &sys_broadcastCondVar;

    sysCalls[40] = &sys_ipcs;
    sysCalls[41] = &sys_isRunning;

    sysCalls[42] = &sys_memoryUsed;

    setup_IDT_entry (SYSTEM_CALL_START_INDEX, 0x08, (qword)&_irq80Handler, ACS_INT);
}
예제 #6
0
파일: kernel.c 프로젝트: ddome/arqtpe
void
reboot(void)
{
	int i;
	/* Blanqueo el idt */
	for (i=0; i<10; i++)
	        setup_IDT_entry (&idt[i], 0x08, 0, ACS_INT, 0);

	_Fault();
}
예제 #7
0
int main()
{	

	
	setup_IDT_entry(0x20, 0x8,(uint64_t) &_irq00Handler, 0x8E);	
	setup_IDT_entry(0x21, 0x8, (uint64_t)&_irq01Handler, 0x8E);
	setup_IDT_entry(0x80, 0x8,(uint64_t) &syscallHandler, 0x8E);
	

	picMasterMask(0xFC); 
	picSlaveMask(0xFF);

	_sti();

	ncPrint("[Kernel Main]");
	ncNewline();
	ncPrint("  Sample code module at 0x");
	ncPrintHex((uint64_t)sampleCodeModuleAddress);
	ncNewline();
	
	ncPrint("  Calling the sample code module returned: ");
	ncPrintHex(((EntryPoint)sampleCodeModuleAddress)());
	ncNewline();
	ncNewline();

	ncPrint("  Sample data module at 0x");
	ncPrintHex((uint64_t)sampleDataModuleAddress);
	ncNewline();
	ncPrint("  Sample data module contents: ");
	ncPrint((char*)sampleDataModuleAddress);
	ncNewline();

	ncPrint("[Finished]");

	while(1);

	ncClear();

	

	return 0;
}
void setDefaultIdt(){
	int i;
	byte aux = ACS_EXC;
	for (i = 0; i < 255 ; i++){
		if(i>=32)
			aux = ACS_INT;
		//else
			//setDefaultSound(i);
		setup_IDT_entry(&idt[i], 0x08, (dword) &int_13, aux, 0);
	}
}
void setup_IDT_content() {
	setDefaultIdt();
	//	Excepcion division por 0
	setup_IDT_entry(&idt[0x00], 0x08, (dword) &int_00, ACS_EXC, ACS_USED);
	setup_debug_info(0x00, "Div 0", "Excepcion lanzada cuando se divide por 0");
	setDefaultSound(0x00);
	//	Excepcion: Overflow
	setup_IDT_entry(&idt[0x0D], 0x08, (dword) &int_13, ACS_EXC, ACS_USED);
	setup_debug_info(0x0D, "General Protection Exception", "Excepcion lanzada cuando no se encuentra un descriptor de excepcion.");
	setDefaultSound(0x0D);
	//	Excepcion: Array out of bounds
	setup_IDT_entry(&idt[0x03], 0x08, (dword) &int_03, ACS_EXC, ACS_USED);
	setup_debug_info(0x03, "Debug Exception","Excepcion lanzada al momento de utilizar breakpoints");
	setDefaultSound(0x03);
	//	IRQ0: timer tick
	setup_IDT_entry(&idt[0x08], 0x08, (dword) &_int_08_hand, ACS_INT, ACS_USED);
	setup_debug_info(0x08, "Timer Tick", "Interrupcion del timer tick");
	//	IRQ1: keyboard
	setup_IDT_entry(&idt[0x09], 0x08, (dword) &_int_09_hand, ACS_INT, ACS_USED);
	setup_debug_info(0x09, "Keyboard", "Interrupcion del teclado");
}
예제 #10
0
void load_idt()
{

	setup_IDT_entry (0x20, 0x08, (uint64_t)&_irq00Handler, ACS_INT);
	setup_IDT_entry (0x21, 0x08, (uint64_t)&_irq01Handler, ACS_INT);
	setup_IDT_entry (0x80, 0x08, (uint64_t)&_syscallHandler, ACS_INT);

	idtr.base = 0;
	idtr.base += (uint64_t) &idt;
	idtr.limit = (uint16_t) sizeof(idt)-1;
	
	_lidt(&idtr);	


	//Solo interrupcion de teclado y timer tick habilitadas 
	picMasterMask(0xFC); 
	picSlaveMask(0xFF);
        
	_sti();

	
}
예제 #11
0
파일: kernel.c 프로젝트: ddome/arqtpe
kmain()
{

        int i,num;
        int flag = 0;
        int vendor = 0xffff;


/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0 y IRQ1   */

       // setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
        setup_IDT_entry (&idt[0x80], 0x08, (dword)&_int_80_hand, ACS_INT, 0);

        /* Por default el teclado esta en ingles */
        setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand_US,ACS_INT, 0);

        /* Carga de IDTR    */

        idtr.base = 0;
        idtr.base +=(dword) &idt;
        idtr.limit = sizeof(idt)-1;

        _lidt (&idtr);

        _Cli();

        /* Habilito interrupcion del teclado */

        _mascaraPIC1(0xFD);
        _mascaraPIC2(0xFF);

        _Sti();

        /* Se inicia el shell */
        shell();


}
예제 #12
0
파일: kernel.c 프로젝트: maximovs/so-2011-3
/**********************************************
 kmain()
 Punto de entrada de código C.
 *************************************************/
kmain() {
	int i, num;
	// Paging.start(0x200000);
	// init_malloc();
	
	initialize_pics(0x20,0x70);
	setup_IDT_entry(&idt[0x70], 0x08, (dword) & _rtc, ACS_INT, 0);

	_cache_init();
	hdd_init();
	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0    */
	
	setup_IDT_entry (&idt[0x00], 0x08, (dword)&_int_00_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x01], 0x08, (dword)&_int_01_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x02], 0x08, (dword)&_int_02_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x03], 0x08, (dword)&_int_03_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x04], 0x08, (dword)&_int_04_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x05], 0x08, (dword)&_int_05_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x06], 0x08, (dword)&_int_06_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x07], 0x08, (dword)&_int_07_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x08], 0x08, (dword)&_int_08_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x0A], 0x08, (dword)&_int_0A_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x0B], 0x08, (dword)&_int_0B_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x0C], 0x08, (dword)&_int_0C_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x0D], 0x08, (dword)&_int_0D_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x0E], 0x08, (dword)&_int_0E_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x0F], 0x08, (dword)&_int_0F_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x10], 0x08, (dword)&_int_10_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x11], 0x08, (dword)&_int_11_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x12], 0x08, (dword)&_int_12_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x13], 0x08, (dword)&_int_13_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x14], 0x08, (dword)&_int_14_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x15], 0x08, (dword)&_int_15_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x16], 0x08, (dword)&_int_16_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x17], 0x08, (dword)&_int_17_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x18], 0x08, (dword)&_int_18_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x19], 0x08, (dword)&_int_19_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x1A], 0x08, (dword)&_int_1A_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x1B], 0x08, (dword)&_int_1B_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x1C], 0x08, (dword)&_int_1C_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x1D], 0x08, (dword)&_int_1D_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x1E], 0x08, (dword)&_int_1E_hand, ACS_INT, 0);
	setup_IDT_entry (&idt[0x1F], 0x08, (dword)&_int_1F_hand, ACS_INT, 0);
	// setup_IDT_entry (&idt[0x20], 0x08, (dword)&_int_20_hand, ACS_INT, 0);
	// setup_IDT_entry (&idt[0x21], 0x08, (dword)&_int_21_hand, ACS_INT, 0);

	setup_IDT_entry(&idt[0x20], 0x08, (dword) & _timer_tick_hand, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ1    */

	setup_IDT_entry(&idt[0x21], 0x08, (dword) & _KB_hand, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE int80h    */

	setup_IDT_entry(&idt[0x80], 0x08, (dword) & _int_80_hand, ACS_INT, 0);
	
	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE int79h    */

	setup_IDT_entry(&idt[0x79], 0x08, (dword) & _int_79_hand, ACS_INT, 0);

	/* Carga de IDTR */

	idtr.base = 0;
	idtr.base += (dword) & idt;
	idtr.limit = sizeof(idt) - 1;

	_lidt(&idtr);	
	
	
	Cli();
	int rate = 0x06;
	_outb(0x70, 0x0A); //set index to register A
	char prev=_inb(0x71); //get initial value of register A
	_outb(0x70, 0x0A); //reset index to A
	_outb(0x71, (prev & 0xF0) | rate); //write only our rate to A. Note, rate is the bottom 4 bits.
	
		
		init_paging();
	scheduler_init();



	/* Habilito interrupcion de timer tick*/
	_mascaraPIC1(0xFC);
	_mascaraPIC2(0xFE);
	
	_outb(0x70, 0x0B); //set the index to register B
	prev= _inb(0x71); //read the current value of register B
	_outb(0x70, 0x0B); //set the index again(a read will reset the index to register D)
	_outb(0x71, prev | 0x40); //write the previous value or'd with 0x40. This turns on bit 6 of register B

	Sti();




	idle = create_process("idle", idle_main, 0, 0, 0, 0, 0, 0, 0, NULL, 0);
	
	

	// We soon exit out of here :)
	while (1);

}
예제 #13
0
파일: kernel.c 프로젝트: kshmir/so-2011-2
/**********************************************
 kmain()
 Punto de entrada de código C.
 *************************************************/
kmain() {
	int i, num;

	setup_IDT_entry(&idt[0x70], 0x08, (dword) & _rtc, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ0    */

	setup_IDT_entry(&idt[0x08], 0x08, (dword) & _int_08_hand, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE IRQ1    */

	setup_IDT_entry(&idt[0x09], 0x08, (dword) & _int_09_hand, ACS_INT, 0);

	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE int80h    */

	setup_IDT_entry(&idt[0x80], 0x08, (dword) & _int_80_hand, ACS_INT, 0);
	
	/* CARGA DE IDT CON LA RUTINA DE ATENCION DE int79h    */

	setup_IDT_entry(&idt[0x79], 0x08, (dword) & _int_79_hand, ACS_INT, 0);

	/* Carga de IDTR */

	idtr.base = 0;
	idtr.base += (dword) & idt;
	idtr.limit = sizeof(idt) - 1;

	_lidt(&idtr);	
	
	Cli();
	int rate = 0x06;
	_outb(0x70, 0x0A); //set index to register A
	char prev=_inb(0x71); //get initial value of register A
	_outb(0x70, 0x0A); //reset index to A
	_outb(0x71, (prev & 0xF0) | rate); //write only our rate to A. Note, rate is the bottom 4 bits.
	

	scheduler_init();


	/* Habilito interrupcion de timer tick*/
	_mascaraPIC1(0x00);
	_mascaraPIC2(0x00);
	
	_outb(0x70, 0x0B); //set the index to register B
	prev= _inb(0x71); //read the current value of register B
	_outb(0x70, 0x0B); //set the index again(a read will reset the index to register D)
	_outb(0x71, prev | 0x40); //write the previous value or'd with 0x40. This turns on bit 6 of register B

	Sti();





	idle = create_process("idle", idle_main, 0, 0, 0, 0, 0, 0, 0, NULL, 0);
	
	

	// We soon exit out of here :)
	while (1);

}
예제 #14
0
파일: kernel.c 프로젝트: ddome/arqtpe
void
loadkeysus(void)
{
	setup_IDT_entry (&idt[0x09], 0x08, (dword)&_int_09_hand_US,ACS_INT, 0);
}