kernel.c

来自「raywill写的操作系统内核」· C语言 代码 · 共 63 行

C
63
字号
#include <maray/tty.h>



void osmain( void );

#include <i386/timer.h>
#include <i386/irq.h>
#include <maray/kb.h>
#include <maray/tty.h>
#include <asmcmd.h>
#include <maray/clock.h>

;extern void enable_paging(void);

sys_time start_tm;
sys_time real_tm;

void osmain( void );


void osmain( void )
{
		int i;
		int j=0;
		char nb[10];

		char tmbuf[30];
		/* ini screen first,so that we can output info as early as possible */
 		init_tty();	/*	initialize the screen											*/		
   	print( "TTY initialized\n" );
   	
		init_irq();	/*initialize irq,with all interrupte disabled.*/
   	print( "IRQ initialized\n" );
   			
    init_kb();	/* set keyboard IRQ,and enable it							*/
    print( "Keyboard initialized\n" );
    
 		init_timer();	/* initialize time,enalbe timer irq					*/
 		print( "Timer initialized\n" );

		init_system_clock(&start_tm);
		print("System start time is ");
		print(timetostr(&start_tm,tmbuf));
		sti();			/* now,let's setup interrupt									*/
   	print( "\nSetup interrupt!\n" );   	

   //	enable_paging();
   // print( "\nEnable Paging!\n" );  	

		
		print( "\nNow I am doing a loop ,waiting for interrupt :)\n" );
		//print(itoa((int)88451323,nb));
		while(1){
			;//for(i=0;i<0xfffff;i++);
			//print("<Timer>");
		}
		halt();
}



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?