日期:2014-05-16 浏览次数:20631 次
#define SAVE_AND_DIS_IRQ(eflags)\ __asm__ volatile ("pushfl\n\t"\ "popl %%eax\n\t"\ "movl %%eax,%0\n\t"\ :"=g"(eflags)\ );\ __asm__ volatile ("cli") #define SAVE_AND_EN_IRQ(eflags)\ __asm__ volatile ("pushfl\n\t"\ "popl %%eax\n\t"\ "movl %%eax,%0\n\t"\ :"=g"(eflags)\ );\ __asm__ volatile ("sti") #define RESTORE_IRQ(eflags)\ __asm__ volatile ("movl %0,%%eax\n\t"\ "pushl %%eax\n\t"\ "popfl\n\t"\ :"=m"(eflags)\ )
void console_input(unsigned char c) { unsigned long eflags; SAVE_AND_DIS_IRQ(eflags); console.out(c); if (c == KEY_ENTER) { /*enter.*/ if (!console_cmd_go()) { console_cmd_clear(); printk('s', CONSOLE_LOGO); } else { console_cmd_clear(); //console_input(KEY_ENTER); } } else if (c == 8) {/*backspace*/ console_cmd_delchar(); } else { console_cmd_addchar(c); } RESTORE_IRQ(eflags); return; }