Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@197 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-04-16 01:45:26 +00:00
parent be2ae12b54
commit c07675522e
14 changed files with 152 additions and 122 deletions

View File

@ -1,3 +1,12 @@
2001 Apr 16 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes * Thanks to Martin Stromberg for pointing some bugs out:
* more warnings fixed.
* accidentally opened too many file handles at boot time.
* device drivers should not be linked into the device chain
if they do not take up memory.
+ Add * added printf "%S" and "%Fs" to print far strings.
* enabled and cleaned up INT21/AH=6C (extended open/create).
2001 Apr 15 - Build 2023 2001 Apr 15 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk) -------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Tom: + Fixes Tom:

View File

@ -36,6 +36,9 @@ static BYTE *dirmatch_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.3 2000/05/25 20:56:19 jimtabor * Revision 1.3 2000/05/25 20:56:19 jimtabor
* Fixed project history * Fixed project history
* *
@ -98,17 +101,17 @@ typedef struct
struct struct
{ {
UWORD /* directory has been modified */ BITS /* directory has been modified */
f_dmod:1; f_dmod:1;
UWORD /* directory is the root */ BITS /* directory is the root */
f_droot:1; f_droot:1;
UWORD /* fnode is new and needs fill */ BITS /* fnode is new and needs fill */
f_dnew:1; f_dnew:1;
UWORD /* fnode is assigned to dir */ BITS /* fnode is assigned to dir */
f_ddir:1; f_ddir:1;
UWORD /* directory is full */ BITS /* directory is full */
f_dfull:1; f_dfull:1;
UWORD /* filler to avoid a bad bug (feature?) in */ BITS /* filler to avoid a bad bug (feature?) in */
f_filler:11; /* TC 2.01 */ f_filler:11; /* TC 2.01 */
} }
dm_flags; /* file flags */ dm_flags; /* file flags */

View File

@ -36,6 +36,9 @@ static BYTE *error_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.4 2000/11/02 06:56:53 jimtabor * Revision 1.4 2000/11/02 06:56:53 jimtabor
* Fix Share Patch * Fix Share Patch
* *
@ -117,6 +120,8 @@ static BYTE *error_hRcsId = "$Id$";
#define DE_DEADLOCK -36 #define DE_DEADLOCK -36
#define DE_LOCK -39 #define DE_LOCK -39
#define DE_FILEEXISTS -80 /* File exists */
/* Critical error flags */ /* Critical error flags */
#define EFLG_READ 0x00 /* Read error */ #define EFLG_READ 0x00 /* Read error */
#define EFLG_WRITE 0x01 /* Write error */ #define EFLG_WRITE 0x01 /* Write error */

View File

@ -36,6 +36,9 @@ static BYTE *charioRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.6 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.5 2001/04/15 03:21:50 bartoldeman * Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -121,11 +124,11 @@ static BYTE *charioRcsId = "$Id$";
#include "globals.h" #include "globals.h"
#ifdef PROTO #ifdef PROTO
VOID kbfill(keyboard FAR *, UCOUNT, BOOL, UWORD *); static VOID kbfill(keyboard FAR *, UCOUNT, BOOL, UWORD *);
struct dhdr FAR *finddev(UWORD attr_mask); struct dhdr FAR *finddev(UWORD attr_mask);
#else #else
VOID kbfill(); static VOID kbfill();
struct dhdr FAR *finddev(); struct dhdr FAR *finddev();
#endif #endif
@ -147,6 +150,7 @@ struct dhdr FAR *finddev(UWORD attr_mask)
return &nul_dev; return &nul_dev;
} }
#if 0
VOID cso(COUNT c) VOID cso(COUNT c)
{ {
BYTE buf = c; BYTE buf = c;
@ -162,6 +166,7 @@ VOID cso(COUNT c)
if (CharReqHdr.r_status & S_ERROR) if (CharReqHdr.r_status & S_ERROR)
char_error(&CharReqHdr, lpDevice); char_error(&CharReqHdr, lpDevice);
} }
#endif
VOID sto(COUNT c) VOID sto(COUNT c)

View File

@ -40,6 +40,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.18 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.17 2001/04/15 03:21:50 bartoldeman * Revision 1.17 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -381,6 +384,9 @@ INIT void PreConfig(void)
/* Also, run config.sys to load drivers. */ /* Also, run config.sys to load drivers. */
INIT void PostConfig(void) INIT void PostConfig(void)
{ {
/* close all (device) files */
/* Set pass number */ /* Set pass number */
nPass = 2; nPass = 2;
/* compute lastdrive ... */ /* compute lastdrive ... */
@ -1067,6 +1073,8 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
(result=init_device(dhp, pTmp, mode, top))==SUCCESS (result=init_device(dhp, pTmp, mode, top))==SUCCESS
; dhp = next_dhp) ; dhp = next_dhp)
{ {
printf("result=%d\n", result);
next_dhp = dhp->dh_next; next_dhp = dhp->dh_next;
if (FP_SEG(next_dhp) == 0xffff) if (FP_SEG(next_dhp) == 0xffff)
/* Does this ever occur with FP_OFF(next_dhp) != 0xffff ??? */ /* Does this ever occur with FP_OFF(next_dhp) != 0xffff ??? */

View File

@ -32,6 +32,9 @@ static BYTE *dskRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.15 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.14 2001/04/15 03:21:50 bartoldeman * Revision 1.14 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -1008,23 +1011,23 @@ static WORD Genblkdev(rqptr rp)
y = 2; y = 2;
x = 8; /* any odd ball drives return this */ x = 8; /* any odd ball drives return this */
if (miarray[rp->r_unit].mi_size <= 0xffff) if (miarray[rp->r_unit].mi_size <= 0xffff)
switch(miarray[rp->r_unit].mi_size) switch((UWORD)miarray[rp->r_unit].mi_size)
{ {
case 640l: case 640:
case 720l: /* 320-360 */ case 720: /* 320-360 */
x = 0; x = 0;
z = 1; z = 1;
break; break;
case 1440l: /* 720 */ case 1440: /* 720 */
x = 2; x = 2;
break; break;
case 2400l: /* 1.2 */ case 2400: /* 1.2 */
x = 1; x = 1;
break; break;
case 2880l: /* 1.44 */ case 2880: /* 1.44 */
x = 7; x = 7;
break; break;
case 5760l: /* 2.88 almost forgot this one*/ case 5760: /* 2.88 almost forgot this one*/
x = 9; x = 9;
break; break;
} }

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.15 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.14 2001/04/15 03:21:50 bartoldeman * Revision 1.14 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -394,7 +397,6 @@ struct f_node FAR *
*/ */
#ifdef DEBUG #ifdef DEBUG
if (cdsp->cdsFlags & CDSNETWDRV) { if (cdsp->cdsFlags & CDSNETWDRV) {
BYTE FAR *p;
printf("split path called for redirected file: `%s.%s'\n", printf("split path called for redirected file: `%s.%s'\n",
fname, fext); fname, fext);
return (struct f_node FAR *)0; return (struct f_node FAR *)0;

View File

@ -75,6 +75,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.3 2001/04/15 03:21:50 bartoldeman * Revision 1.3 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -116,7 +119,7 @@ extern void FAR *DetectXMSDriver(VOID);
#ifdef DEBUG #ifdef DEBUG
hdump(BYTE FAR *p) VOID hdump(BYTE FAR *p)
{ {
int loop; int loop;
HMAInitPrintf(("%p", p)); HMAInitPrintf(("%p", p));

View File

@ -37,6 +37,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.21 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.20 2001/04/15 03:21:50 bartoldeman * Revision 1.20 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -1639,99 +1642,52 @@ dispatch:
case 0x6a: see case 0x68 case 0x6a: see case 0x68
case 0x6b: dummy func: return AL=0 case 0x6b: dummy func: return AL=0
*/ */
#if 0 /* Extended Open-Creat, not fully functional. (bits 4,5,6 of BH) */
/* Extended Open-Creat, not fully functional.*/
case 0x6c: case 0x6c:
switch(r->DL) { {
case 0x12: COUNT x = 0;
{
COUNT x = 0; if (r->AL != 0 || r->DH != 0 ||
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) >= 0) (r->DL&0x0f) > 0x2 || (r->DL&0xf0) > 0x10)
{
DosClose(rc);
x = 1;
}
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
x += 2;
r->CX = x;
r->AX = rc;
CLEAR_CARRY_FLAG();
}
}
break;
case 0x10:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) >= 0)
{
DosClose(rc);
r->AX = 80;
r->FLAGS |= FLG_CARRY;
}
else
{
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
r->CX = 0x02;
r->AX = rc;
CLEAR_CARRY_FLAG();
}
}
break;
case 0x02:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) < 0)
goto error_exit;
DosClose(rc);
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
r->CX = 0x03;
r->AX = rc;
CLEAR_CARRY_FLAG();
}
break;
case 0x11:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), 0)) >= 0)
{
r->CX = 0x01;
r->AX = rc;
CLEAR_CARRY_FLAG();
}
else{
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
goto error_exit;
else
{
r->CX = 0x02;
r->AX = rc;
CLEAR_CARRY_FLAG();
}
}
break;
case 0x01:
if ((rc = DosOpen(MK_FP(r->DS, r->SI), r->BL )) < 0 )
goto error_exit;
else
{
r->CX = 0x01;
r->AX = rc;
CLEAR_CARRY_FLAG();
}
break;
default:
goto error_invalid; goto error_invalid;
} CLEAR_CARRY_FLAG();
if ((rc = DosOpen(MK_FP(r->DS, r->SI),
(r->DL&0x0f) == 0x1 ? r->BL : 0)) < 0)
{
if (r->DL < 0x10)
goto error_exit;
/* else try to create below */
}
else switch (r->DL & 0x0f)
{
case 0x0:
/* fail if file exists */
DosClose(rc);
rc = DE_FILEEXISTS;
goto error_exit;
case 0x1:
/* file exists and opened: OK */
r->CX = 0x01;
goto break_out;
case 0x2:
/* file exists: replace/open */
DosClose(rc);
x = 1;
break;
}
/* cases 0x00, 0x01 are finished now */
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX)) < 0)
goto error_exit;
r->CX = x+2;
break_out:
r->AX = rc;
break;
}
/* case 0x6d and above not implemented : see default; return AL=0 */ /* case 0x6d and above not implemented : see default; return AL=0 */
#endif
} }
#ifdef DEBUG #ifdef DEBUG

View File

@ -38,6 +38,9 @@ static BYTE *mainRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.14 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.13 2001/04/15 03:21:50 bartoldeman * Revision 1.13 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -312,6 +315,11 @@ INIT void init_kernel(void)
#ifndef KDB #ifndef KDB
/* Now process CONFIG.SYS */ /* Now process CONFIG.SYS */
DoConfig(); DoConfig();
/* Close all (device) files */
for (i = 0; i < lastdrive; i++)
init_DosClose(i);
/* and do final buffer allocation. */ /* and do final buffer allocation. */
PostConfig(); PostConfig();
nblkdev = 0; nblkdev = 0;
@ -324,6 +332,10 @@ INIT void init_kernel(void)
DoConfig(); DoConfig();
configDone(); configDone();
/* Close all (device) files */
for (i = 0; i < lastdrive; i++)
init_DosClose(i);
/* Now config the final file system */ /* Now config the final file system */
FsConfig(); FsConfig();
@ -351,7 +363,6 @@ INIT VOID FsConfig(VOID)
sfthead->sftt_count = Config.cfgFiles; sfthead->sftt_count = Config.cfgFiles;
for (i = 0; i < sfthead->sftt_count; i++) for (i = 0; i < sfthead->sftt_count; i++)
{ {
init_DosClose(i);
sfthead->sftt_table[i].sft_count = 0; sfthead->sftt_table[i].sft_count = 0;
sfthead->sftt_table[i].sft_status = -1; sfthead->sftt_table[i].sft_status = -1;
} }
@ -516,10 +527,21 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
if(cmdLine){ if(cmdLine){
if (mode) if (mode)
{
/* Don't link in device drivers which do not take up memory */
if (rq.r_endaddr == (BYTE FAR *)dhp)
return TRUE;
else
upBase = rq.r_endaddr; upBase = rq.r_endaddr;
}
else else
{
if (rq.r_endaddr == (BYTE FAR *)dhp)
return TRUE;
else
lpBase = rq.r_endaddr; lpBase = rq.r_endaddr;
} }
}
if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) { if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) {
dhp->dh_name[0] = rq.r_nunits; dhp->dh_name[0] = rq.r_nunits;

View File

@ -35,6 +35,9 @@ static BYTE *memmgrRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.13 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.12 2001/04/15 03:21:50 bartoldeman * Revision 1.12 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -612,7 +615,7 @@ COUNT DosGetLargestBlock(UWORD FAR * block)
#ifdef DEBUG #ifdef DEBUG
VOID show_chain(void) VOID show_chain(void)
{ {
mcb FAR *p, FAR *u; mcb FAR *p;
p = para2far(first_mcb); p = para2far(first_mcb);
for (;;) for (;;)

View File

@ -28,7 +28,7 @@
#include "portab.h" #include "portab.h"
COUNT strlen (BYTE * s); /* don't want globals.h, sorry */ COUNT fstrlen (BYTE FAR * s); /* don't want globals.h, sorry */
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
@ -37,6 +37,9 @@ static BYTE *prfRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.7 2001/04/15 03:21:50 bartoldeman * Revision 1.7 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -50,6 +53,9 @@ static BYTE *prfRcsId = "$Id$";
* recoded for smaller object footprint, added main() for testing+QA * recoded for smaller object footprint, added main() for testing+QA
* *
* $Log$ * $Log$
* Revision 1.8 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.7 2001/04/15 03:21:50 bartoldeman * Revision 1.7 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -224,7 +230,7 @@ COUNT
{ {
int base; int base;
BYTE s[11], BYTE s[11],
*p; FAR *p;
int c, int c,
flag, flag,
size, size,
@ -303,8 +309,15 @@ COUNT
} }
case 's': case 's':
p = *((BYTE **) arg)++; p = *((BYTE **) arg)++;
goto do_outputstring; goto do_outputstring;
case 'F':
fmt++;
/* we assume %Fs here */
case 'S':
p = *((BYTE FAR **) arg)++;
goto do_outputstring;
case 'd': case 'd':
base = -10; base = -10;
@ -334,7 +347,7 @@ COUNT
p = s; p = s;
do_outputstring: do_outputstring:
size -= strlen(p); size -= fstrlen(p);
if (flag == RIGHT ) if (flag == RIGHT )
{ {

View File

@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.14 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.13 2001/04/15 03:21:50 bartoldeman * Revision 1.13 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -180,7 +183,7 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
/* *** End of change /* *** End of change
/* chario.c */ /* chario.c */
VOID cso(COUNT c); /* VOID cso(COUNT c);*/
VOID sto(COUNT c); VOID sto(COUNT c);
VOID mod_sto(REG UCOUNT c); VOID mod_sto(REG UCOUNT c);
VOID destr_bs(void); VOID destr_bs(void);

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.11 2001/04/16 01:45:26 bartoldeman
* Fixed handles, config.sys drivers, warnings. Enabled INT21/AH=6C, printf %S/%Fs
*
* Revision 1.10 2001/04/15 03:21:50 bartoldeman * Revision 1.10 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes. * See history.txt for the list of fixes.
* *
@ -783,15 +786,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
asize = exe_size; asize = exe_size;
#ifdef DEBUG #ifdef DEBUG
{ COUNT i = 0; printf("loading '%S' at %04x\n", namep, mem);
printf("loading '");
while (namep[i]!=0)
{
cso(namep[i]);
i++;
}
printf("' at %04x\n", mem);
}
#endif #endif
/* /// Added open curly brace and "else" clause. We should not attempt /* /// Added open curly brace and "else" clause. We should not attempt