Hi!

     Some times I report about bugs in SYS. Unfortunately, these reports was
completely ignored. (tom, what about "discussion"?) Currently, I write
completely new SYS (tom, and not say later, that I not offer discussion
here!). Before this, Lucho prepares some fixes for current SYS. Below his
explanation, translated to English by me:

______________O\_/_________________________________\_/O______________
I fix SYS bugs, which Bart made, when joins IOCTL functions. BH register
mean "lock level" and should be 0 or 4, but Bart removes its zeroing, thus
LOCK disappear and MS-DOS 7.1 blocks the system. Also, in non-Watcom
function he forget to remove increment for device number. All patches and
new SYS available om my page:
http://linux.tu-varna.acad.bg/~lig/freedos/kernel/

Below patch for SYS:

diff -Naur cvs/kernel/sys/sys.c src/kernel/sys/sys.c
--- cvs/kernel/sys/sys.c        2004-04-10 01:51:44.000000000 +0200
+++ src/kernel/sys/sys.c        2004-07-21 20:28:58.000000000 +0200
@@ -29,7 +29,7 @@
  #define DEBUG
  /* #define DDEBUG */

-#define SYS_VERSION "v3.2"
+#define SYS_VERSION "v3.3"

  #include <stdlib.h>
  #include <dos.h>
@@ -483,13 +483,13 @@
        "int 0x21"          \
        parm [es di] [si];

-int generic_block_ioctl(unsigned char drive, unsigned cx, unsigned char
*par);
+int generic_block_ioctl(unsigned drive, unsigned cx, unsigned char *par);
  #pragma aux generic_block_ioctl = \
        "mov ax, 0x440d" \
        "int 0x21" \
        "sbb ax, ax" \
        value [ax] \
-      parm [bl] [cx] [dx];
+      parm [bx] [cx] [dx]; /* BH must be 0 for lock! */

  #else

@@ -541,14 +541,14 @@
    intdos(&regs, &regs);
  } /* reset_drive */

-int generic_block_ioctl(unsigned char drive, unsigned cx, unsigned char
*par)
+int generic_block_ioctl(unsigned drive, unsigned cx, unsigned char *par)
  {
    union REGS regs;

    regs.x.ax = 0x440d;
    regs.x.cx = cx;
    regs.x.dx = (unsigned)par;
-  regs.h.bl = drive + 1;
+  regs.h.bx = drive; /* BH must be 0 for lock! */
    intdos(&regs, &regs);
    return regs.x.cflag;
  } /* generic_block_ioctl */
@@ -692,7 +692,7 @@
  #endif

    /* lock drive */
-  generic_block_ioctl((unsigned char)drive + 1, 0x84a, NULL);
+  generic_block_ioctl(drive + 1, 0x84a, NULL);

    reset_drive(drive);
    /* suggestion: allow reading from a boot sector or image file here */
@@ -752,7 +752,7 @@
      printf("FAT type: FAT32\n");
      /* get default bpb (but not for floppies) */
      if (drive >= 2 &&
-        generic_block_ioctl((unsigned char)drive + 1, 0x4860, default_bpb) == 0)
+        generic_block_ioctl(drive + 1, 0x4860, default_bpb) == 0)
        correct_bpb((struct bootsectortype *)(default_bpb + 7 - 11), bs);

  #ifdef WITHFAT32                /* copy one of the FAT32 boot sectors */
@@ -767,7 +767,7 @@
    { /* copy the FAT12/16 CHS+LBA boot sector */
      printf("FAT type: FAT1%c\n", fs + '0' - 10);
      if (drive >= 2 &&
-        generic_block_ioctl((unsigned char)drive + 1, 0x860, default_bpb) == 0)
+        generic_block_ioctl(drive + 1, 0x860, default_bpb) == 0)
        correct_bpb((struct bootsectortype *)(default_bpb + 7 - 11), bs);
      memcpy(newboot, fs == FAT16 ? fat16com : fat12com, SEC_SIZE);
    }
@@ -893,7 +893,7 @@
    reset_drive(drive);

    /* unlock_drive */
-  generic_block_ioctl((unsigned char)drive + 1, 0x86a, NULL);
+  generic_block_ioctl(drive + 1, 0x86a, NULL);
  } /* put_boot */
_____________________________________________________________________
              O/~\                                 /~\O




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to