aboutsummaryrefslogtreecommitdiffstats
path: root/dos
diff options
context:
space:
mode:
authorhpa <hpa>2004-12-15 23:54:56 +0000
committerhpa <hpa>2004-12-15 23:54:56 +0000
commit15fde1c40c42c1d2ea26b67149cf8e5957ad0e81 (patch)
treeb62ac92c463ea46c3879be04f48d0f8a25e98478 /dos
parente953de954027322ef6e3ab73de3ca58cd5522866 (diff)
downloadsyslinux-15fde1c40c42c1d2ea26b67149cf8e5957ad0e81.tar.gz
syslinux-15fde1c40c42c1d2ea26b67149cf8e5957ad0e81.tar.xz
syslinux-15fde1c40c42c1d2ea26b67149cf8e5957ad0e81.zip
Use the DOS version to determine whether to use the FAT32-capable locking
functions.
Diffstat (limited to 'dos')
-rw-r--r--dos/syslinux.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/dos/syslinux.c b/dos/syslinux.c
index 23595fe6..7d3057df 100644
--- a/dos/syslinux.c
+++ b/dos/syslinux.c
@@ -162,24 +162,21 @@ void lock_device(int level)
{
uint16_t rv;
uint8_t err;
+ uint16_t lock_call;
if ( dos_version < 0x0700 )
return; /* Win9x/NT only */
+ /* DOS 7.10 = Win95 OSR2 = first version with FAT32 */
+ lock_call = (dos_version >= 0x0710) ? 0x484A : 0x084A;
+
while ( (uint8_t)lock_level < level ) {
rv = 0x444d;
asm volatile("int $0x21 ; setc %0"
: "=abcdm" (err), "+a" (rv)
- : "b" (lock_level+1), "c" (0x484A), "d"(0x0001));
-
- if ( err ) {
- asm volatile("int $0x21 ; setc %0"
- : "=abcdm" (err), "+a" (rv)
- : "b" (lock_level+1), "c" (0x084A), "d"(0x0001));
-
- if ( err )
- die("could not lock device");
- }
+ : "b" (lock_level+1), "c" (lock_call), "d"(0x0001));
+ if ( err )
+ die("could not lock device");
lock_level++;
}
@@ -190,20 +187,19 @@ void unlock_device(int level)
{
uint16_t rv;
uint8_t err;
+ uint16_t unlock_call;
if ( dos_version < 0x0700 )
return; /* Win9x/NT only */
+ /* DOS 7.10 = Win95 OSR2 = first version with FAT32 */
+ unlock_call = (dos_version >= 0x0710) ? 0x486A : 0x086A;
+
while ( (uint8_t)lock_level > level ) {
rv = 0x440d;
asm volatile("int $0x21 ; setc %0"
: "=abcdm" (err), "+a" (rv)
- : "b" (lock_level-1), "c" (0x486A));
- if ( err ) {
- asm volatile("int $0x21 ; setc %0"
- : "=abcdm" (err), "+a" (rv)
- : "b" (lock_level-1), "c" (0x086A));
- }
+ : "b" (lock_level-1), "c" (unlock_call));
lock_level--;
}
}