core: Check for func key in getchar()
authorMatt Fleming <matt.fleming@intel.com>
Tue, 28 Feb 2012 21:06:38 +0000 (21:06 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Fri, 23 Mar 2012 16:34:41 +0000 (16:34 +0000)
We need to return the value stored in ah after reading from the
keyboard with __intcall(0x16, ...) otherwise we won't properly detect
function keys such as F1, F2, etc.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
core/conio.c

index 5ed0b4b..70dd3b1 100644 (file)
@@ -265,7 +265,7 @@ extern void do_idle(void);
 /*
  * getchar: Read a character from keyboard or serial port
  */
-char getchar(void)
+char getchar(char *hi)
 {
        com32sys_t ireg, oreg;
        unsigned char data;
@@ -313,6 +313,8 @@ char getchar(void)
                        __intcall(0x16, &ireg, &oreg);
 
                        data = oreg.eax.b[0];
+                       *hi = oreg.eax.b[1];
+
                        if (data == 0xE0)
                                data = 0;
 
@@ -331,7 +333,7 @@ char getchar(void)
 
 void pm_getchar(com32sys_t *regs)
 {
-       regs->eax.b[0] = getchar();
+       regs->eax.b[0] = getchar(&regs->eax.b[1]);
 }
 
 static void msg_setbg(char data)