Ejemplo n.º 1
0
/*======================================================================*
                           spurious_irq
 *======================================================================*/
PUBLIC void spurious_irq(int irq)
{
        disp_str("spurious_irq: ");
        disp_int(irq);
        disp_str("\n");
	while(1);       //自己添加
}
Ejemplo n.º 2
0
/*======================================================================*
                           spurious_irq
 *======================================================================*/
PUBLIC void spurious_irq(int irq)
{
	disp_str("spurious_irq: ");
	disp_int(irq);
	disp_str("\n");
//	while(1); //add by myself
}
Ejemplo n.º 3
0
/*======================================================================*
                            cstart
 *======================================================================*/
PUBLIC void cstart()
{
	disp_str("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
		 "-----\"cstart\" begins-----\n");

	/* 将 LOADER 中的 GDT 复制到新的 GDT 中 */
	memcpy(&gdt,				  /* New GDT */
	       (void*)(*((u32*)(&gdt_ptr[2]))),   /* Base  of Old GDT */
	       *((u16*)(&gdt_ptr[0])) + 1	  /* Limit of Old GDT */
		);
	/* gdt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sgdt/lgdt 的参数。*/
	u16* p_gdt_limit = (u16*)(&gdt_ptr[0]);
	u32* p_gdt_base  = (u32*)(&gdt_ptr[2]);
	*p_gdt_limit = GDT_SIZE * sizeof(DESCRIPTOR) - 1;
	*p_gdt_base  = (u32)&gdt;

	/* idt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sidt/lidt 的参数。*/ 
												// idt 的定义与gdt类似,GATE的定义类似于 DESCRIPTOR
	u16* p_idt_limit = (u16*)(&idt_ptr[0]);		// 把新的存储段限长的地址 导出 以便通过指针 被赋值
	u32* p_idt_base  = (u32*)(&idt_ptr[2]);		// 把新的存储段基地址的地址 导出 以便被通过指针 被赋值
	*p_idt_limit = IDT_SIZE * sizeof(GATE) - 1;
	*p_idt_base  = (u32)&idt;

	init_prot();  // defined in protect.c 

	disp_str("-----\"cstart\" ends-----\n");
}
Ejemplo n.º 4
0
/*======================================================================*
                            cstart
 *======================================================================*/
PUBLIC void cstart()
{
	disp_str("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
		 "-----\"cstart\" begins-----\n");

		 
	/* 将 LOADER 中的 GDT 复制到新的 GDT 中 */
	memcpy(&gdt,     /* New GDT */
	(void*)(*((u32*)(&gdt_ptr[2]))),/* Base  of Old GDT */
	*((u16*)(&gdt_ptr[0])) + 1 /* Limit of Old GDT */
		);
	/* gdt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sgdt/lgdt 的参数。*/
	u16* p_gdt_limit = (u16*)(&gdt_ptr[0]);
	u32* p_gdt_base	 = (u32*)(&gdt_ptr[2]);
	*p_gdt_limit = GDT_SIZE * sizeof(DESCRIPTOR) - 1;
	*p_gdt_base	 = (u32)&gdt;	
	
	/* idt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sidt/lidt 的参数。*/
	u16* p_idt_limit = (u16*)(&idt_ptr[0]);
	u32* p_idt_base  = (u32*)(&idt_ptr[2]);
	*p_idt_limit = IDT_SIZE * sizeof(GATE) - 1;
	*p_idt_base  = (u32)&idt;

	init_port();

	disp_str("-----\"cstart\" ends-----\n");
}
Ejemplo n.º 5
0
PUBLIC void cstart() {
	disp_str("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
		 "-----\"cstart\" begins-----\n");
        
    // 将 LOADER 中的 GDT 复制到新的 GDT 中
    memcpy(&gdt,                // New GDT
            (void*)(*((u32*)(&gdt_ptr[2]))),    // Base of Old GDT
            *((u16*)(&gdt_ptr[0])) + 1          // Limit of Old GDT
          );
    // gdt_ptr[6] 共 6 个字节:
    // 0~15: Limit  16~47: Base
    // 用作 sgdt/lgdt 的参数
    u16 *p_gdt_limit    = (u16*)(&gdt_ptr[0]);
    u32 *p_gdt_base     = (u32*)(&gdt_ptr[2]);
    *p_gdt_limit        = GDT_SIZE * sizeof(DESCRIPTOR) - 1;
    *p_gdt_base         = (u32)&gdt;

    // idt_ptr[6] 共 6 个字节:
    // 0~15: Limit  16~47: Base
    // 用作 sidt/lidt 的参数
    u16 *p_idt_limit    = (u16*)(&idt_ptr[0]);
    u32 *p_idt_base     = (u32*)(&idt_ptr[2]);
    *p_idt_limit        = IDT_SIZE * sizeof(GATE) - 1;
    *p_idt_base         = (u32)&idt;

    init_prot();

    disp_str("-----\"cstart\" ends-----\n");
}
Ejemplo n.º 6
0
Archivo: i8259.c Proyecto: itlodge/mos
void
spurious_irq(int irq)
{
    disp_str("spurious_irq: ");
    disp_int(irq);
    disp_str("\n");
}
Ejemplo n.º 7
0
int title(void){
  int select;

  while(1){
    _CLRDISP();
    disp_str("Please slect ",0,0,YELLOW);
    disp_str("1: Game Start",0,3,GREEN);
    disp_str("2: END",0,4,BLUE);
    disp_str("Select(1~2)->",0,6,WHITE);
    
    select = input_num();

    switch(select){
    case 1: break;
    case 2: return 1;
    default: continue;
    }

    break;
  }
  
  
  _CLRDISP();
  return 0;
}
Ejemplo n.º 8
0
/*======================================================================*
                            cstart
 *======================================================================*/
PUBLIC void cstart()
{
	disp_str("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n-----\"cstart\" begins-----\n");

	/* 将 LOADER 中的 GDT 复制到新的 GDT 中 */
	memcpy(	&gdt,				   /* New GDT */
		(void*)(*((u32*)(&gdt_ptr[2]))),   /* Base  of Old GDT */
		*((u16*)(&gdt_ptr[0])) + 1	   /* Limit of Old GDT */
		);
	/* gdt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sgdt 以及 lgdt 的参数。 */
	u16* p_gdt_limit = (u16*)(&gdt_ptr[0]);
	u32* p_gdt_base  = (u32*)(&gdt_ptr[2]);
	*p_gdt_limit = GDT_SIZE * sizeof(struct descriptor) - 1;
	*p_gdt_base  = (u32)&gdt;

	/* idt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sidt 以及 lidt 的参数。 */
	u16* p_idt_limit = (u16*)(&idt_ptr[0]);
	u32* p_idt_base  = (u32*)(&idt_ptr[2]);
	*p_idt_limit = IDT_SIZE * sizeof(struct gate) - 1;
	*p_idt_base  = (u32)&idt;

	init_prot();

	disp_str("-----\"cstart\" finished-----\n");
}
Ejemplo n.º 9
0
Archivo: panic.c Proyecto: kcao/kenos
PUBLIC void panic(char *msg)
{
    disp_color_str("kenos panic: ", 4);
    disp_str(msg);
    disp_str("\n\r");

    for (;;);
}
Ejemplo n.º 10
0
Archivo: main.c Proyecto: douzh/mydisk
/*======================================================================*
                               TestC
 *======================================================================*/
void TestC()
{
	int i = 0x2000;
	while(1){
		disp_str("C");
		disp_int(i++);
		disp_str(".");
		delay(1);
	}
}
Ejemplo n.º 11
0
Archivo: main.c Proyecto: douzh/mydisk
/*======================================================================*
                               TestA
 *======================================================================*/
void TestA()
{
	int i = 0;
	while(1){
		disp_str("A");
		disp_int(i++);
		disp_str(".");
		delay(1);
	}
}
Ejemplo n.º 12
0
Archivo: main.c Proyecto: douzh/mydisk
/*======================================================================*
                               TestB
 *======================================================================*/
void TestB()
{
	int i = 0x1000;
	while(1){
		disp_str("B");
		disp_int(i++);
		disp_str(".");
		delay(1);
	}
}
Ejemplo n.º 13
0
void UIInit(void)
{
	// 显示频率 符号
	disp_str(6, 0, "F=");  // F=00000kHZ
	// 显示电容 符号
	disp_str(4, 0, "C=");
	// 显示电感 符号
	disp_str(2, 0, "L=");
	// 显示Q值 符号
	disp_str(0, 0, "Q=");
}
Ejemplo n.º 14
0
void testA(void) 
{
	int i = 0; 

	while(TRUE) {
		disp_str("A"); 
		disp_int(i++); 
		disp_str("."); 
		delay(1);
	}
}
Ejemplo n.º 15
0
void testC(void) 
{
	int i = 0x2000; 

	while(TRUE) {
		disp_str("C"); 
		disp_int(i++); 
		disp_str("."); 
		delay(1);
	}
}
Ejemplo n.º 16
0
void testB(void) 
{
	int i = 0x1000; 

	while(TRUE) {
		disp_str("B"); 
		disp_int(i++); 
		disp_str("."); 
		delay(1);
	}
}
Ejemplo n.º 17
0
Archivo: start.c Proyecto: chnlkw/osmu
void cstart()
{
	disp_str("cstart begin\n");
//	init_gdt();
//	init_8259A();
//	init_idt();
	cpu_info();
	cpuid(1);
	disp_int(rdmsr(0x1B));disp_str("\n");
	init_mp();
	disp_str("cstart finish\n");
	while(1);
}
Ejemplo n.º 18
0
/*======================================================================*
                           clock_handler
 *======================================================================*/
PUBLIC void clock_handler(int irq)
{
	disp_str("#");

	if (k_reenter != 0) {
		disp_str("!");
		return;
	}

	p_proc_ready++;
	if (p_proc_ready >= proc_table + NR_TASKS) {
		p_proc_ready = proc_table;
	}
}
Ejemplo n.º 19
0
void UIRefresh(void)
{
	int iRet = 0;
	
	// 更新频率显示
	disp_str(6, 2, "              ");  // 清空一行
	iRet = DisplayULongInDec(g_ulFrequence, 6, 2);
	disp_str(6, (iRet + 2), "Hz");
	
	// 更新电容显示
	disp_str(4, 2, "              ");
	iRet = DisplayDoubleInDec(g_dC, 3, 4, 2);
	disp_str(4, (2+iRet), "pF");
	
	// 更新电感显示
	if(g_dC != 0){
		g_dL = 1000000 / (g_dC * (4 * PI * PI * (g_ulFrequence / 1000) * (g_ulFrequence / 1000)) / 1000000);
	}
	else{
		g_dL = 0;
	}
	disp_str(2, 2, "              ");
	iRet = DisplayDoubleInDec(g_dL, 3, 2, 2);
	disp_str(2, (2+iRet), "uL");
	
	// 更新Q值显示
	disp_str(0, 2, "              ");
	iRet = DisplayDoubleInDec(g_dQ, 3, 0, 2);
	disp_str(0, (2+iRet), "  ");
}
Ejemplo n.º 20
0
void Init_Ne2k()
{
	ne = (NE2K*) AllocateKernel(sizeof(NE2K));
	if (!ne){disp_str("!yes");}
	mem_set((u32)ne,6,0);

	ne->iobase = 0x280;

	ne->nic_addr = ne->iobase + NE2K_NOVELL_NIC_OFFSET;
	ne->asic_addr = ne->iobase + NE2K_NOVELL_ASIC_OFFSET;
	if(!ne2k_probe(ne)){
		disp_str("yes");
	}
	disp_str("no");
}
Ejemplo n.º 21
0
PUBLIC void exception_handler(int vec_no, int err_code, int eip, int cs, int eflags)
{
    int i;
    int text_color = 0x74; // 灰底红字

    /* 通过打印空格的方式清空屏幕的前五行,并把 disp_pos 清零 */
    disp_pos = 0;
    for (i = 0; i < 80 * 5; i++)
    {
    	disp_str(" ");
    }
    disp_pos = 0;

    disp_color_str("Exception! --> ", text_color);
    disp_color_str(err_description[vec_no], text_color);
    disp_color_str("\n\n", text_color);

    disp_color_str("EFLAGS:", text_color);
    disp_int(eflags);

	disp_color_str(" CS:", text_color);
    disp_int(cs);

    disp_color_str(" EIP:", text_color);
    disp_int(eip);

    if (err_code != 0xFFFFFFFF)
    {
    	disp_color_str(" Error code:", text_color);
	    disp_int(err_code);
    }
}
Ejemplo n.º 22
0
static void
each_part_show (MuMsg *msg, MuMsgPart *part, gboolean color)
{
	/* index */
	g_print ("  %u ", part->index);

	/* filename */
	color_maybe (MU_COLOR_GREEN); {
		gchar *fname;
		fname = mu_msg_part_get_filename (part, FALSE);
		mu_util_fputs_encoded (fname ? fname : "<none>", stdout);
		g_free (fname);
	}
	/* content-type */
	color_maybe (MU_COLOR_BLUE);
	mu_util_print_encoded (
		" %s/%s ",
		part->type ? part->type : "<none>",
		part->subtype ? part->subtype : "<none>");

	/* /\* disposition *\/ */
	color_maybe (MU_COLOR_MAGENTA);
	mu_util_print_encoded ("[%s]",	disp_str(part->part_type));

	/* size */
	if (part->size > 0) {
		color_maybe (MU_COLOR_CYAN);
		g_print (" (%s)", mu_str_size_s (part->size));
	}

	color_maybe (MU_COLOR_DEFAULT);
	fputs ("\n", stdout);
}
Ejemplo n.º 23
0
/*======================================================================*
                            kernel_main
 *======================================================================*/
PUBLIC int kernel_main()
{
	disp_str("-----\"kernel_main\" begins-----\n");

	TASK*		p_task		= task_table;
	PROCESS*	p_proc		= proc_table;
	char*		p_task_stack	= task_stack + STACK_SIZE_TOTAL;
	u16		selector_ldt	= SELECTOR_LDT_FIRST;
	int i;
	for (i = 0; i < NR_TASKS; i++) {
		strcpy(p_proc->p_name, p_task->name);	// name of the process
		p_proc->pid = i;			// pid

		p_proc->ldt_sel = selector_ldt;

		memcpy(&p_proc->ldts[0], &gdt[SELECTOR_KERNEL_CS >> 3],
		       sizeof(DESCRIPTOR));
		p_proc->ldts[0].attr1 = DA_C | PRIVILEGE_TASK << 5;
		memcpy(&p_proc->ldts[1], &gdt[SELECTOR_KERNEL_DS >> 3],
		       sizeof(DESCRIPTOR));
		p_proc->ldts[1].attr1 = DA_DRW | PRIVILEGE_TASK << 5;
		p_proc->regs.cs	= ((8 * 0) & SA_RPL_MASK & SA_TI_MASK)
			| SA_TIL | RPL_TASK;
		p_proc->regs.ds	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
			| SA_TIL | RPL_TASK;
		p_proc->regs.es	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
			| SA_TIL | RPL_TASK;
		p_proc->regs.fs	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
			| SA_TIL | RPL_TASK;
		p_proc->regs.ss	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
			| SA_TIL | RPL_TASK;
		p_proc->regs.gs	= (SELECTOR_KERNEL_GS & SA_RPL_MASK)
			| RPL_TASK;

		p_proc->regs.eip = (u32)p_task->initial_eip;
		p_proc->regs.esp = (u32)p_task_stack;
		p_proc->regs.eflags = 0x1202; /* IF=1, IOPL=1 */

		p_task_stack -= p_task->stacksize;
		p_proc++;
		p_task++;
		selector_ldt += 1 << 3;
	}

	k_reenter = 0;
	ticks = 0;
        shot_num=-1;
        is_shot=1;
        game_target=0x01;
	p_proc_ready	= proc_table;

	init_clock();
        init_keyboard();

	restart();



	while(1){}
}
Ejemplo n.º 24
0
/*==================================================*
		kernel_main
 *==================================================*/
PUBLIC int kernel_main()
{
	disp_str("-----\"kernel_main\" begins-----\n");

	PROCESS* p_proc = proc_table;

	p_proc->ldt_sel = SELECTOR_LDT_FIRST;
	memcpy(&p_proc->ldts[0], &gdt[SELECTOR_KERNEL_CS>>3], sizeof(DESCRIPTOR));
	p_proc->ldts[0].attr1 = DA_C | PRIVILEGE_TASK << 5;
	memcpy(&p_proc->ldts[1], &gdt[SELECTOR_KERNEL_DS>>3], sizeof(DESCRIPTOR));
	p_proc->ldts[1].attr1 = DA_DRW | PRIVILEGE_TASK << 5;

	p_proc->regs.cs = (0 & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
	p_proc->regs.ds = (8 & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
	p_proc->regs.es = (8 & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
	p_proc->regs.fs = (8 & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
	p_proc->regs.ss = (8 & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
	p_proc->regs.gs = (SELECTOR_KERNEL_GS & SA_RPL_MASK) | RPL_TASK;
	p_proc->regs.eip = (u32)TestA;
	p_proc->regs.esp = (u32)task_stack + STACK_SIZE_TOTAL;
	p_proc->regs.eflags = 0x1202; // IF=1, IOPL=1, bit 2 is always 1.

	k_reenter = -1;

	p_proc_ready = proc_table;
	restart();

	while(1){}
}
Ejemplo n.º 25
0
/*======================================================================*
                           clock_handler
 *======================================================================*/
PUBLIC void clock_handler(int irq)
{
	disp_str("#");
	p_proc_ready++;
	if (p_proc_ready >= proc_table + NR_TASKS)
		p_proc_ready = proc_table;
}
Ejemplo n.º 26
0
Archivo: start.c Proyecto: douzh/mydisk
/*======================================================================*
                            cstart
 *======================================================================*/
PUBLIC void cstart()
{
	disp_str("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n-----\"cstart\" begins-----\n");

	// 将 LOADER 中的 GDT 复制到新的 GDT 中
	memcpy(	&gdt,				    // New GDT
		(void*)(*((t_32*)(&gdt_ptr[2]))),   // Base  of Old GDT
		*((t_16*)(&gdt_ptr[0])) + 1	    // Limit of Old GDT
		);
	// gdt_ptr[6] 共 6 个字节:0~15:Limit  16~47:Base。用作 sgdt 以及 lgdt 的参数。
	t_16* p_gdt_limit = (t_16*)(&gdt_ptr[0]);
	t_32* p_gdt_base  = (t_32*)(&gdt_ptr[2]);
	*p_gdt_limit = GDT_SIZE * sizeof(DESCRIPTOR) - 1;
	*p_gdt_base  = (t_32)&gdt;

	disp_str("-----\"cstart\" finished-----\n");
}
Ejemplo n.º 27
0
/*=================================================================*
							clock_handle
 *=================================================================*/
PUBLIC void clock_handler(int irq)
{
	disp_str("#");
	ticks++;
	p_proc_ready->ticks--;
	
	if(k_reenter != 0) {
		disp_str("!");
		return;
	}

	if(p_proc_ready->ticks > 0) {
		return;
	}

	schedule();
}
Ejemplo n.º 28
0
void TestD()
{
    while(1)
    {
        disp_str("D");
        milli_delay(100);
    }
}
Ejemplo n.º 29
0
PUBLIC void init_hd()
{
	/* Get the number of drives from the BIOS data area */
	u8* pNrDrives = (u8*)(0x475);
	disp_str("NrDrives:");
	disp_int(*pNrDrives);
	disp_str("\n");

	put_irq_handler(AT_WINI_IRQ, hd_handler);
	enable_irq(CASCADE_IRQ);	//打开级联中断线
	enable_irq(AT_WINI_IRQ);	//打开硬盘中断线
	
	int i = 0;
	for(i = 0; i < (sizeof(hd_info) / sizeof(hd_info[0])); i++)
		memset(&hd_info[i], 0, sizeof(hd_info[0]));
	hd_info[0].open_cnt = 0;
}
Ejemplo n.º 30
0
Archivo: start.c Proyecto: chnlkw/osmu
void cpu_info()
{
	char basic_info[15];
	get_cpuid(0, basic_info, basic_info + 4, basic_info + 8);
	basic_info[12] = '\n';
	basic_info[13] = '\0';
	disp_str(basic_info);
}