Re: [Freedos-kernel] Re: [Freedos-cvs] kernel/kernel dosfns.c,1.70,1.71

2004-07-24 Thread Arkady V.Belousov
Hi!

25-Июл-2004 09:58 Arkady V.Belousov wrote to
[EMAIL PROTECTED]:

BO>> Need to check for navc!=NULL, not *nc!=0x in DosGetFree.
BO>> +++ dosfns.c25 Jul 2004 00:08:34 -  1.71
BO>> -  if (*nc != 0x)
BO>> +  if (navc != NULL)
BO>>  *navc = (COUNT) dos_free(dpbp);
AVB>  Unfortunately, this is not the last access to *navc without checking.
AVB> Unfortunately, there changed UWORD *dpw,

 Hm. Interesting mistype. :) Should be "UWORD *spc".

AVB> where FcbFatGetDrvData() passes
AVB> pointer to lr.AX, whereas INT21/1B and INT21/1C should modify AL.




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] Re: [Freedos-cvs] kernel/kernel proto.h,1.75,1.76 fcbfns.c,1.44,1.45 inthndlr.c,1.87,1.88

2004-07-24 Thread Arkady V.Belousov
Салям!

24-Июл-2004 23:53 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

BO> Fix: AL was not passed to FcbParseFname (int21/ah=29) (Arkady)
BO> +++ fcbfns.c24 Jul 2004 23:53:21 -  1.45
BO> -UWORD FcbParseFname(int *wTestMode, const BYTE FAR * lpFileName, fcb FAR *
BO> lpFcb)
BO> +UWORD FcbParseFname(UBYTE *wTestMode, const BYTE FAR * lpFileName, fcb FAR
BO> * lpFcb)

 Looks like you don't try to compile this. You should get warning with
(second) call to this function.




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] Re: [Freedos-cvs] kernel/kernel dosfns.c,1.70,1.71

2004-07-24 Thread Arkady V.Belousov
Hi!

25-Июл-2004 00:08 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

BO> Need to check for navc!=NULL, not *nc!=0x in DosGetFree.
BO> +++ dosfns.c25 Jul 2004 00:08:34 -  1.71
BO> -  if (*nc != 0x)
BO> +  if (navc != NULL)
BO>  *navc = (COUNT) dos_free(dpbp);

 Unfortunately, this is not the last access to *navc without checking.
Unfortunately, there changed UWORD *dpw, where FcbFatGetDrvData() passes
pointer to lr.AX, whereas INT21/1B and INT21/1C should modify AL.




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Strange bug in kernel 2035

2004-07-24 Thread Bart Oldeman
On Sat, 24 Jul 2004, Eduardo Casino wrote:

> El sáb, 24-07-2004 a las 13:50, Bart Oldeman escribió:
> 
> > It's a difficult question. Essentially there are two ways we can go:
> > 1. if the kernel very carefully minimizes stack usage on the code path 
> >taken and NLSFUNC itself only uses a couple bytes of stack in between 
> >it's possible to just do it.
> > or
> > 2. nlsfunc would have to copy anything in between ss:sp and ss:920
> >(_disk_api_tos, that's the top of the stack used here in any DOS >= 
> > 4.0) to a temp area (max 384 bytes), set sp to 920, and with that call 
> > DOS. Then after the call adjust the stack pointer, then swap it back,
> > then return.
> 
> Just curious, what about a 3rd possibility: implement the 2f12xx calls
> as documented in RBIL? For example, 2f1228: "sets user stack frame
> pointer to dummy buffer, moves BP to AX, performs LSEEK, and restores
> frame pointer". (This is the "what", my problem is "how" :)

The user stack frame pointer is poined to by a global variable "user_r" 
in the FreeDOS kernel. It points to the user stack which is yet another 
stack. It sits in the SDA at
264hDWORD   pointer to stack frame containing user registers on INT 21

What normally happens is that:
1. user calls int21/ah=42
2. registers are pushed on the stack (entry.asm)
3. ss:sp stored in user_r
4. ss:sp moves to DOS stack
5. DOS does the lseek using the values pushed in 2.
6. DOS updates the registers on the user stack

Essentially the RBIL comments says that, in MSDOS, 2f1228 changes user_r 
to point to a dummy place, moves the value of BP to the "AX"-slot in the 
dummy user_r stack, calls steps 4-6, restores user_r, and returns.

In FreeDOS that would mean something like this:

  case 0x28:
old_user_r = user_r;
user_r = &tempplace;
user_r->AX = r.BP;
int21_service(user_r);
user_r = old_user_r;
break;

This has nothing to do with switching kernel stacks, in fact if FreeDOS 
would do things this way (instead of calling DosSeek directly) it would 
use even more stack space.

This all goes to say that RBIL is a strange place, sometimes it doesn't 
report much at all (about error codes for instance), and sometimes it 
reports about such obscure implementation details.

Bart



---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Re: patch: dosfns.c fcbfns.c inthndlr.c proto.h

2004-07-24 Thread Arkady V.Belousov
Hi!

25-Июл-2004 00:33 [EMAIL PROTECTED] (Eric Auer) wrote to
[EMAIL PROTECTED]:

EA> Hi Arkady! Your patch is MUCH too long.
EA> I doubt that you did try to keep the diff short AT ALL.

 Eric, may be you test this patch instead criticizm? May be, it already
fixes your problem with WHICHFAT?




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] patch: dosfns.c inthndlr.c proto.h

2004-07-24 Thread Arkady V.Belousov
Hi!

- fix: INT21/42: for seeking error was always returned DE_INVLDHNDL; now
  error propagated from lower levels.

--- Begin Message ---
diff -ruNp old/kernel/dosfns.c new/kernel/dosfns.c
--- old/kernel/dosfns.c 2004-07-25 01:25:20.0 +
+++ new/kernel/dosfns.c 2004-07-25 02:31:20.0 +
@@ -317,7 +317,11 @@ long DosRWSft(int sft_idx, size_t n, voi
 
 int SftSeek(int sft_idx, LONG new_pos, unsigned mode)
 {
-  sft FAR *s = idx_to_sft(sft_idx);
+  return _SftSeek(idx_to_sft(sft_idx), new_pos, mode);
+}
+
+int _SftSeek(sft FAR *s, LONG new_pos, unsigned mode)
+{
   if (FP_OFF(s) == (size_t) -1)
 return DE_INVLDHNDL;
 
@@ -367,20 +371,6 @@ int SftSeek(int sft_idx, LONG new_pos, u
   return SUCCESS;
 }
 
-ULONG DosSeek(unsigned hndl, LONG new_pos, COUNT mode)
-{
-  int sft_idx = get_sft_idx(hndl);
-  COUNT result;
-
-  /* Get the SFT block that contains the SFT  */
-  result = SftSeek(sft_idx, new_pos, mode);
-  if (result == SUCCESS)
-  {
-return idx_to_sft(sft_idx)->sft_posit;
-  }
-  return (ULONG)-1;
-}
-
 STATIC long get_free_hndl(void)
 {
   psp FAR *p = MK_FP(cu_psp, 0);
@@ -844,8 +834,8 @@ UWORD DosGetFree(UBYTE drive, UWORD * na
   }
 #endif
 
-  /* now tell fs to give us free cluster count */
   *nc = dpbp->dpb_size - 1;
+  /* now tell fs to give us free cluster count */
   if (navc)
 *navc = (UWORD) dos_free(dpbp);
   if (spc > 64)
diff -ruNp old/kernel/inthndlr.c new/kernel/inthndlr.c
--- old/kernel/inthndlr.c   2004-07-25 00:22:58.0 +
+++ new/kernel/inthndlr.c   2004-07-25 02:53:58.0 +
@@ -889,19 +889,15 @@ dispatch:
 
   /* Dos Seek */
 case 0x42:
-  if (lr.AL > 2)
-goto error_invalid;
-  lrc = DosSeek(lr.BX, (LONG)ULONG) (lr.CX)) << 16) | lr.DX), lr.AL);
-  if (lrc == -1)
-  {
-lrc = DE_INVLDHNDL;
-  }
-  else
+{
+  sft FAR *s = get_sft(lr.BX);
+  if ((rc = _SftSeek(s, MK_ULONG(lr.CX, lr.DX), lr.AL)) >= SUCCESS)
   {
-lr.DX = (UWORD)(lrc >> 16);
-lrc = (UWORD) lrc;
+lr.DX = hiword (s->sft_posit);
+lr.AX = loword (s->sft_posit);
   }
-  goto long_check;
+  goto short_check;
+}
 
   /* Get/Set File Attributes  */
 case 0x43:
diff -ruNp old/kernel/proto.h new/kernel/proto.h
--- old/kernel/proto.h  2004-07-25 00:28:04.0 +
+++ new/kernel/proto.h  2004-07-25 02:48:16.0 +
@@ -78,12 +78,11 @@ sft FAR *get_sft(UCOUNT);
 
 /* dosfns.c */
 
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
+#define SEEK_SET 0u
+#define SEEK_CUR 1u
+#define SEEK_END 2u
 
 const char FAR *get_root(const char FAR *);
-BOOL check_break(void);
 UCOUNT GenericReadSft(sft far * sftp, UCOUNT n, void FAR * bp,
   COUNT * err, BOOL force_binary);
 COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode);
@@ -93,7 +92,7 @@ void BinarySftIO(int sft_idx, void *bp, 
 long DosRWSft(int sft_idx, size_t n, void FAR * bp, int mode);
 #define DosRead(hndl, n, bp) DosRWSft(get_sft_idx(hndl), n, bp, XFR_READ)
 #define DosWrite(hndl, n, bp) DosRWSft(get_sft_idx(hndl), n, bp, XFR_WRITE)
-ULONG DosSeek(unsigned hndl, LONG new_pos, COUNT mode);
+int _SftSeek(sft FAR*, LONG new_pos, unsigned mode);
 long DosOpen(char FAR * fname, unsigned flags, unsigned attrib);
 COUNT CloneHandle(unsigned hndl);
 long DosDup(unsigned Handle);
--- End Message ---


[Freedos-kernel] Re: patch: dosfns.c fcbfns.c inthndlr.c proto.h

2004-07-24 Thread Eric Auer

Hi Arkady! Your patch is MUCH too long.

> This is my (first) try to bugfix wrong INT21/1B, INT21/1C and INT21/36.
> Sorry, tom, but there more than 1-2 lines of diff, and I doubt that this
> diff may be (noticeably) reduced.

> - bugfix: DosGetFree(): *navc was accessed (read and write) without checking
>   if navc!=NULL; instead "navc!=NULL" was used "*nc!=0x".
> - bugfix: FatGetDrvData(): was changed UWORD *spc, but INT21/1B and INT21/1C
>   should change only AL, not AX.
> ? FatGetDrvData(): when get_dpb()==NULL, as value for media ID was used
>   high byte of *spc (sectors_per_cluster), but it always zero.
> - static Dmatch moved nearer to FcbFindFirstNext() and added comment from tom.
> - bugfix: INT21/1B, INT21/1C: FatGetDrvData() now called with &lr.AL, not AX.

I am trying to summarize it:

- you moved rg[4] more towards inside (optimizes better)
- you did something with dpbp
- you removed UWORD * spc argument from DosGetFree everywhere
- you replaced (navc != NULL) by (navc) everywhere

> +  spc = dpbp->dpb_clsmask + 1;
... you replaced access to *spc by access to spc everywhere, as it no longer
is accessed through a pointer argument to DosGetFree. Instead, you made it
the return value of DosGetFree, I think, and -1 now means FALSE everywhere.

> -  if (*nc != 0x)
> -*navc = (COUNT) dos_free(dpbp);
> +  if (navc)
> +*navc = (UWORD) dos_free(dpbp);
That really fixes something I think.

In fcbfns.c, in FatGetDrvData, you changed:
> -  mdb = *spc >> 8;
> +static UBYTE mdb = 0;

In calling FatGetDrvData the return value is no longer p = ... but it now
is UBYTE FAR *p = ... which looks like a real change, possibly useful ;-).

> -p = FatGetDrvData(lr.DL, &lr.AX, &lr.CX, &lr.DX);
> +  UBYTE FAR *p = FatGetDrvData(lr.DL, &lr.AL, &lr.CX, &lr.DX);

> -  DosGetFree(lr.DL, &lr.AX, &lr.BX, &lr.CX, &lr.DX);
> +  lr.AX = DosGetFree(lr.DL, &lr.BX, &lr.CX, &lr.DX);

You also moved get_cds1() to some completely different location and
changed some argument types and names, e.g.
FatGetDrvData UWORD * spc got replaced by UBYTE * pspc.


And of course you changed formatting, e.g. merging several consecutive
"if" into one, using only a bare minimum of parentheses, which probably
means that the formatting change does not improve readability.

So what got actually fixed? I think the *spc handling in several aspects
and the (*nc != 0x) which you replaced by (navc), or in other words by
(navc != NULL). Not sure if the movement pointered argument -> return value
actually means a fix, too.

May I summarize the most important part of the fix as:
> -  if (*nc != 0x)
> +  if (navc)
...!?

> Sorry, tom, but there more than 1-2 lines of diff, and I doubt that this
> diff may be (noticeably) reduced.
I doubt that you did try to keep the diff short AT ALL.

Eric


---
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


[Freedos-kernel] patch: dosfns.c fcbfns.c inthndlr.c proto.h

2004-07-24 Thread Arkady V.Belousov
Hi!

This is my (first) try to bugfix wrong INT21/1B, INT21/1C and INT21/36.
Sorry, tom, but there more than 1-2 lines of diff, and I doubt that this
diff may be (noticeably) reduced.

dosfns.c

- bugfix: DosGetFree(): *navc was accessed (read and write) without checking
  if navc!=NULL; instead "navc!=NULL" was used "*nc!=0x".

fcbfns.c

- bugfix: FatGetDrvData(): was changed UWORD *spc, but INT21/1B and INT21/1C
  should change only AL, not AX.
? FatGetDrvData(): when get_dpb()==NULL, as value for media ID was used
  high byte of *spc (sectors_per_cluster), but it always zero.
- static Dmatch moved nearer to FcbFindFirstNext() and added comment from tom.

inthndlr.c

- bugfix: INT21/1B, INT21/1C: FatGetDrvData() now called with &lr.AL, not AX.

--- Begin Message ---
diff -ruNp old/kernel/dosfns.c new/kernel/dosfns.c
--- old/kernel/dosfns.c 2004-07-24 21:22:54.0 +
+++ new/kernel/dosfns.c 2004-07-25 01:25:20.0 +
@@ -96,6 +96,13 @@ STATIC int remote_lock_unlock(sft FAR *s
 /* get current directory structure for drive
return NULL if the CDS is not valid or the
drive is not within range */
+struct cds FAR *get_cds1(unsigned drv)
+{
+  if (drv-- == 0) /* 0 = A:, 1 = B:, ... */
+drv = default_drive;
+  return get_cds(drv);
+}
+
 struct cds FAR *get_cds(unsigned drive)
 {
   struct cds FAR *cdsp;
@@ -106,9 +113,9 @@ struct cds FAR *get_cds(unsigned drive)
   cdsp = &CDSp[drive];
   flags = cdsp->cdsFlags;
   /* Entry is disabled or JOINed drives are accessable by the path only */
-  if (!(flags & CDSVALID) || (flags & CDSJOINED) != 0)
-return NULL;
-  if (!(flags & CDSNETWDRV) && cdsp->cdsDpb == NULL)
+  if ((flags & CDSVALID) == 0 ||
+  (flags & CDSJOINED) != 0 ||
+  (flags & CDSNETWDRV) == 0 && cdsp->cdsDpb == NULL)
 return NULL;
   return cdsp;
 }
@@ -763,28 +770,22 @@ COUNT DosClose(COUNT hndl)
   return ret;
 }
 
-BOOL DosGetFree(UBYTE drive, UWORD * spc, UWORD * navc,
-UWORD * bps, UWORD * nc)
+UWORD DosGetFree(UBYTE drive, UWORD * navc, UWORD * bps, UWORD * nc)
 {
-  /* navc==NULL means: called from FatGetDrvData, fcbfns.c */
-  struct dpb FAR *dpbp;
+  /* navc==NULL means: called from FatGetDrvData, fcbfns.c */
   struct cds FAR *cdsp;
-  COUNT rg[4];
-
-  /* next - "log" in the drive*/
-  drive = (drive == 0 ? default_drive : drive - 1);
-
-  /* first check for valid drive  */
-  *spc = -1;
-  cdsp = get_cds(drive);
+  struct dpb FAR *dpbp;
+  UWORD spc;
 
-  if (cdsp == NULL)
-return FALSE;
+  /* first check for valid drive   */
+  if ((cdsp = get_cds1(drive)) == NULL)
+return -1;
 
   if (cdsp->cdsFlags & CDSNETWDRV)
   {
+COUNT rg[4];
 if (remote_getfree(cdsp, rg) != SUCCESS)
-  return FALSE;
+  return -1;
 
 /* for int21/ah=1c:
Undoc DOS says, its not supported for
@@ -793,21 +794,15 @@ BOOL DosGetFree(UBYTE drive, UWORD * spc
the redirector can provide all info
- Bart, 2002 Apr 1 */
 
-if (navc != NULL)
-{
-  *navc = (COUNT) rg[3];
-  *spc &= 0xff; /* zero out media ID byte */
-}
-
-*spc = (COUNT) rg[0];
-*nc = (COUNT) rg[1];
-*bps = (COUNT) rg[2];
-return TRUE;
+*bps = rg[2];
+*nc = rg[1];
+if (navc)
+  *navc = rg[3];
+return rg[0];
   }
 
-  dpbp = cdsp->cdsDpb;
-  if (dpbp == NULL)
-return FALSE;
+  if ((dpbp = cdsp->cdsDpb) == NULL)
+return -1;
 
   if (navc == NULL)
   {
@@ -815,56 +810,60 @@ BOOL DosGetFree(UBYTE drive, UWORD * spc
 flush_buffers(dpbp->dpb_unit);
 dpbp->dpb_flags = M_CHANGED;
   }
-
   if (media_check(dpbp) < 0)
-return FALSE;
-  /* get the data available from dpb  */
-  *spc = (dpbp->dpb_clsmask + 1);
+return -1;
+
+  /* get the data available from dpb   */
+  spc = dpbp->dpb_clsmask + 1;
   *bps = dpbp->dpb_secsize;
 
-  /* now tell fs to give us free cluster  */
-  /* count*/
 #ifdef WITHFAT32
   if (ISFAT32(dpbp))
   {
 ULONG cluster_size, ntotal, nfree;
 
-/* we shift ntotal until it is equal to or below 0xfff6 */
 cluster_size = (ULONG) dpbp->dpb_secsize << dpbp->dpb_shftcnt;
 ntotal = dpbp->dpb_xsize - 1;
-if (navc != NULL)
+/* now tell fs to give us free cluster count   */
+if (navc)
   nfree = dos_free(dpbp);
+
+/* we shift ntotal until it is equal to or below 0xfff6*/
 while (ntotal > FAT_MAGIC16 && cluster_size < 0x8000)
 {
   cluster_size <<= 1;
-  *spc <<= 1;
+  spc <<= 1;
   ntotal >>= 1;
   nfree >>= 1;
 }
-/* get the data available from dpb  */
-*nc = ntotal > FAT_MAGIC16 ? FAT_MAGIC16 : (UCOUNT) ntotal;
 
-/* now tell fs to give us free cluster  */
-/* count*/
-if (navc != NULL)
-  *navc = nfree > FAT_MAGIC16 ? FAT_MAGIC16 : (UCOUNT) nfree;
-return TRUE;
+*nc = ntotal > FAT_MAGIC16 ? FAT_MAGIC16 : (U

[Freedos-kernel] patch

2004-07-24 Thread Arkady V.Belousov
Hi!

- small code cleanup (generated code not changed).

--- Begin Message ---
diff -ruNp old/kernel/dosfns.c new/kernel/dosfns.c
--- old/kernel/dosfns.c 2004-07-20 17:57:38.0 +
+++ new/kernel/dosfns.c 2004-07-24 21:22:54.0 +
@@ -308,19 +308,14 @@ long DosRWSft(int sft_idx, size_t n, voi
   }
 }
 
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
-/* !!! `mode' should be `unsigned' --avb */
-int SftSeek(int sft_idx, LONG new_pos, int mode)
+int SftSeek(int sft_idx, LONG new_pos, unsigned mode)
 {
   sft FAR *s = idx_to_sft(sft_idx);
   if (FP_OFF(s) == (size_t) -1)
 return DE_INVLDHNDL;
 
   /* Test for invalid mode*/
-  if ((unsigned)mode > SEEK_END) /* 2 */
+  if (mode > SEEK_END) /* 2 */
 return DE_INVLDFUNC;
 
   lpCurSft = s;
@@ -1025,8 +1020,7 @@ STATIC int pop_dmp(int rc, dmatch FAR * 
   return rc;
 }
 
-/* !!! `name' should be `const char FAR*' --avb */
-COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
+COUNT DosFindFirst(UCOUNT attr, const char FAR * name)
 {
   dmatch FAR *save_dta = dta;
   int rc = truename(name, PriPathName,
diff -ruNp old/kernel/proto.h new/kernel/proto.h
--- old/kernel/proto.h  2004-07-24 22:04:32.0 +
+++ new/kernel/proto.h  2004-07-24 22:04:26.0 +
@@ -77,11 +77,16 @@ long cooked_write(struct dhdr FAR **pdev
 sft FAR *get_sft(UCOUNT);
 
 /* dosfns.c */
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
 const char FAR *get_root(const char FAR *);
 BOOL check_break(void);
 UCOUNT GenericReadSft(sft far * sftp, UCOUNT n, void FAR * bp,
   COUNT * err, BOOL force_binary);
-COUNT SftSeek(int sft_idx, LONG new_pos, COUNT mode);
+COUNT SftSeek(int sft_idx, LONG new_pos, unsigned mode);
 /*COUNT DosRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err); */
 void BinarySftIO(int sft_idx, void *bp, int mode);
 #define BinaryIO(hndl, bp, mode) BinarySftIO(get_sft_idx(hndl), bp, mode)
@@ -101,7 +106,7 @@ BOOL DosGetFree(UBYTE drive, UWORD * spc
 UWORD * bps, UWORD * nc);
 COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s);
 COUNT DosChangeDir(BYTE FAR * s);
-COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name);
+COUNT DosFindFirst(UCOUNT attr, const char FAR * name);
 COUNT DosFindNext(void);
 COUNT DosGetFtime(COUNT hndl, date * dp, time * tp);
 COUNT DosSetFtimeSft(int sft_idx, date dp, time tp);
@@ -374,7 +379,6 @@ void child_psp(seg_t para, seg_t cur_psp
 void return_user(void);
 COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp);
 ULONG SftGetFsize(int sft_idx);
-VOID InitPSP(VOID);
 #ifdef __WATCOMC__
 # pragma aux return_user aborts
 #endif
--- End Message ---


Re: [Freedos-kernel] patch: inthndlr.c fcbfns.c proto.h

2004-07-24 Thread Arkady V.Belousov
Hi!

24-Июл-2004 22:17 Arkady V.Belousov wrote to
[EMAIL PROTECTED]:

AVB> - bugfix: INT21/29: into FcbParseFname() was not passed options from AL.

 Forget to mention: casually :) this bugfix reduces resident code (in
inthndlr.c) by ~50 bytes. :)




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] patch: inthndlr.c fcbfns.c proto.h

2004-07-24 Thread Arkady V.Belousov
Hi!

- bugfix: INT21/29: into FcbParseFname() was not passed options from AL.

--- Begin Message ---
diff -ruNp old/kernel/fcbfns.c new/kernel/fcbfns.c
--- old/kernel/fcbfns.c 2004-05-24 04:42:56.0 +
+++ new/kernel/fcbfns.c 2004-07-24 22:04:40.0 +
@@ -85,7 +85,7 @@ BYTE FAR *FatGetDrvData(UBYTE drive, UWO
 #define PARSE_RET_BADDRIVE  0xff
 
 #ifndef IPL
-UWORD FcbParseFname(int *wTestMode, const BYTE FAR * lpFileName, fcb FAR * lpFcb)
+ofs_t FcbParseFname(UBYTE *wTestMode, const char FAR * lpFileName, fcb FAR * lpFcb)
 {
   WORD wRetCodeName = FALSE, wRetCodeExt = FALSE;
 
@@ -157,7 +157,9 @@ UWORD FcbParseFname(int *wTestMode, cons
 GetNameField(++lpFileName, (BYTE FAR *) lpFcb->fcb_fext,
  FEXT_SIZE, (BOOL *) & wRetCodeExt);
 
-  *wTestMode = (wRetCodeName | wRetCodeExt) ? PARSE_RET_WILD : PARSE_RET_NOWILD;
+  *wTestMode = PARSE_RET_WILD;
+  if (!(wRetCodeName | wRetCodeExt))
+*wTestMode = PARSE_RET_NOWILD;
   return FP_OFF(lpFileName);
 }
 
@@ -539,13 +541,14 @@ UBYTE FcbRename(xfcb FAR * lpXfcb)
 else do
 {
   /* 'A:' + '.' + '\0' */
-  BYTE loc_szBuffer[2 + FNAME_SIZE + 1 + FEXT_SIZE + 1];
+  char loc_szBuffer[2 + FNAME_SIZE + 1 + FEXT_SIZE + 1];
   fcb LocalFcb;
   BYTE *pToName;
   const BYTE FAR *pFromPattern = Dmatch.dm_name;
-  int i = 0;
+  int i;
 
-  FcbParseFname(&i, pFromPattern, &LocalFcb);
+  loc_szBuffer [0] = 0; /* dummy place */
+  FcbParseFname((UBYTE*)loc_szBuffer, pFromPattern, &LocalFcb);
   /* Overlay the pattern, skipping '?'*/
   /* I'm cheating because this assumes that the   */
   /* struct alignments are on byte boundaries */
@@ -691,4 +694,3 @@ UBYTE FcbFindFirstNext(xfcb FAR * lpXfcb
   return FCB_SUCCESS;
 }
 #endif
-
diff -ruNp old/kernel/inthndlr.c new/kernel/inthndlr.c
--- old/kernel/inthndlr.c   2004-07-15 02:16:58.0 +
+++ new/kernel/inthndlr.c   2004-07-24 21:26:42.0 +
@@ -669,9 +662,7 @@ dispatch:
 
   /* Parse File Name  */
 case 0x29:
-  rc = 0;
-  lr.SI = FcbParseFname(&rc, MK_FP(lr.DS, lr.SI), FP_ES_DI);
-  lr.AL = rc;
+  lr.SI = FcbParseFname(&lr.AL, MK_FP(lr.DS, lr.SI), FP_ES_DI);
   break;
 
   /* Get Date */
diff -ruNp old/kernel/proto.h new/kernel/proto.h
--- old/kernel/proto.h  2004-07-08 19:16:58.0 +
+++ new/kernel/proto.h  2004-07-24 22:04:32.0 +
@@ -211,7 +211,7 @@ VOID DosCharOutput(COUNT c);
 VOID DosDisplayOutput(COUNT c);
 BYTE FAR *FatGetDrvData(UBYTE drive, UWORD * spc, UWORD * bps,
UWORD * nc);
-UWORD FcbParseFname(int *wTestMode, const BYTE FAR *lpFileName, fcb FAR * lpFcb);
+ofs_t FcbParseFname(UBYTE *wTestMode, const char FAR * lpFileName, fcb FAR * lpFcb);
 const BYTE FAR *ParseSkipWh(const BYTE FAR * lpFileName);
 BOOL TestCmnSeps(BYTE FAR * lpFileName);
 BOOL TestFieldSeps(BYTE FAR * lpFileName);
--- End Message ---


[Freedos-kernel] Suggestion: original int 10/13/15/19/1b table implementation

2004-07-24 Thread Eric Auer

Hi, should we implement this? -->

MEM 0070h:0100h - DOS 5+ - ORIGINAL INTERRUPT VECTORS 10h,13h,15h,19h,1Bh
Size:   25 BYTEs
Note:   each value is stored as a BYTE for the interrupt number followed by
  a DWORD for the vector
these values are restored on INT 19 by recent versions of
  DR/Novell/PC/MS-DOS (MS-DOS 3.x used this area to support HIMEM.SYS)
not supported by OS/2 MDOS
SeeAlso: MEM 0080h:h,INT 2F/AH=13


I think it would give int 19h based "hotboot" a chance to actually work.
On the other hand, a virus might bypass shields by reading the original
int 13 vector. Still, pro arguments seem to be stronger than con arguments.

PS: 80:0 / size 102 bytes is used for 286 LOADALL opcode emulation, so
some MS DOS 3.x versions leave an empty space here to allow HIMEM to use LOADALL...

Eric



---
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


Re: [Freedos-kernel] Re: Smaller tour of 32bit stuff in kernel, optimize, bugs

2004-07-24 Thread Arkady V.Belousov
Hi!

22-Июл-2004 21:24 [EMAIL PROTECTED] (tom ehlert) wrote to Eric Auer
<[EMAIL PROTECTED]>:

>>> please provide exact code sequence where it DOES return nonsense - and
>>> I'll fix it. (we are talking about ke2035 !!)
>> That translates to: Provide a fix and you will have provided a fix. Helpful.
te> I intended to say (as above, but didn't exactly say it):
te>provide some sort of
te>  mov ax,XXX
te>  mov dx,YYY
te>  int 21h
   -->> misbehaviour  (wrong return value, crash or just reboot)
te>and the cavalry is set into march

 Eric, provide precise scenario for tom. For example:

- "I have unformatted partition, unimportant which size";
- "I run WHICHFAT";
- "I get bla-bla-bla behavior instead bla-bla-bla behavior, as in MS-DOS";
- "WHICHFAT calls bla-bla-bla functions; on output expected bla-bla-bla, but
  received bla-bla-bla".

>>> and it's better not to touch these disks at all.
>> I vote for: Then you better only use the first 2 TB.
te> I vote for: wait till 2TB disks arrive. see. possibly fix bugs.
te> THEN remove this.

 _Sometime_, better to prevent such "bugfixing", especially because CHS
access is only one possible way, how to handle strange geometry, and it is
not the best (even as compromise between LBA and "no disk").

>>> > Track wrap protection and DMA wrap
>>> >   protection should be turned off (maybe add a SYS CONFIG variable!)
>>> >   for harddisks.
te> I measured - it's irrelevant.

 "Irrelevant" = "doesn't changes speed"?




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Strange bug in kernel 2035

2004-07-24 Thread Eduardo Casino
El sáb, 24-07-2004 a las 13:50, Bart Oldeman escribió:

> It's a difficult question. Essentially there are two ways we can go:
> 1. if the kernel very carefully minimizes stack usage on the code path 
>taken and NLSFUNC itself only uses a couple bytes of stack in between 
>it's possible to just do it.
> or
> 2. nlsfunc would have to copy anything in between ss:sp and ss:920
>(_disk_api_tos, that's the top of the stack used here in any DOS >= 
> 4.0) to a temp area (max 384 bytes), set sp to 920, and with that call 
> DOS. Then after the call adjust the stack pointer, then swap it back,
> then return.

Just curious, what about a 3rd possibility: implement the 2f12xx calls
as documented in RBIL? For example, 2f1228: "sets user stack frame
pointer to dummy buffer, moves BP to AX, performs LSEEK, and restores
frame pointer". (This is the "what", my problem is "how" :)

> 2. is probably easiest unless we also like to experiment with 3rd party 
> NSLFUNCs. There may be funny problems I didn't think of but can't 
> think of any though.

NLSFUNC is very specific of each DOS variant. The internal nls
structures are different.

Regards,
Eduardo.



---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Re: Smaller tour of 32bit stuff in kernel, optimize, bugs

2004-07-24 Thread Arkady V.Belousov
Hi!

21-Июл-2004 23:33 [EMAIL PROTECTED] (Eric Auer) wrote to
[EMAIL PROTECTED]:

>> there is no 32/16 and 32%16 compiler support, only 16/16 and 32/32.
>> end of story.
EA> Compiler weakness :-P.

 Caused by language(s) nature (which require to automatically promote
integral types in expressions to common base).




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Strange bug in kernel 2035

2004-07-24 Thread Bart Oldeman
On Sat, 24 Jul 2004, Eduardo Casino wrote:

> Tom, your patch seems to cause some problems (now the wrong DS is passed
> to some nlsfunc calls. It happens with a modified nls.c, I can send you
> the code and the details if you are interested)

If you don't initialize r.ds in a call to intr there is garbage in there.
  r.ds = FP_SEG(&nlsInfo)
is also necessary if you go that route. Using direct assembly DS will just
stay that.

> Now, guys, if you could only give me a hint on how to implement this:
> 
> http://sourceforge.net/mailarchive/message.php?msg_id=8809361

It's a difficult question. Essentially there are two ways we can go:
1. if the kernel very carefully minimizes stack usage on the code path 
   taken and NLSFUNC itself only uses a couple bytes of stack in between 
   it's possible to just do it.
or
2. nlsfunc would have to copy anything in between ss:sp and ss:920
   (_disk_api_tos, that's the top of the stack used here in any DOS >= 
4.0) to a temp area (max 384 bytes), set sp to 920, and with that call 
DOS. Then after the call adjust the stack pointer, then swap it back,
then return.

2. is probably easiest unless we also like to experiment with 3rd party 
NSLFUNCs. There may be funny problems I didn't think of but can't 
think of any though.

> In return, I promise you a tour through the best tapas bars in Madrid
> next time you come. I'll pay the bill, of course! ;-)

Madrid is a long way and a lot warmer than here from what I heard :)
Although 40 C is too hot.

Greetings from Auckland NZ (10 C, but clear skies).
Bart



---
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


Re: [Freedos-kernel] Strange bug in kernel 2035

2004-07-24 Thread Arkady V.Belousov
Hi!

24-Июл-2004 14:37 [EMAIL PROTECTED] (Bart Oldeman) wrote to
[EMAIL PROTECTED]:

BO> apart from the drawbacks there is another problem:
BO>   mov bp, [bp + 20]   ; store id (in SS:) unless it's NULL
BO>   or  bp, bp
BO>   jz  nostore
BO>   mov [bp], bx
BO> nostore:
>>   if (*id)
>>   *id = r.b.x;

[above code from tom's patch, where he tries to replace asm by C code]

BO> The first * in this part is wrong, and also id lives on the stack, but
BO> SS!=DS here (!), see the comments elsewhere in nls.c.

 Line 114:

COUNT muxLoadPkg(UWORD cp, UWORD cntry)
{
  UWORD id; /* on stack, call_nls in int2f.asm takes care of this
 * if DS != SS */

BO> it would need to be
BO> if (id != NULL) /* or if (id) */
BO> poke(_SS, id, r.b.x);

 Yes. Very ugly. :(

BO> returning a "long" (or a struct with two ints, but I'm not sure if all
BO> compilers we use put that in dx:ax)

 BC does, TC does, OW does. Don't know about MSVC, but I doubt that it
doesn't.

BO> would be another way to avoid this, and save a bit of stack space too.

 Hm. You mean, return in DX value of BX instead storing it at *id?




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] patch: int2f.asm

2004-07-24 Thread Arkady V.Belousov
Hi!

- bugfix: (Bart) call_nls: was not preserved DI register.

--- Begin Message ---
diff -ruNp old/kernel/int2f.asm new/kernel/int2f.asm
--- old/kernel/int2f.asm2004-06-26 15:41:34.0 +
+++ new/kernel/int2f.asm2004-07-24 14:40:10.0 +
@@ -411,6 +411,7 @@ _call_nls:
pushbp
mov bp, sp
pushsi
+   pushdi
mov al, [bp + 4]; subfct
mov ah, 0x14
mov si, [bp + 6]; nlsinfo
@@ -427,6 +428,7 @@ _call_nls:
jz  nostore
mov [bp], bx
 nostore:
+   pop di
pop si
pop bp
ret
--- End Message ---


[Freedos-kernel] patch: ioctl.c

2004-07-24 Thread Arkady V.Belousov
Hi!

- (Lucho) fix for ioctl.c.

--- Begin Message ---
diff -ruNp old/kernel/ioctl.c new/kernel/ioctl.c
--- old/kernel/ioctl.c  2004-06-09 23:43:38.0 +
+++ new/kernel/ioctl.c  2004-07-24 14:22:44.0 +
@@ -124,11 +124,20 @@ COUNT DosDevIOctl(lregs * r)
   attr = dev->dh_attr;
   break;
 
+case 0x0d:
+  /* NOTE: CX checked before check if get_dpb()->dpb_device->dh_attr
+ contains ATTR_GENIOCTL bit set
+  */
+  if ((r->CX & ~0x4021) == 0x084A)
+  {/* 084A/484A, 084B/484B, 086A/486A, 086B/486B */
+r->AX = 0; /* (lock/unlock logical/physical volume) */
+return SUCCESS;/* simulate success for MS-DOS 7+ SCANDISK etc. --LG */
+  }
+
 case 0x04:
 case 0x05:
 case 0x08:
 case 0x09:
-case 0x0d:
 case 0x0e:
 case 0x0f:
 case 0x11:
@@ -258,17 +267,10 @@ COUNT DosDevIOctl(lregs * r)
   break;
 }
 
-case 0x0d:
-  if ((r->CX & ~0x4021) == 0x084A)
-  { /* 084A/484A, 084B/484B, 086A/486A, 086B/486B */
-r->AX = 0;  /* (lock/unlock logical/physical volume) */
-break;  /* simulate success for MS-DOS 7+ SCANDISK etc. --LG */
-  }
-  /* fall through */
-
 case 0x04:
 case 0x05:
 case 0x08:
+case 0x0d:
 case 0x11:
 execrequest:
   execrh(&CharReqHdr, dev);
--- End Message ---


[Freedos-kernel] patch: config.b

2004-07-24 Thread Arkady V.Belousov
Hi!

- more comments.

--- Begin Message ---
diff -ruNp old/config.b new/config.b
--- old/config.b2004-07-06 01:00:34.0 +
+++ new/config.b2004-07-24 11:40:46.0 +
@@ -109,6 +109,7 @@ set XUPX=upx --8086 --best
 :---
 :- select default target: CPU type (default is 86) and
 :- what FAT system (default is 32) to support
+:- NOTE: Turbo C doesn't support 386 CPU.
 
 ::set XCPU=86
 ::set XCPU=186
--- End Message ---


Re: [Freedos-kernel] Re: patch: cleanups

2004-07-24 Thread Arkady V.Belousov
Hi!

23-Июл-2004 16:09 [EMAIL PROTECTED] (Eric Auer) wrote to
[EMAIL PROTECTED]:

>>  Well... Changes are arrive and arrive... Do you will upload some
>> archive, which may be downloaded and all your changes may be compared with
>> my tree?
EA> This is EXACTLY what I would want YOU to do!

 I HAVE NO ONLINE and rely on other peoples (like LUCHO) willingness.

EA> It would be great if you,
EA> Arkady, could upload a collection of all patches, plus a big text file
EA> which tells us exactly which patch fixes / changes / optimizes / comments
EA> what,

 All of this is available through Lucho site. As sayed by Lucho, he
include into archive docs/news.txt.




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] bug in kernel 2035ar

2004-07-24 Thread Arkady V.Belousov
Hi!

23-Июл-2004 18:48 [EMAIL PROTECTED] (tom ehlert) wrote to Eduardo Casino
<[EMAIL PROTECTED]>:

te> downloaded ke2035ar.
te> just did what I did for 3 years in a row: copy my old CONFIG.BAT
--^^

 There was changes in config.b. For example, now you may redefine
through config.bat your own LINK and LIB. Of course, you should update your
config.bat.

te> saidc:>BUILD
te> and got Compilation was aborted!
te> congratulations :((




---
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_idG21&alloc_id040&op=click
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] Strange bug in kernel 2035

2004-07-24 Thread Eduardo Casino
Bart Oldeman wrote:

> the fix below fixes your problem as well.

Bart, Tom, thanks to both.

Bart, this works perfectly.

Tom, your patch seems to cause some problems (now the wrong DS is passed
to some nlsfunc calls. It happens with a modified nls.c, I can send you
the code and the details if you are interested)

Now, guys, if you could only give me a hint on how to implement this:

http://sourceforge.net/mailarchive/message.php?msg_id=8809361

In return, I promise you a tour through the best tapas bars in Madrid
next time you come. I'll pay the bill, of course! ;-)

Eduardo.



---
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