From: acevest Date: Thu, 26 Jun 2014 16:52:55 +0000 (+0800) Subject: re use the right code X-Git-Tag: 0.3.0~46 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=e8fedb8695dff3060431401c44ad6d3f9ff17ec9;p=kernel.git re use the right code --- diff --git a/drivers/ide.c b/drivers/ide.c index 0e1eb66..bcaf720 100644 --- a/drivers/ide.c +++ b/drivers/ide.c @@ -116,7 +116,7 @@ void ide_debug() ide_cmd_out(0, nsect, sect_nr, HD_CMD_READ_EXT); - //printk("ide_debug\n"); + printk("ide_debug\n"); } DECLARE_MUTEX(mutex); @@ -142,7 +142,7 @@ void ide_irq() { u8_t status = inb(REG_STATUS(0)); - //memset(buf, 0xEE, 1024); + memset(buf, 0xEE, 1024); status = inb(drv.iobase+PCI_IDE_STATUS); if(0 == (status & PCI_IDE_STATUS_INTR)) @@ -154,14 +154,11 @@ void ide_irq() outb(status, drv.iobase+PCI_IDE_STATUS); outb(0x00, drv.iobase+PCI_IDE_CMD); - //insl(REG_DATA(0), buf, (512>>2)); - int i; - unsigned short sig; - for(i=0; i<256; ++i) - sig = inw(REG_DATA(0)); - //u16_t *s = (u16_t *) (buf+510); - //printd(11, "hard disk data %04x\n", sig); - //up(&mutex); + insl(REG_DATA(0), buf, (512>>2)); + u16_t sig = *((u16_t *) (buf+510)); + printd(11, "hard disk data %04x", sig); + + up(&mutex); } @@ -225,7 +222,6 @@ void ide_read_identify() if(retires == 0) panic("hard disk is not ready"); - //char buf[1024]; insl(REG_DATA(0), buf, 512>>2); print_ide_identify(buf); } diff --git a/drivers/keyboard.c b/drivers/keyboard.c index 267e982..c263536 100644 --- a/drivers/keyboard.c +++ b/drivers/keyboard.c @@ -35,7 +35,7 @@ void kbd_handler(unsigned int irq, pt_regs_t * regs, void *dev_id) if(scan_code == 0x01) // Esc reboot(); - //printk("[%02x]", scan_code); + printk("[%02x]", scan_code); if(scan_code == 0x13) // r ide_debug(); @@ -56,7 +56,7 @@ void kbd_handler(unsigned int irq, pt_regs_t * regs, void *dev_id) if(scan_code == 0x3E) // F4 debug_wait_queue_put(2); -#if 0 +#if 1 printd(10, "CNSL HEAD : %d", cnsl_rd_q.head); if((cnsl_rd_q.head+1) == cnsl_rd_q.tail) goto end; @@ -64,7 +64,6 @@ void kbd_handler(unsigned int irq, pt_regs_t * regs, void *dev_id) cnsl_rd_q.data[cnsl_rd_q.head++] = (char) scan_code; end: - wake_up(&cnsl_rd_q.wait); #endif } diff --git a/kernel/clock.c b/kernel/clock.c index 2e30ba8..5dd66df 100644 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -19,6 +19,6 @@ void clk_handler(unsigned int irq, pt_regs_t * regs, void *dev_id) { jiffies++; - //printk("^"); - //printd(0, "clock: %d", jiffies); + printk("^"); + printd(0, "clock: %d", jiffies); } diff --git a/kernel/init.c b/kernel/init.c index ac2739e..4309561 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -75,8 +75,8 @@ void root_task_entry() int cnt; while(1) { - printd(1, "root_task [%08x] cnt %d preempt_cnt %08x", current, cnt++, root_task.preempt_cnt); - printd(9, "pid %d ppid %08x state %08x weight %08x", + printd(1, "root_task [%08x] cnt %d preempt_cnt %d", current, cnt++, root_task.preempt_cnt); + printd(9, "pid %d ppid %d state %d weight %d", root_task.pid, root_task.ppid, root_task.state, root_task.weight); asm("sti;hlt;"); //sysc_test(); diff --git a/kernel/interrupts.S b/kernel/interrupts.S index df965d0..e459c7c 100644 --- a/kernel/interrupts.S +++ b/kernel/interrupts.S @@ -78,7 +78,7 @@ return: resched: - #call schedule + call schedule restore_regs: diff --git a/kernel/sched.c b/kernel/sched.c index 7fcebde..31cc824 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -58,9 +58,9 @@ void init_root_tsk() root_task.preempt_cnt = 0; root_task.pid = get_next_pid(); - root_task.ppid = 1000; - root_task.state = 2000;//TASK_RUNNING; - root_task.weight = 3000;//TASK_INIT_WEIGHT; + root_task.ppid = 0; + root_task.state = TASK_RUNNING; + root_task.weight = TASK_INIT_WEIGHT; INIT_LIST_HEAD(&root_task.list); for(i=0; i