just comments and additional debug messages, updated history (little reformating)

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1103 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Kenneth J Davis 2005-01-29 20:33:11 +00:00
parent 0bf49a24b7
commit a56552c0f5
12 changed files with 178 additions and 43 deletions

View File

@ -1,12 +1,14 @@
2004 July 8 - UNSTABLE branch 2005 Jan XX - UNSTABLE (-w) branch
-------- Jeremy Davis (jeremyd@computer.org) -------- Jeremy Davis (jeremyd@computer.org)
+ Changes Bart + Changes Bart
* int2f.asm
- bugfix: call_nls: DI register was not preserved
* exeflat.c * exeflat.c
- new version exploiting better UPX compression for SYS files; calls UPX itself - new version exploiting better UPX compression for SYS files; calls UPX itself
* int2f.asm
- bugfix: call_nls: DI register was not preserved
* inthndlr.c * inthndlr.c
- int21/ah=6/dl=ff now calls int28 - int21/ah=6/dl=ff now calls int28
* sys.c
- correct fat32readwrite's prototype to explicitly return int
+ Changes Tom + Changes Tom
* inthndlr.c * inthndlr.c
- improve handling of case where eg. FindFirst(I:\*.*) fails, causes Int24, - improve handling of case where eg. FindFirst(I:\*.*) fails, causes Int24,
@ -316,7 +318,7 @@
(the last 2 changes needed to fix bugs discovered by Michael Devore) (the last 2 changes needed to fix bugs discovered by Michael Devore)
- added Int 2Fh/2Fh processing to set DOS version as per MS-DOS 4.0 - added Int 2Fh/2Fh processing to set DOS version as per MS-DOS 4.0
- optimised Int 21h/AH=38h Get Country Information, removed cntry hack - optimised Int 21h/AH=38h Get Country Information, removed cntry hack
* autoexec.bat now single-line for FreeCOM compatibility when EOL=LF * autoexec.bat: now single-line for FreeCOM compatibility when EOL=LF
* break.c: check_handle_break() return was undefined if no Ctrl-break * break.c: check_handle_break() return was undefined if no Ctrl-break
* config.sys: all commands removed as they were close to defaults * config.sys: all commands removed as they were close to defaults
* contrib.txt: added Aitor Santamaria, Bernd Blaauw and Eduardo Casino * contrib.txt: added Aitor Santamaria, Bernd Blaauw and Eduardo Casino
@ -330,16 +332,16 @@
- optimisation and clean-up - optimisation and clean-up
* fattab.c: ISFAT32 function removed (now macro), "wasfree" optimised * fattab.c: ISFAT32 function removed (now macro), "wasfree" optimised
* globals.h: __TIME__ removed - no two kernels released on same day * globals.h: __TIME__ removed - no two kernels released on same day
* initdisk.c: * initdisk.c
- if no floppy drives present, don't initialise DDT for drive A: - if no floppy drives present, don't initialise DDT for drive A:
- " - Initdisk" no longer shifts text if no FAT partitions found - " - Initdisk" no longer shifts text if no FAT partitions found
- converted cdiv() from macro to function; optimise and clean-up - converted cdiv() from macro to function; optimise and clean-up
* inithma: InstallVDISK() function inlined, optimised and cleaned up * inithma: InstallVDISK() function inlined, optimised and cleaned up
* intr.asm: lseek() added (necessary for COUNTRY.SYS processing) * intr.asm: lseek() added (necessary for COUNTRY.SYS processing)
* ioctl.c: * ioctl.c
- r_si/r_di contents added as documented in PC-DOS Technical Update - r_si/r_di contents added as documented in PC-DOS Technical Update
- r_unit now set to dpb_subunit (allows ZIP disk serial number) - r_unit now set to dpb_subunit (allows ZIP disk serial number)
* main.c: * main.c
- copyright message cleanup, now shows URL for the full GNU GPL text - copyright message cleanup, now shows URL for the full GNU GPL text
- (with Bart) LoL pointer made const (saves some size for Watcom) - (with Bart) LoL pointer made const (saves some size for Watcom)
- InitializeAllBPBs() kludge removed (no longer needed - verified) - InitializeAllBPBs() kludge removed (no longer needed - verified)
@ -353,7 +355,7 @@
+ Changes Eduardo + Changes Eduardo
* config.c: update hardcoded country and codepage IDs * config.c: update hardcoded country and codepage IDs
* country.asm: added NLS uppercase/collating tables (437,850,857,858) * country.asm: added NLS uppercase/collating tables (437,850,857,858)
* inthndlr.c: * inthndlr.c
- added Int 2Fh/26-29h processing for NLSFUNC (with Lucho) - added Int 2Fh/26-29h processing for NLSFUNC (with Lucho)
- DOS-63-00 returns DBCS table from the active NLS package, not the - DOS-63-00 returns DBCS table from the active NLS package, not the
harcoded one. harcoded one.
@ -368,27 +370,44 @@
- DosYesNo(): arg is now UWORD, not unsigned char. - DosYesNo(): arg is now UWORD, not unsigned char.
- nlsYesNo(): Add DBCS support - nlsYesNo(): Add DBCS support
- syscall_MUX14(): arg of nlsYesNo() is now CX instead of CL. - syscall_MUX14(): arg of nlsYesNo() is now CX instead of CL.
* nls.h: * nls.h
- yeschar and nochar are now UWORD instead of UBYTE. - yeschar and nochar are now UWORD instead of UBYTE.
- NLS_FREEDOS_NLSFUNC_VERSION bumped to 0xFD02. - NLS_FREEDOS_NLSFUNC_VERSION bumped to 0xFD02.
- Add a small comment. - Add a small comment.
* nls_hc.asm: YesChar and NoChar are now two bytes each. * nls_hc.asm: YesChar and NoChar are now two bytes each.
* proto.h: * proto.h
- DosYesNo(): Argument is now UWORD (dual byte) - DosYesNo(): Argument is now UWORD (dual byte)
- Add prototype for DosGetDBCS() - Add prototype for DosGetDBCS()
+ Changes Jeremy + Changes Jeremy
* config.txt * updated build system to use NT OW binaries when building on NT
- update to include all CONFIG.SYS options (except ANYDOS) and add some additional options to build.bat command line
* added debug.h and changed to more easily allow selective DEBUG output
* boot.asm * boot.asm
- use static read buffer to avoid crossing 64KB boundary - use static read buffer to avoid crossing 64KB boundary
- drop test for drive==0xFF, use sys to NOP use of BIOS provided #
* config.c
- always initialize boot time master environment
- KernelAlloc always 0's returned memory (fixes potential boot
time failure finding/loading CONFIG.SYS)
* config.txt
- update to include all CONFIG.SYS options (except ANYDOS)
* exeflat.c
- show usage also when number of arguments incorrect
* fatdir.c
- be more restrictive in what considered a volume search
* initdisk.c
- set hidden & huge fields in floppy bpb (bugfix 1789)
* main.c * main.c
- treat block devices returning 0 units as load failure - treat block devices returning 0 units as load failure
* oemboot.asm - add [optional] PC/MS DOS compatible boot sector * oemboot.asm - add [optional] PC/MS DOS compatible boot sector
* sys.c * sys.c
- incorporate changes from/for DR-DOS enhancement project - incorporate changes from/for DR-DOS enhancement project
- rework option handling, add backup & restore boot sector - rework option handling, add backup & restore boot sector
* exeflat.c - change boot time drive selection (BIOS provided or one in
- show usage also when number of arguments incorrect boot sector) to be selected as SYS time via NOPing mov [drive],dl
* add sys.txt (documentation) and sys.html (htmlhelp file)
* task.c
- add debug output to see env & cmd line passed to exec'd program
< many other changes to be added by Jeremy himself :-> < many other changes to be added by Jeremy himself :->
*** Sync - Stable Build 2035 *** *** Sync - Stable Build 2035 ***

View File

@ -55,6 +55,13 @@
/* show stored IRQ vectors */ /* show stored IRQ vectors */
/* #define DEBUGIRQ */ /* #define DEBUGIRQ */
/* show output related to moving kernel into HMA */
#ifdef DEBUG
#define HMAInitPrintf(x) printf x
#else
#define HMAInitPrintf(x)
#endif
/* display output during kernel config processing phase */ /* display output during kernel config processing phase */
/* #define DEBUGCFG */ /* #define DEBUGCFG */
#ifdef DEBUGCFG #ifdef DEBUGCFG

View File

@ -26,7 +26,8 @@
/* Boston, MA 02111-1307 USA. */ /* Boston, MA 02111-1307 USA. */
/****************************************************************/ /****************************************************************/
enum {LOC_CONV=0, LOC_HMA=1}; #ifndef __LOL_H
#define __LOL_H
/* note: we start at DOSDS:0, but the "official" list of lists starts a /* note: we start at DOSDS:0, but the "official" list of lists starts a
little later at DOSDS:26 (this is what is returned by int21/ah=52) */ little later at DOSDS:26 (this is what is returned by int21/ah=52) */
@ -84,3 +85,5 @@ struct lol {
unsigned short f_nodes_cnt; /* 74 number of allocated f_nodes */ unsigned short f_nodes_cnt; /* 74 number of allocated f_nodes */
char *os_release; /* 76 near pointer to os_release string */ char *os_release; /* 76 near pointer to os_release string */
}; };
#endif /* __LOL_H */

View File

@ -27,6 +27,7 @@
/****************************************************************/ /****************************************************************/
#include "portab.h" #include "portab.h"
#include "debug.h"
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *dosfnsRcsId = static BYTE *dosfnsRcsId =
@ -504,11 +505,19 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
result = truename(fname, PriPathName, CDS_MODE_CHECK_DEV_PATH); result = truename(fname, PriPathName, CDS_MODE_CHECK_DEV_PATH);
if (result < SUCCESS) if (result < SUCCESS)
{
DFnsDbgPrintf(("DosOpenSft: truename failed\n"));
return result; return result;
}
else DFnsDbgPrintf(("DosOpenSft: truename succeeded\n"));
/* now get a free system file table entry */ /* now get a free system file table entry */
if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1) if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1)
{
DFnsDbgPrintf(("DosOpenSft: file table full\n"));
return DE_TOOMANY; return DE_TOOMANY;
}
else DFnsDbgPrintf(("DosOpenSft: obtained sft entry\n"));
fmemset(sftp, 0, sizeof(sft)); fmemset(sftp, 0, sizeof(sft));
@ -519,10 +528,14 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */ sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
sftp->sft_attrib = attrib = attrib | D_ARCHIVE; sftp->sft_attrib = attrib = attrib | D_ARCHIVE;
DFnsDbgPrintf(("DosOpenSft: mode=%02X, flags=%02X, attrib=%02X\n", \
sftp->sft_mode, OpenMode, attrib));
if (result & IS_NETWORK) if (result & IS_NETWORK)
{ {
int status; int status;
unsigned cmd; unsigned cmd;
DFnsDbgPrintf(("DosOpenSft: IS_NETWORK\n"));
if ((flags & (O_TRUNC | O_CREAT)) == O_CREAT) if ((flags & (O_TRUNC | O_CREAT)) == O_CREAT)
attrib |= 0x100; attrib |= 0x100;
@ -558,6 +571,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
/* check the status code returned by the /* check the status code returned by the
* driver when we tried to open it * driver when we tried to open it
*/ */
DFnsDbgPrintf(("DosOpenSft: IS_DEVICE\n"));
if (rc < SUCCESS) if (rc < SUCCESS)
return rc; return rc;
return sft_idx; return sft_idx;
@ -566,6 +580,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
/* /// Added for SHARE. - Ron Cemer */ /* /// Added for SHARE. - Ron Cemer */
if (IsShareInstalled()) if (IsShareInstalled())
{ {
DFnsDbgPrintf(("DosOpenSft: using SHARE\n"));
if ((sftp->sft_shroff = if ((sftp->sft_shroff =
share_open_check(PriPathName, cu_psp, share_open_check(PriPathName, cu_psp,
flags & 0x03, (flags >> 4) & 0x07)) < 0) flags & 0x03, (flags >> 4) & 0x07)) < 0)
@ -578,9 +593,13 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
/* ... though FCB's are weird :) */ /* ... though FCB's are weird :) */
if (!(flags & O_FCB) && if (!(flags & O_FCB) &&
(attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE | D_VOLID))) (attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE | D_VOLID)))
{
DFnsDbgPrintf(("DosOpenSft: invalid request\n"));
return DE_ACCESS; return DE_ACCESS;
}
result = dos_open(PriPathName, flags, attrib); result = dos_open(PriPathName, flags, attrib);
DFnsDbgPrintf(("DosOpenSft: dos_open returned %02X\n", result));
if (result >= 0) if (result >= 0)
{ {
int status = (int)(result >> 16); int status = (int)(result >> 16);
@ -591,6 +610,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
(do not allow to open volume labels/directories) */ (do not allow to open volume labels/directories) */
if (sftp->sft_attrib & (D_DIR | D_VOLID)) if (sftp->sft_attrib & (D_DIR | D_VOLID))
{ {
DFnsDbgPrintf(("DosOpenSft: closing, invalid attributes DIR|VOLID\n"));
dos_close((COUNT)result); dos_close((COUNT)result);
return DE_ACCESS; return DE_ACCESS;
} }
@ -603,6 +623,7 @@ long DosOpenSft(char FAR * fname, unsigned flags, unsigned attrib)
dos_getftime(sftp->sft_status, dos_getftime(sftp->sft_status,
(date FAR *) & sftp->sft_date, (date FAR *) & sftp->sft_date,
(time FAR *) & sftp->sft_time); (time FAR *) & sftp->sft_time);
DFnsDbgPrintf(("DosOpenSft: returning %lu (decimal)\n", (sft_idx | ((long)status << 16))));
return sft_idx | ((long)status << 16); return sft_idx | ((long)status << 16);
} }
else else
@ -944,7 +965,6 @@ COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
return SUCCESS; return SUCCESS;
} }
#undef CHDIR_DEBUG
COUNT DosChangeDir(BYTE FAR * s) COUNT DosChangeDir(BYTE FAR * s)
{ {
COUNT result; COUNT result;

View File

@ -38,12 +38,7 @@ additionally:
#include "portab.h" #include "portab.h"
#include "init-mod.h" #include "init-mod.h"
#include "dyndata.h" #include "dyndata.h"
#include "debug.h"
#if defined(DEBUG)
#define DebugPrintf(x) printf x
#else
#define DebugPrintf(x)
#endif
/*extern struct DynS FAR Dyn;*/ /*extern struct DynS FAR Dyn;*/

View File

@ -29,6 +29,7 @@
#include "portab.h" #include "portab.h"
#include "globals.h" #include "globals.h"
#include "debug.h"
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *fatdirRcsId = static BYTE *fatdirRcsId =
@ -62,9 +63,12 @@ f_node_ptr dir_open(register const char *dirname)
int i; int i;
char fcbname[FNAME_SIZE + FEXT_SIZE]; char fcbname[FNAME_SIZE + FEXT_SIZE];
FDirDbgPrintf(("dir_open: trying to open %s\n", dirname));
/* Allocate an fnode if possible - error return (0) if not. */ /* Allocate an fnode if possible - error return (0) if not. */
if ((fnp = get_f_node()) == (f_node_ptr) 0) if ((fnp = get_f_node()) == (f_node_ptr) 0)
{ {
FDirDbgPrintf(("dir_open: failed to get f_node\n"));
return (f_node_ptr) 0; return (f_node_ptr) 0;
} }
@ -78,6 +82,7 @@ f_node_ptr dir_open(register const char *dirname)
if (media_check(fnp->f_dpb) < 0) if (media_check(fnp->f_dpb) < 0)
{ {
FDirDbgPrintf(("dir_open: media_check failed\n"));
release_f_node(fnp); release_f_node(fnp);
return (f_node_ptr) 0; return (f_node_ptr) 0;
} }
@ -136,6 +141,7 @@ f_node_ptr dir_open(register const char *dirname)
if (!i || !(fnp->f_dir.dir_attrib & D_DIR)) if (!i || !(fnp->f_dir.dir_attrib & D_DIR))
{ {
FDirDbgPrintf(("dir_open: no match found, returning failure\n"));
release_f_node(fnp); release_f_node(fnp);
return (f_node_ptr) 0; return (f_node_ptr) 0;
} }
@ -146,6 +152,7 @@ f_node_ptr dir_open(register const char *dirname)
dir_init_fnode(fnp, getdstart(fnp->f_dpb, &fnp->f_dir)); dir_init_fnode(fnp, getdstart(fnp->f_dpb, &fnp->f_dir));
} }
} }
FDirDbgPrintf(("dir_open: returning, ok\n"));
return fnp; return fnp;
} }
@ -188,7 +195,10 @@ COUNT dir_read(REG f_node_ptr fnp)
/* can't have more than 65535 directory entries */ /* can't have more than 65535 directory entries */
if (fnp->f_diroff >= 65535U) if (fnp->f_diroff >= 65535U)
{
FDirDbgPrintf(("dir_read: exceed dir entry count\n"));
return DE_SEEK; return DE_SEEK;
}
/* Determine if we hit the end of the directory. If we have, */ /* Determine if we hit the end of the directory. If we have, */
/* bump the offset back to the end and exit. If not, fill the */ /* bump the offset back to the end and exit. If not, fill the */
@ -198,7 +208,10 @@ COUNT dir_read(REG f_node_ptr fnp)
if (fnp->f_dirstart == 0) if (fnp->f_dirstart == 0)
{ {
if (fnp->f_diroff >= fnp->f_dpb->dpb_dirents) if (fnp->f_diroff >= fnp->f_dpb->dpb_dirents)
{
FDirDbgPrintf(("dir_read: end of dir\n"));
return DE_SEEK; return DE_SEEK;
}
bp = getblock(fnp->f_diroff / (secsize / DIRENT_SIZE) bp = getblock(fnp->f_diroff / (secsize / DIRENT_SIZE)
+ fnp->f_dpb->dpb_dirstrt, fnp->f_dpb->dpb_unit); + fnp->f_dpb->dpb_dirstrt, fnp->f_dpb->dpb_unit);
@ -217,7 +230,10 @@ COUNT dir_read(REG f_node_ptr fnp)
printf("dir_read: "); printf("dir_read: ");
#endif #endif
if (map_cluster(fnp, XFR_READ) != SUCCESS) if (map_cluster(fnp, XFR_READ) != SUCCESS)
{
DebugPrintf(("dir_read: map_cluster failed\n"));
return DE_SEEK; return DE_SEEK;
}
bp = getblock_from_off(fnp, secsize); bp = getblock_from_off(fnp, secsize);
#ifdef DISPLAY_GETBLOCK #ifdef DISPLAY_GETBLOCK
@ -228,7 +244,10 @@ COUNT dir_read(REG f_node_ptr fnp)
/* Now that we have the block for our entry, get the */ /* Now that we have the block for our entry, get the */
/* directory entry. */ /* directory entry. */
if (bp == NULL) if (bp == NULL)
{
FDirDbgPrintf(("dir_read: invalid block\n"));
return DE_BLKINVLD; return DE_BLKINVLD;
}
bp->b_flag &= ~(BFR_DATA | BFR_FAT); bp->b_flag &= ~(BFR_DATA | BFR_FAT);
bp->b_flag |= BFR_DIR | BFR_VALID; bp->b_flag |= BFR_DIR | BFR_VALID;
@ -245,6 +264,7 @@ COUNT dir_read(REG f_node_ptr fnp)
/* and for efficiency, stop when we hit the first */ /* and for efficiency, stop when we hit the first */
/* unused entry. */ /* unused entry. */
/* either returns 1 or 0 */ /* either returns 1 or 0 */
FDirDbgPrintf(("dir_read: dir_name is %11s\n", fnp->f_dir.dir_name));
return (fnp->f_dir.dir_name[0] != '\0'); return (fnp->f_dir.dir_name[0] != '\0');
} }
@ -423,9 +443,8 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name)
{ {
dmp->dm_dircluster = fnp->f_dirstart; /* TE */ dmp->dm_dircluster = fnp->f_dirstart; /* TE */
memcpy(&SearchDir, &fnp->f_dir, sizeof(struct dirent)); memcpy(&SearchDir, &fnp->f_dir, sizeof(struct dirent));
#ifdef DEBUG FDirDbgPrintf(("dos_findfirst: %11s\n", fnp->f_dir.dir_name));
printf("dos_findfirst: %11s\n", fnp->f_dir.dir_name);
#endif
dir_close(fnp); dir_close(fnp);
return SUCCESS; return SUCCESS;
} }
@ -511,9 +530,7 @@ COUNT dos_findnext(void)
return SUCCESS; return SUCCESS;
} }
} }
#ifdef DEBUG FDirDbgPrintf(("dos_findnext: %11s\n", fnp->f_dir.dir_name));
printf("dos_findnext: %11s\n", fnp->f_dir.dir_name);
#endif
/* return the result */ /* return the result */
release_f_node(fnp); release_f_node(fnp);

View File

@ -29,6 +29,7 @@
#include "portab.h" #include "portab.h"
#include "globals.h" #include "globals.h"
#include "debug.h"
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
BYTE *RcsId = "$Id$"; BYTE *RcsId = "$Id$";
@ -142,12 +143,16 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
/* next, split the passed dir into components (i.e. - path to */ /* next, split the passed dir into components (i.e. - path to */
/* new directory and name of new directory. */ /* new directory and name of new directory. */
if ((fnp = split_path(path, fcbname)) == NULL) if ((fnp = split_path(path, fcbname)) == NULL)
{
FatFSDbgPrintf(("dos_open: splitpath(\"%s\", \"%11s\") failed.\n", path, fcbname));
return DE_PATHNOTFND; return DE_PATHNOTFND;
}
/* Check that we don't have a duplicate name, so if we */ /* Check that we don't have a duplicate name, so if we */
/* find one, truncate it (O_CREAT). */ /* find one, truncate it (O_CREAT). */
if (find_fname(fnp, fcbname, D_ALL | attrib)) if (find_fname(fnp, fcbname, D_ALL | attrib))
{ {
FatFSDbgPrintf(("dos_open: filename match found\n"));
if (flags & O_TRUNC) if (flags & O_TRUNC)
{ {
/* The only permissable attribute is archive, */ /* The only permissable attribute is archive, */
@ -189,6 +194,7 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
else if (flags & O_CREAT) else if (flags & O_CREAT)
{ {
int ret = alloc_find_free(fnp, path, fcbname); int ret = alloc_find_free(fnp, path, fcbname);
FatFSDbgPrintf(("dos_open: create\n"));
if (ret != SUCCESS) if (ret != SUCCESS)
return ret; return ret;
status = S_CREATED; status = S_CREATED;
@ -198,6 +204,7 @@ long dos_open(char *path, unsigned flags, unsigned attrib)
/* open: If we can't find the file, just return a not */ /* open: If we can't find the file, just return a not */
/* found error. */ /* found error. */
dir_close(fnp); dir_close(fnp);
FatFSDbgPrintf(("dos_open: file not found\n"));
return DE_FILENOTFND; return DE_FILENOTFND;
} }
@ -312,6 +319,8 @@ f_node_ptr split_path(char * path, char * fcbname)
/* Start off by parsing out the components. */ /* Start off by parsing out the components. */
int dirlength = ParseDosName(path, fcbname, FALSE); int dirlength = ParseDosName(path, fcbname, FALSE);
FatFSDbgPrintf(("split_path: dirlen=%i, path=\"%s\", fcbname=\"%11s\"\n", \
dirlength, path, fcbname));
if (dirlength < SUCCESS) if (dirlength < SUCCESS)
return (f_node_ptr) 0; return (f_node_ptr) 0;
@ -330,7 +339,7 @@ f_node_ptr split_path(char * path, char * fcbname)
#ifdef DEBUG #ifdef DEBUG
if (get_cds(path[0]-'A')->cdsFlags & CDSNETWDRV) if (get_cds(path[0]-'A')->cdsFlags & CDSNETWDRV)
{ {
printf("split path called for redirected file: `%s'\n", printf("split path called for redirected file: `%11s'\n",
fcbname); fcbname);
return (f_node_ptr) 0; return (f_node_ptr) 0;
} }
@ -349,10 +358,14 @@ f_node_ptr split_path(char * path, char * fcbname)
/* note: an invalid fd is indicated by a 0 return */ /* note: an invalid fd is indicated by a 0 return */
if (fnp == (f_node_ptr) 0 || fnp->f_count <= 0) if (fnp == (f_node_ptr) 0 || fnp->f_count <= 0)
{ {
FatFSDbgPrintf(("split_path: failing, fnp is %sNULL, f_count=%i\n", \
(fnp==(f_node_ptr)0)?"":"NOT", \
(fnp==(f_node_ptr)0)?123:fnp->f_count));
dir_close(fnp); dir_close(fnp);
return (f_node_ptr) 0; return (f_node_ptr) 0;
} }
FatFSDbgPrintf(("split_path: success\n"));
return fnp; return fnp;
} }
@ -1817,18 +1830,18 @@ int dos_cd(char * PathName)
/* try to allocate a near f_node */ /* try to allocate a near f_node */
/* (there are just two of them, in the SDA) */ /* (there are just two of them, in the SDA) */
f_node_ptr get_near_f_node(void) f_node_ptr get_near_f_node(void)
{ {
f_node_ptr fnp = fnode; f_node_ptr fnp = fnode;
DebugPrintf(("get_near_f_node: fnp is %p\n", fnp));
if (fnp->f_count && (++fnp)->f_count) if (fnp->f_count && (++fnp)->f_count)
panic("more than two near fnodes requested at the same time!\n"); panic("more than two near fnodes requested at the same time!\n");
fnp->f_count++; fnp->f_count++;
DebugPrintf(("got near fnode, fnp->f_count=%i\n", fnp->f_count));
return fnp; return fnp;
} }
/* Try to allocate an f_node from the available files array */ /* Try to allocate an f_node from the available files array */
f_node_ptr get_f_node(void) f_node_ptr get_f_node(void)
{ {
REG int i; REG int i;
@ -1836,17 +1849,22 @@ f_node_ptr get_f_node(void)
if (fnp != (f_node_ptr)0) if (fnp != (f_node_ptr)0)
{ {
FatFSDbgPrintf(("get_f_node: &f_nodes[0]=%p, f_nodes_cnt=%i\n", (void far *)&f_nodes, f_nodes_cnt));
for (i = 0; i < f_nodes_cnt; i++) for (i = 0; i < f_nodes_cnt; i++)
{ {
if (f_nodes[i].f_count == 0) if (f_nodes[i].f_count == 0)
{ {
++f_nodes[i].f_count; ++f_nodes[i].f_count;
fnode_fd[fnp - fnode] = i; fnode_fd[fnp - fnode] = i;
FatFSDbgPrintf(("f_nodes[%i].f_count=%i, fnode_fd[%i]=%i\n", \
i, f_nodes[i].f_count, (fnp-fnode), i));
return fnp; return fnp;
} }
} }
release_near_f_node(fnp); release_near_f_node(fnp);
FatFSDbgPrintf(("get_f_node: failure finding free entry in f_nodes[]\n"));
} }
else FatFSDbgPrintf(("get_f_node: get_near_fnode() failed, returned NULL\n"));
return (f_node_ptr) 0; return (f_node_ptr) 0;
} }
@ -1854,6 +1872,8 @@ VOID release_f_node(f_node_ptr fnp)
{ {
struct f_node FAR *fp = &f_nodes[xlt_fnp(fnp)]; struct f_node FAR *fp = &f_nodes[xlt_fnp(fnp)];
FatFSDbgPrintf(("release_f_node: fp->f_count=%i\n", fp->f_count));
if (fp->f_count > 0) if (fp->f_count > 0)
--fp->f_count; --fp->f_count;
else else
@ -2048,28 +2068,37 @@ COUNT media_check(REG struct dpb FAR * dpbp)
/* First test if anyone has changed the removable media */ /* First test if anyone has changed the removable media */
ret = rqblockio(C_MEDIACHK, dpbp); ret = rqblockio(C_MEDIACHK, dpbp);
if (ret < SUCCESS) if (ret < SUCCESS)
{
FatFSDbgPrintf(("media_check: failed\n"));
return ret; return ret;
}
switch (MediaReqHdr.r_mcretcode | dpbp->dpb_flags) switch (MediaReqHdr.r_mcretcode | dpbp->dpb_flags)
{ {
case M_NOT_CHANGED: case M_NOT_CHANGED:
/* It was definitely not changed, so ignore it */ /* It was definitely not changed, so ignore it */
DebugPrintf(("media_check: no change\n"));
return SUCCESS; return SUCCESS;
/* If it is forced or the media may have changed, */ /* If it is forced or the media may have changed, */
/* rebuild the bpb */ /* rebuild the bpb */
case M_DONT_KNOW: case M_DONT_KNOW:
/* hazard: no error checking! */ /* hazard: no error checking! */
DebugPrintf(("media_check: unknown\n"));
flush_buffers(dpbp->dpb_unit); flush_buffers(dpbp->dpb_unit);
/* If it definitely changed, don't know (falls through) */ /* If it definitely changed, don't know (falls through) */
/* or has been changed, rebuild the bpb. */ /* or has been changed, rebuild the bpb. */
/* case M_CHANGED: */ /* case M_CHANGED: */
default: default:
DebugPrintf(("media_check: assumming changed\n"));
setinvld(dpbp->dpb_unit); setinvld(dpbp->dpb_unit);
ret = rqblockio(C_BLDBPB, dpbp); ret = rqblockio(C_BLDBPB, dpbp);
if (ret < SUCCESS) if (ret < SUCCESS)
{
DebugPrintf(("media_check: build BPB failed\n"));
return ret; return ret;
}
#ifdef WITHFAT32 #ifdef WITHFAT32
/* extend dpb only for internal or FAT32 devices */ /* extend dpb only for internal or FAT32 devices */
bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp, bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp,
@ -2077,6 +2106,7 @@ COUNT media_check(REG struct dpb FAR * dpbp)
#else #else
bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp); bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp);
#endif #endif
DebugPrintf(("media_check: returning ok\n"));
return SUCCESS; return SUCCESS;
} }
} }
@ -2089,19 +2119,25 @@ f_node_ptr xlt_fd(int fd)
/* If the fd was invalid because it was out of range or the */ /* If the fd was invalid because it was out of range or the */
/* requested file was not open, tell the caller and exit */ /* requested file was not open, tell the caller and exit */
/* note: an invalid fd is indicated by a 0 return */ /* note: an invalid fd is indicated by a 0 return */
FatFSDbgPrintf(("xlt_fd: fd(%i) ?< f_nodes_cnt(%i)\n", fd, f_nodes_cnt));
if (fd < f_nodes_cnt) if (fd < f_nodes_cnt)
{ {
fnp = get_near_f_node(); fnp = get_near_f_node();
if (fnp != (f_node_ptr)0) if (fnp != (f_node_ptr)0)
{ {
fmemcpy(fnp, &f_nodes[fd], sizeof(*fnp)); fmemcpy(fnp, &f_nodes[fd], sizeof(*fnp));
FatFSDbgPrintf(("xlt_fd: fnp->f_count=%i, fnp-fnode=%i\n", fnp->f_count, (fnp-fnode)));
if (fnp->f_count <= 0) if (fnp->f_count <= 0)
{ {
release_near_f_node(fnp); release_near_f_node(fnp);
fnp = (f_node_ptr) 0; fnp = (f_node_ptr) 0;
} else } else
{
fnode_fd[fnp - fnode] = fd; fnode_fd[fnp - fnode] = fd;
FatFSDbgPrintf(("xlt_fd: success\n"));
}
} }
else FatFSDbgPrintf(("xlt_fd: get_near_f_node failed\n"));
} }
return fnp; return fnp;
} }
@ -2109,6 +2145,7 @@ f_node_ptr xlt_fd(int fd)
/* copy a near fnode to the corresponding far one and release it */ /* copy a near fnode to the corresponding far one and release it */
STATIC void save_far_f_node(f_node_ptr fnp) STATIC void save_far_f_node(f_node_ptr fnp)
{ {
FatFSDbgPrintf(("save_far_f_node: copying near fnode to far one\n"));
fmemcpy(&f_nodes[xlt_fnp(fnp)], fnp, sizeof(*fnp)); fmemcpy(&f_nodes[xlt_fnp(fnp)], fnp, sizeof(*fnp));
release_near_f_node(fnp); release_near_f_node(fnp);
} }

View File

@ -27,6 +27,9 @@
/* Cambridge, MA 02139, USA. */ /* Cambridge, MA 02139, USA. */
/****************************************************************/ /****************************************************************/
#ifndef __GLOBALS_H
#define __GLOBALS_H
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
#ifdef MAIN #ifdef MAIN
static BYTE *Globals_hRcsId = static BYTE *Globals_hRcsId =
@ -422,3 +425,6 @@ GLOBAL BYTE ReturnAnyDosVersionExpected;
GLOBAL struct f_node fnode[2]; GLOBAL struct f_node fnode[2];
GLOBAL int fnode_fd[2]; GLOBAL int fnode_fd[2];
#endif /* __GLOBALS_H */

View File

@ -65,6 +65,7 @@
#include "portab.h" #include "portab.h"
#include "init-mod.h" #include "init-mod.h"
#include "debug.h"
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *RcsId = static BYTE *RcsId =
@ -90,12 +91,6 @@ void int3()
#define int3() #define int3()
#endif #endif
#ifdef DEBUG
#define HMAInitPrintf(x) printf x
#else
#define HMAInitPrintf(x)
#endif
#ifdef DEBUG #ifdef DEBUG
VOID hdump(BYTE FAR * p) VOID hdump(BYTE FAR * p)
{ {
@ -295,9 +290,11 @@ void MoveKernel(unsigned NewKernelSegment)
unsigned len; unsigned len;
unsigned jmpseg = CurrentKernelSegment; unsigned jmpseg = CurrentKernelSegment;
/* on 1st call use original link time (unrelocated) TGROUP segment */
if (CurrentKernelSegment == 0) if (CurrentKernelSegment == 0)
CurrentKernelSegment = FP_SEG(_HMATextEnd); CurrentKernelSegment = FP_SEG(_HMATextEnd);
/* if already relocated to HMA, then ignore move request */
if (CurrentKernelSegment == 0xffff) if (CurrentKernelSegment == 0xffff)
return; return;

View File

@ -34,7 +34,8 @@
segment _LOWTEXT segment _LOWTEXT
old_vectors times 16 dd 0 global _old_vectors
_old_vectors times 16 dd 0
stack_size dw 0 stack_size dw 0
stack_top dw 0 stack_top dw 0
stack_offs dw 0 stack_offs dw 0
@ -129,7 +130,7 @@ general_irq_service:
sub [stack_top], ax sub [stack_top], ax
pushf pushf
call far word [old_vectors+bx] call far word [_old_vectors+bx]
cli cli
add [stack_top], ax add [stack_top], ax
@ -147,7 +148,7 @@ general_irq_service:
iret iret
dont_switch: pushf dont_switch: pushf
call far word [old_vectors+bx] call far word [_old_vectors+bx]
pop ds pop ds
pop ax pop ax
pop dx pop dx
@ -190,7 +191,7 @@ _init_stacks:
mov ax, _LOWTEXT mov ax, _LOWTEXT
mov es, ax mov es, ax
mov di, old_vectors mov di, _old_vectors
mov si, 8 * 4 mov si, 8 * 4
mov cx, 10h mov cx, 10h
rep movsw rep movsw

View File

@ -234,6 +234,23 @@ STATIC void setup_int_vectors(void)
setvec(0x29, int29_handler); /* required for printf! */ setvec(0x29, int29_handler); /* required for printf! */
} }
#ifdef DEBUGIRQ
extern short old_vectors;
STATIC void printIRQvectors(void)
{
int i,c=0;
short FAR *pv = MK_FP(0x70 /* ??? */, (short)&old_vectors);
printf("Original IRQ1-16 Int vectors: %x:%x\n", FP_SEG(pv), FP_OFF(pv));
for (i = 0; i < 16; i++, pv+=2)
{
printf("(%x)%04X:%04X ", i, *pv, *(pv+1));
c = (c+1)%6;
if (c==0) printf("\n");
}
printf("\n");
}
#endif
STATIC void init_kernel(void) STATIC void init_kernel(void)
{ {
COUNT i; COUNT i;
@ -243,6 +260,8 @@ STATIC void init_kernel(void)
LoL->rev_number = REVISION_SEQ; LoL->rev_number = REVISION_SEQ;
/* move kernel to high conventional RAM, just below the init code */ /* move kernel to high conventional RAM, just below the init code */
/* Note: kernel.asm actually moves and jumps here, but MoveKernel
must still be called to do the necessary segment fixups */
#ifdef __WATCOMC__ #ifdef __WATCOMC__
lpTop = MK_FP(_CS, 0); lpTop = MK_FP(_CS, 0);
#else #else
@ -251,6 +270,10 @@ STATIC void init_kernel(void)
MoveKernel(FP_SEG(lpTop)); MoveKernel(FP_SEG(lpTop));
/* lpTop should be para-aligned */ /* lpTop should be para-aligned */
/* Note: during init time (before our MCB chain established)
KernelAlloc returns a para aligned chunk just below last
chunk allocated, lpTop. I.e. lpTop is top of free conv memory
*/
lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0); lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0);
/* Initialize IO subsystem */ /* Initialize IO subsystem */
@ -258,7 +281,7 @@ STATIC void init_kernel(void)
InitPrinters(); InitPrinters();
InitSerialPorts(); InitSerialPorts();
init_PSPSet(DOS_PSP); init_PSPSet(DOS_PSP); /* LoL->_cu_psp = DOS_PSP; */
set_DTA(MK_FP(DOS_PSP, 0x80)); set_DTA(MK_FP(DOS_PSP, 0x80));
PSPInit(); PSPInit();
@ -289,6 +312,11 @@ STATIC void init_kernel(void)
/* and do final buffer allocation. */ /* and do final buffer allocation. */
PostConfig(); PostConfig();
#ifdef DEBUGIRQ
/* displayed stored IRQ vectors, should be original values */
printIRQvectors();
#endif
/* Init the file system one more time */ /* Init the file system one more time */
FsConfig(); FsConfig();
@ -423,6 +451,10 @@ STATIC VOID update_dcb(struct dhdr FAR * dhp)
int nunits = dhp->dh_name[0]; int nunits = dhp->dh_name[0];
struct dpb FAR *dpb = LoL->DPBp; struct dpb FAR *dpb = LoL->DPBp;
/* if we have already chained to at least block driver,
then find last DPB in list, reserve some space in
unused (top of convential) memory, and link it in.
*/
if (LoL->nblkdev) if (LoL->nblkdev)
{ {
while ((LONG) dpb->dpb_next != -1l) while ((LONG) dpb->dpb_next != -1l)

View File

@ -27,6 +27,7 @@
/****************************************************************/ /****************************************************************/
#include "portab.h" #include "portab.h"
#include "debug.h"
#ifdef FORSYS #ifdef FORSYS
#include <io.h> #include <io.h>
@ -118,7 +119,7 @@ void put_console(int c)
} }
#endif /* DOSEMU */ #endif /* DOSEMU */
#if defined(DEBUG) || defined(FORSYS) || defined(_INIT) || defined(TEST) #if defined(DEBUG_NEED_PRINTF) || defined(FORSYS) || defined(_INIT) || defined(TEST)
#ifndef FORSYS #ifndef FORSYS
/* copied from bcc (Bruce's C compiler) stdarg.h */ /* copied from bcc (Bruce's C compiler) stdarg.h */