#ifndef _SYSLINUX_DISK_H
#define _SYSLINUX_DISK_H
+#include <com32.h>
+
#define SECTOR 512 /* bytes/sector */
+extern int disk_int13_retry(const com32sys_t * inreg, com32sys_t * outreg);
+
#endif /* _SYSLINUX_DISK_H */
*/
#include <syslinux/disk.h>
+
+/**
+ * Call int 13h, but with retry on failure. Especially floppies need this.
+ *
+ * @v inreg CPU register settings upon INT call
+ * @v outreg CPU register settings returned by INT call
+ */
+int disk_int13_retry(const com32sys_t * inreg, com32sys_t * outreg)
+{
+ int retry = 6; /* Number of retries */
+ com32sys_t tmpregs;
+
+ if (!outreg)
+ outreg = &tmpregs;
+
+ while (retry--) {
+ __intcall(0x13, inreg, outreg);
+ if (!(outreg->eflags.l & EFLAGS_CF))
+ return 0; /* CF=0, OK */
+ }
+
+ return -1; /* Error */
+}
}
/*
- * Call int 13h, but with retry on failure. Especially floppies need this.
- */
-static int int13_retry(const com32sys_t * inreg, com32sys_t * outreg)
-{
- int retry = 6; /* Number of retries */
- com32sys_t tmpregs;
-
- if (!outreg)
- outreg = &tmpregs;
-
- while (retry--) {
- __intcall(0x13, inreg, outreg);
- if (!(outreg->eflags.l & EFLAGS_CF))
- return 0; /* CF=0, OK */
- }
-
- return -1; /* Error */
-}
-
-/*
* Query disk parameters and EBIOS availability for a particular disk.
*/
struct diskinfo {
inreg.es = SEG(buf);
}
- if (int13_retry(&inreg, NULL))
+ if (disk_int13_retry(&inreg, NULL))
return NULL;
data = malloc(count * SECTOR);
inreg.es = SEG(buf);
}
- if (int13_retry(&inreg, NULL))
+ if (disk_int13_retry(&inreg, NULL))
return -1;
return 0; /* ok */