Introduce cpu_relax() and use it in busy loops.
[seabios.git] / src / kbd.c
index 0e0dd5b7a2f6b1e7f46ea7fb1310d67e64c05178..3770305b213897a7840f374a7929294922468737 100644 (file)
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -59,8 +59,8 @@ keyboard_init()
         if (inb(PORT_PS2_STATUS) & 0x01) {
             inb(PORT_PS2_DATA);
             max = 0x2000;
-            }
         }
+    }
 
     // Due to timer issues, and if the IPS setting is > 15000000,
     // the incoming keys might not be flushed here. That will
@@ -193,7 +193,7 @@ dequeue_key(u8 *scan_code, u8 *ascii_code, u8 incr)
             break;
         if (!incr)
             return 0;
-        nop();
+        cpu_relax();
     }
 
     *ascii_code = GET_FARVAR(SEG_BDA, *(u8*)(buffer_head+0x400+0));