void ide_debug();
void ide_status();
void debug_sched();
+void vga_toggle();
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();
if(scan_code == 0x14) // t
debug_sched();
+ if(scan_code == 0x3B) // F1
+ vga_toggle();
+
if((cnsl_rd_q.head+1) == cnsl_rd_q.tail)
goto end;
p++;
}
}
+
+
+#define VIDEO_DBG_LINE 30
+
+void vga_toggle()
+{
+ static bool dbg = true;
+ unsigned long addr = 0;
+ if(dbg)
+ {
+ addr += VIDEO_DBG_LINE*CHARS_PER_LINE;
+ }
+
+ dbg = !dbg;
+
+ outb(VGA_CRTC_START_ADDR_H,VGA_CRTC_ADDR);
+ outb((addr>>8)&0xFF,VGA_CRTC_DATA);
+ outb(VGA_CRTC_START_ADDR_L,VGA_CRTC_ADDR);
+ outb((addr)&0xFF, VGA_CRTC_DATA);
+}
+
+void vga_dbg_puts(unsigned int line, const char *buf, unsigned char color)
+{
+ int i;
+ char *p = (char *) buf;
+ vga_char_t * const pv = (vga_char_t * const) (VIDEO_ADDR + (VIDEO_DBG_LINE + line) * BYTES_PER_LINE);
+
+ for(i=0; *p; ++i, ++p)
+ {
+ pv[i] = vga_char(*p, color);
+ }
+}
#pragma once
-int printk(char *fmtstr, ...);
+int printk(char *fmtstr, ...);
+int printd(unsigned int line, const char *fmtstr, ...);
jiffies++;
printk("^");
- //printk("^%d^ ", jiffies);
- //printk("%s ", dev_id);
+ printd(0, "clock: %d", jiffies);
}
char __initdata kernel_init_stack[KRNL_INIT_STACK_SIZE] __attribute__ ((__aligned__(PAGE_SIZE)));
-static unsigned int eid = 1;
+static unsigned int eid = 2;
void debug_sem();
void init_task_entry()
{
while(1)
{
i++;
+
if(i == id*100)
{
printk("---READ---%d\n", id);
debug_sem();
printk("---END----%d\n", id);
}
- printk("%d", id);
- asm("sti;hlt;");
+ printd(id, "task:%d cnt:%d", id, i);
+ //asm("sti;");
}
}
}
+ int cnt;
while(1)
{
- printk("r");
+ printd(1, "root_task cnt %d", cnt++);
asm("sti;hlt;");
//sysc_test();
//syscall0(SYSC_TEST);
*--------------------------------------------------------------------------
*/
-char pkbuf[1024];
-extern void vga_puts(const char *buf, unsigned char color);
+extern void vga_puts(const char *buf, unsigned char color);
+extern void vga_dbg_puts(unsigned long line, const char *buf, unsigned char color);
+
int printk(const char *fmtstr, ...)
{
+ char pkbuf[1024];
char *args = (char*)(((char*)&fmtstr)+4);
vsprintf(pkbuf, fmtstr, args);
vga_puts(pkbuf,0x2);
return 0;
}
+
+int printd(unsigned int line, const char *fmtstr, ...)
+{
+ char pkbuf[1024];
+ char *args = (char*)(((char*)&fmtstr)+4);
+ vsprintf(pkbuf, fmtstr, args);
+ vga_dbg_puts(line, pkbuf,0x2);
+ return 0;
+}
ret_from_fork_krnl:
movl PT_REGS_EDX(%esp), %edx
+ sti
call *%edx
#call do_exit