if (prev_reset == 0) {
irq_enable();
u8 v;
- do {
+ for (;;) {
v = GET_BDA(floppy_recalibration_status);
- } while ((v & FRS_TIMEOUT) == 0);
+ if (v & FRS_TIMEOUT)
+ break;
+ cpu_relax();
+ }
irq_disable();
v &= ~FRS_TIMEOUT;
irq_enable();
u8 v;
- do {
+ for (;;) {
if (!GET_BDA(floppy_motor_counter)) {
irq_disable();
floppy_reset_controller();
return DISK_RET_ETIMEOUT;
}
v = GET_BDA(floppy_recalibration_status);
- } while (!(v & FRS_TIMEOUT));
+ if (v & FRS_TIMEOUT)
+ break;
+ cpu_relax();
+ }
irq_disable();
v &= ~FRS_TIMEOUT;
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
break;
if (!incr)
return 0;
- nop();
+ cpu_relax();
}
*ascii_code = GET_FARVAR(SEG_BDA, *(u8*)(buffer_head+0x400+0));
asm volatile("pushl %0 ; popfl" : : "g" (flags) : "memory", "cc");
}
+static inline void cpu_relax(void)
+{
+ asm volatile("rep ; nop": : :"memory");
+}
+
static inline void nop(void)
{
asm volatile("nop");