diff options
| author | Shao Miller <shao.miller@yrdsb.edu.on.ca> | 2010-06-28 00:59:17 -0400 |
|---|---|---|
| committer | Shao Miller <shao.miller@yrdsb.edu.on.ca> | 2010-07-10 01:00:47 -0400 |
| commit | 8f0f42100f43a52e957c7c6feec0d2fcb21d0b6e (patch) | |
| tree | 67466c002e77234571473af4f1a3a7589518cb8c /com32/lib/syslinux | |
| parent | e2bba11e4aabeada9e4b8bb184ffadbdf14add3c (diff) | |
| download | syslinux-8f0f42100f43a52e957c7c6feec0d2fcb21d0b6e.tar.gz | |
chain.c32, libcom32: Move int13_retry() as disk_int13_retry()
Moving portions of chain.c32 into libcom32.
Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Diffstat (limited to 'com32/lib/syslinux')
| -rw-r--r-- | com32/lib/syslinux/disk.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/com32/lib/syslinux/disk.c b/com32/lib/syslinux/disk.c index 2a286e4f..7be59f2b 100644 --- a/com32/lib/syslinux/disk.c +++ b/com32/lib/syslinux/disk.c @@ -34,3 +34,26 @@ */ #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 */ +} |
