Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@274 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
d4a9888f7b
commit
c5cb6b1cac
@ -1,4 +1,19 @@
|
|||||||
2001 Jul 9 - Build 2024/e
|
2001 Jul 28 - Build 2024/f
|
||||||
|
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||||
|
+ fixes Bart
|
||||||
|
* fixed get current directory - MSCDEX works now (always)
|
||||||
|
* initdisk.c correctly sets number of hidden sectors: necessary
|
||||||
|
for FORMAT - SYS chain to work
|
||||||
|
+ updates Bart
|
||||||
|
* initialisation memory situation changed: kernel is loaded
|
||||||
|
to the top of conventional memory in the beginning. Then
|
||||||
|
move it back low or high depending on DOS=HIGH and the presence
|
||||||
|
of an XMS driver.
|
||||||
|
DOS=HIGH without an XMS driver (such as FDXMS) has no effect anymore!
|
||||||
|
+ fixes Tom, Victor, Bart
|
||||||
|
* various fatfs.c fixes and clean ups
|
||||||
|
|
||||||
|
2001 Jul 23 - Build 2024/e
|
||||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||||
+ fixes Tom
|
+ fixes Tom
|
||||||
* dyninit allocation fix
|
* dyninit allocation fix
|
||||||
|
@ -44,4 +44,4 @@ static BYTE *date_hRcsId = "$Id$";
|
|||||||
#define REVISION_MINOR 1
|
#define REVISION_MINOR 1
|
||||||
#define REVISION_SEQ 24
|
#define REVISION_SEQ 24
|
||||||
#define BUILD 2024
|
#define BUILD 2024
|
||||||
#define SUB_BUILD "e"
|
#define SUB_BUILD "f"
|
||||||
|
151
kernel/config.c
151
kernel/config.c
@ -89,6 +89,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.26 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.25 2001/07/22 01:58:58 bartoldeman
|
* Revision 1.25 2001/07/22 01:58:58 bartoldeman
|
||||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||||
*
|
*
|
||||||
@ -272,7 +275,8 @@ struct config Config
|
|||||||
|
|
||||||
BYTE FAR *lpBase;
|
BYTE FAR *lpBase;
|
||||||
BYTE FAR *upBase;
|
BYTE FAR *upBase;
|
||||||
static BYTE FAR *lpOldLast;
|
BYTE FAR *lpTop;
|
||||||
|
BYTE FAR *lpOldTop;
|
||||||
static COUNT nCfgLine;
|
static COUNT nCfgLine;
|
||||||
static COUNT nPass;
|
static COUNT nPass;
|
||||||
COUNT UmbState;
|
COUNT UmbState;
|
||||||
@ -364,17 +368,21 @@ INIT BYTE FAR *KernelAllocDma(WORD);
|
|||||||
|
|
||||||
BYTE *pLineStart;
|
BYTE *pLineStart;
|
||||||
|
|
||||||
BYTE HMATextIsAvailable;
|
BYTE HMAState;
|
||||||
|
#define HMA_NONE 0 /* do nothing */
|
||||||
|
#define HMA_REQ 1 /* DOS = HIGH detected */
|
||||||
|
#define HMA_DONE 2 /* Moved kernel to HMA */
|
||||||
|
#define HMA_LOW 3 /* Definitely LOW */
|
||||||
|
|
||||||
void FAR * ConfigAlloc(COUNT bytes)
|
void FAR * ConfigAlloc(COUNT bytes)
|
||||||
{
|
{
|
||||||
VOID FAR *p;
|
VOID FAR *p;
|
||||||
|
|
||||||
p = HMAalloc(bytes);
|
p = HMAalloc(bytes);
|
||||||
|
|
||||||
if (p == NULL) p = KernelAlloc(bytes);
|
if (p == NULL) p = KernelAlloc(bytes);
|
||||||
|
|
||||||
/* printf("ConfigAllog %d at %p\n", bytes, p);*/
|
/* printf("ConfigAlloc %d at %p\n", bytes, p);*/
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -389,15 +397,7 @@ INIT void PreConfig(void)
|
|||||||
UmbState = 0;
|
UmbState = 0;
|
||||||
|
|
||||||
/* Initialize the base memory pointers */
|
/* Initialize the base memory pointers */
|
||||||
|
|
||||||
DynFree(0);
|
|
||||||
|
|
||||||
|
|
||||||
if ( HMATextIsAvailable )
|
|
||||||
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _HMATextAvailable);
|
|
||||||
else
|
|
||||||
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _InitTextStart);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
extern BYTE FAR internal_data[];
|
extern BYTE FAR internal_data[];
|
||||||
@ -412,7 +412,6 @@ INIT void PreConfig(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
config_init_buffers( Config.cfgBuffers );
|
|
||||||
/* buffers = (struct buffer FAR *)
|
/* buffers = (struct buffer FAR *)
|
||||||
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -422,7 +421,6 @@ INIT void PreConfig(void)
|
|||||||
/* Initialize the file table */
|
/* Initialize the file table */
|
||||||
/* f_nodes = (f_node_ptr)
|
/* f_nodes = (f_node_ptr)
|
||||||
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));*/
|
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));*/
|
||||||
|
|
||||||
|
|
||||||
f_nodes = (f_node_ptr)
|
f_nodes = (f_node_ptr)
|
||||||
DynAlloc("f_nodes", Config.cfgFiles , sizeof(struct f_node));
|
DynAlloc("f_nodes", Config.cfgFiles , sizeof(struct f_node));
|
||||||
@ -433,6 +431,11 @@ INIT void PreConfig(void)
|
|||||||
/* FCBp = (sfttbl FAR *)
|
/* FCBp = (sfttbl FAR *)
|
||||||
KernelAlloc(sizeof(sftheader)
|
KernelAlloc(sizeof(sftheader)
|
||||||
+ Config.cfgFiles * sizeof(sft));*/
|
+ Config.cfgFiles * sizeof(sft));*/
|
||||||
|
|
||||||
|
lpBase = AlignParagraph((BYTE FAR *)DynLast()+0x0f);
|
||||||
|
|
||||||
|
config_init_buffers( Config.cfgBuffers);
|
||||||
|
|
||||||
sfthead->sftt_next = (sfttbl FAR *)
|
sfthead->sftt_next = (sfttbl FAR *)
|
||||||
KernelAlloc(sizeof(sftheader)
|
KernelAlloc(sizeof(sftheader)
|
||||||
+ (Config.cfgFiles-5) * sizeof(sft));
|
+ (Config.cfgFiles-5) * sizeof(sft));
|
||||||
@ -446,7 +449,7 @@ INIT void PreConfig(void)
|
|||||||
KernelAlloc(blk_dev.dh_name[0]*sizeof(struct dpb));
|
KernelAlloc(blk_dev.dh_name[0]*sizeof(struct dpb));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Preliminary:\n f_node 0x%p",f_nodes);
|
printf("Preliminary:\n f_node 0x%x",f_nodes);
|
||||||
/* printf(" FCB table 0x%p\n",FCBp);*/
|
/* printf(" FCB table 0x%p\n",FCBp);*/
|
||||||
printf(" sft table 0x%p\n",sfthead->sftt_next);
|
printf(" sft table 0x%p\n",sfthead->sftt_next);
|
||||||
printf(" CDS table 0x%p\n",CDSp);
|
printf(" CDS table 0x%p\n",CDSp);
|
||||||
@ -487,10 +490,8 @@ INIT void PostConfig(void)
|
|||||||
|
|
||||||
/* initialize NEAR allocated things */
|
/* initialize NEAR allocated things */
|
||||||
|
|
||||||
DynFree(Config.cfgFiles * sizeof(struct f_node));
|
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the file table */
|
/* Initialize the file table */
|
||||||
|
DynFree(f_nodes);
|
||||||
f_nodes = (f_node_ptr)
|
f_nodes = (f_node_ptr)
|
||||||
DynAlloc("f_nodes", Config.cfgFiles , sizeof(struct f_node));
|
DynAlloc("f_nodes", Config.cfgFiles , sizeof(struct f_node));
|
||||||
|
|
||||||
@ -505,26 +506,11 @@ INIT void PostConfig(void)
|
|||||||
and allocation starts after the kernel.
|
and allocation starts after the kernel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( HMATextIsAvailable )
|
lpBase = AlignParagraph((BYTE FAR *)DynLast()+0x0f);
|
||||||
lpBase = AlignParagraph((BYTE FAR *)DynLast()+0x0f);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lpBase = AlignParagraph((BYTE FAR *)DynLast()+0x0f);
|
|
||||||
|
|
||||||
DebugPrintf(("HMA not available, moving text to %x\n",FP_SEG(lpBase)));
|
|
||||||
MoveKernel(FP_SEG(lpBase));
|
|
||||||
|
|
||||||
lpBase = AlignParagraph((BYTE FAR *)lpBase + HMAFree + 0x0f);
|
|
||||||
|
|
||||||
DebugPrintf(("kernel is low, start alloc at %p",lpBase));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DebugPrintf(("starting FAR allocations at %p\n",lpBase));
|
DebugPrintf(("starting FAR allocations at %p\n",lpBase));
|
||||||
|
|
||||||
|
|
||||||
lpOldLast = lpBase;
|
|
||||||
|
|
||||||
/* Begin by initializing our system buffers */
|
/* Begin by initializing our system buffers */
|
||||||
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -532,14 +518,7 @@ INIT void PostConfig(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
config_init_buffers( Config.cfgBuffers );
|
config_init_buffers(Config.cfgBuffers);
|
||||||
|
|
||||||
/* buffers = (struct buffer FAR *)
|
|
||||||
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
/* printf("%d buffers allocated at 0x%p\n", Config.cfgBuffers,buffers); */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* sfthead = (sfttbl FAR *)&basesft; */
|
/* sfthead = (sfttbl FAR *)&basesft; */
|
||||||
/* FCBp = (sfttbl FAR *)&FcbSft; */
|
/* FCBp = (sfttbl FAR *)&FcbSft; */
|
||||||
@ -560,7 +539,7 @@ INIT void PostConfig(void)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Final: \n f_node 0x%p\n",f_nodes);
|
printf("Final: \n f_node 0x%x\n",f_nodes);
|
||||||
/* printf(" FCB table 0x%p\n",FCBp);*/
|
/* printf(" FCB table 0x%p\n",FCBp);*/
|
||||||
printf(" sft table 0x%p\n",sfthead->sftt_next);
|
printf(" sft table 0x%p\n",sfthead->sftt_next);
|
||||||
printf(" CDS table 0x%p\n",CDSp);
|
printf(" CDS table 0x%p\n",CDSp);
|
||||||
@ -580,9 +559,21 @@ INIT void PostConfig(void)
|
|||||||
/* This code must be executed after device drivers has been loaded */
|
/* This code must be executed after device drivers has been loaded */
|
||||||
INIT VOID configDone(VOID)
|
INIT VOID configDone(VOID)
|
||||||
{
|
{
|
||||||
HMAconfig(TRUE); /* final HMA processing */
|
if ( HMAState != HMA_DONE )
|
||||||
|
{
|
||||||
|
lpBase = AlignParagraph(lpBase);
|
||||||
|
|
||||||
|
DebugPrintf(("HMA not available, moving text to %x\n",FP_SEG(lpBase)));
|
||||||
|
MoveKernel(FP_SEG(lpBase));
|
||||||
|
|
||||||
|
lpBase = AlignParagraph((BYTE FAR *)lpBase + HMAFree + 0x0f);
|
||||||
|
|
||||||
|
DebugPrintf(("kernel is low, start alloc at %p",lpBase));
|
||||||
|
|
||||||
|
/* final buffer processing, now upwards */
|
||||||
|
HMAState = HMA_LOW;
|
||||||
|
config_init_buffers( Config.cfgBuffers);
|
||||||
|
}
|
||||||
|
|
||||||
if (lastdrive < nblkdev) {
|
if (lastdrive < nblkdev) {
|
||||||
|
|
||||||
@ -713,6 +704,10 @@ INIT VOID DoConfig(VOID)
|
|||||||
bEof = TRUE;
|
bEof = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* immediately convert to upper case */
|
||||||
|
*pLine = toupper(*pLine);
|
||||||
|
|
||||||
if (pLine >= szLine + sizeof(szLine)-3)
|
if (pLine >= szLine + sizeof(szLine)-3)
|
||||||
{
|
{
|
||||||
CfgFailure(pLine);
|
CfgFailure(pLine);
|
||||||
@ -1033,7 +1028,7 @@ INIT static VOID Lastdrive(BYTE * pLine)
|
|||||||
INIT STATIC VOID Dosmem(BYTE * pLine)
|
INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||||
{
|
{
|
||||||
BYTE *pTmp;
|
BYTE *pTmp;
|
||||||
BYTE UMBwanted = FALSE, HMAwanted = FALSE;
|
BYTE UMBwanted = FALSE;
|
||||||
|
|
||||||
/* extern BYTE FAR INITDataSegmentClaimed; */
|
/* extern BYTE FAR INITDataSegmentClaimed; */
|
||||||
|
|
||||||
@ -1047,7 +1042,7 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
|||||||
for (pTmp = szBuf ; ; )
|
for (pTmp = szBuf ; ; )
|
||||||
{
|
{
|
||||||
if (fmemcmp(pTmp, "UMB" ,3) == 0) { UMBwanted = TRUE; pTmp += 3; }
|
if (fmemcmp(pTmp, "UMB" ,3) == 0) { UMBwanted = TRUE; pTmp += 3; }
|
||||||
if (fmemcmp(pTmp, "HIGH",4) == 0) { HMAwanted = TRUE; pTmp += 4; }
|
if (fmemcmp(pTmp, "HIGH",4) == 0) { HMAState = HMA_REQ; pTmp += 4; }
|
||||||
/* if (fmemcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
|
/* if (fmemcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
|
||||||
pTmp = skipwh(pTmp);
|
pTmp = skipwh(pTmp);
|
||||||
|
|
||||||
@ -1062,10 +1057,9 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
|||||||
uppermem_root = 0;
|
uppermem_root = 0;
|
||||||
UmbState = UMBwanted ? 2 : 0;
|
UmbState = UMBwanted ? 2 : 0;
|
||||||
}
|
}
|
||||||
|
/* Check if HMA is available straight away */
|
||||||
if (HMAwanted)
|
if (HMAState == HMA_REQ && MoveKernelToHMA()){
|
||||||
{
|
HMAState = HMA_DONE;
|
||||||
HMATextIsAvailable = MoveKernelToHMA();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1280,27 +1274,6 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
|||||||
multiple devices in it. NUMEGA's SoftIce is such a beast
|
multiple devices in it. NUMEGA's SoftIce is such a beast
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* that's a nice hack >:-)
|
|
||||||
|
|
||||||
although we don't want HIMEM.SYS,(it's not free), other people
|
|
||||||
might load HIMEM.SYS to see if they are compatible to it.
|
|
||||||
|
|
||||||
if it's HIMEM.SYS, we won't survive TESTMEM:ON
|
|
||||||
|
|
||||||
so simply add TESTMEM:OFF to the commandline
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (DosLoadedInHMA)
|
|
||||||
if (stristr(szBuf, "HIMEM.SYS") != NULL)
|
|
||||||
{
|
|
||||||
if (stristr(szBuf, "/TESTMEM:OFF") == NULL)
|
|
||||||
{
|
|
||||||
strcat(szBuf, " /TESTMEM:OFF");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* end of HIMEM.SYS HACK */
|
|
||||||
|
|
||||||
|
|
||||||
/* add \r\n to the command line */
|
/* add \r\n to the command line */
|
||||||
strcat(szBuf, "\r\n");
|
strcat(szBuf, "\r\n");
|
||||||
|
|
||||||
@ -1321,10 +1294,15 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
|||||||
/* Link in device driver and save nul_dev pointer to next */
|
/* Link in device driver and save nul_dev pointer to next */
|
||||||
dhp->dh_next = nul_dev.dh_next;
|
dhp->dh_next = nul_dev.dh_next;
|
||||||
nul_dev.dh_next = dhp;
|
nul_dev.dh_next = dhp;
|
||||||
}
|
}
|
||||||
|
/* We could just have loaded FDXMS or HIMEM */
|
||||||
HMAconfig(FALSE); /* let the HMA claim HMA usage */
|
if (HMAState == HMA_REQ && MoveKernelToHMA())
|
||||||
|
{
|
||||||
|
/* final HMA processing: */
|
||||||
|
/* final buffer processing, now upwards */
|
||||||
|
HMAState = HMA_DONE;
|
||||||
|
config_init_buffers( Config.cfgBuffers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CfgFailure(pLine);
|
CfgFailure(pLine);
|
||||||
@ -1580,6 +1558,7 @@ VOID config_init_buffers(COUNT anzBuffers)
|
|||||||
REG WORD i;
|
REG WORD i;
|
||||||
struct buffer FAR *pbuffer;
|
struct buffer FAR *pbuffer;
|
||||||
int HMAcount = 0;
|
int HMAcount = 0;
|
||||||
|
BYTE FAR *tmplpBase = lpBase;
|
||||||
|
|
||||||
anzBuffers = max(anzBuffers,6);
|
anzBuffers = max(anzBuffers,6);
|
||||||
if (anzBuffers > 99)
|
if (anzBuffers > 99)
|
||||||
@ -1588,6 +1567,11 @@ VOID config_init_buffers(COUNT anzBuffers)
|
|||||||
anzBuffers = 99;
|
anzBuffers = 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lpTop = lpOldTop;
|
||||||
|
|
||||||
|
if (HMAState == HMA_NONE || HMAState == HMA_REQ)
|
||||||
|
lpTop = lpBase = lpTop - anzBuffers * (sizeof (struct buffer) + 0xf);
|
||||||
|
|
||||||
firstbuf = ConfigAlloc(sizeof (struct buffer));
|
firstbuf = ConfigAlloc(sizeof (struct buffer));
|
||||||
|
|
||||||
pbuffer = firstbuf;
|
pbuffer = firstbuf;
|
||||||
@ -1606,7 +1590,7 @@ VOID config_init_buffers(COUNT anzBuffers)
|
|||||||
pbuffer->b_offset_hi = 0;
|
pbuffer->b_offset_hi = 0;
|
||||||
pbuffer->b_next = NULL;
|
pbuffer->b_next = NULL;
|
||||||
|
|
||||||
/* printf("init_buffers buffer %d at %p\n",i, pbuffer);*/
|
DebugPrintf(("init_buffers buffer %d at %p\n",i, pbuffer));
|
||||||
|
|
||||||
if (i < (anzBuffers - 1))
|
if (i < (anzBuffers - 1))
|
||||||
pbuffer->b_next = ConfigAlloc(sizeof (struct buffer));
|
pbuffer->b_next = ConfigAlloc(sizeof (struct buffer));
|
||||||
@ -1617,9 +1601,10 @@ VOID config_init_buffers(COUNT anzBuffers)
|
|||||||
pbuffer = pbuffer->b_next;
|
pbuffer = pbuffer->b_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HMAcount > 0)
|
DebugPrintf(("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
||||||
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
HMAcount, HMAcount*sizeof (struct buffer)));
|
||||||
HMAcount, HMAcount*sizeof (struct buffer));
|
if (HMAState == HMA_NONE || HMAState == HMA_REQ)
|
||||||
|
lpBase = tmplpBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
|
|||||||
* /// Added SHARE support. 2000/09/04 Ron Cemer
|
* /// Added SHARE support. 2000/09/04 Ron Cemer
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.23 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.22 2001/07/24 16:56:29 bartoldeman
|
* Revision 1.22 2001/07/24 16:56:29 bartoldeman
|
||||||
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
||||||
*
|
*
|
||||||
@ -1172,6 +1175,8 @@ VOID DosGetFree(UBYTE drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
|
|||||||
|
|
||||||
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
||||||
{
|
{
|
||||||
|
BYTE FAR *cp;
|
||||||
|
|
||||||
/* next - "log" in the drive */
|
/* next - "log" in the drive */
|
||||||
drive = (drive == 0 ? default_drive : drive - 1);
|
drive = (drive == 0 ? default_drive : drive - 1);
|
||||||
|
|
||||||
@ -1182,8 +1187,11 @@ COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
|||||||
|
|
||||||
current_ldt = &CDSp->cds_table[drive];
|
current_ldt = &CDSp->cds_table[drive];
|
||||||
|
|
||||||
fsncopy((BYTE FAR *) & current_ldt->cdsCurrentPath[1 + current_ldt->cdsJoinOffset],
|
cp = ¤t_ldt->cdsCurrentPath[current_ldt->cdsJoinOffset];
|
||||||
s, 64);
|
if (*cp == '\0')
|
||||||
|
s[0]='\0';
|
||||||
|
else
|
||||||
|
fstrncpy(s, cp+1, 64);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1264,7 +1272,7 @@ STATIC VOID pop_dmp(dmatch FAR * dmp)
|
|||||||
|
|
||||||
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||||
{
|
{
|
||||||
COUNT nDrive, rc;
|
COUNT rc;
|
||||||
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
||||||
BYTE FAR *p;
|
BYTE FAR *p;
|
||||||
|
|
||||||
@ -1277,6 +1285,10 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
|||||||
- Ron Cemer */
|
- Ron Cemer */
|
||||||
|
|
||||||
fmemset(dta, 0, sizeof(dmatch));
|
fmemset(dta, 0, sizeof(dmatch));
|
||||||
|
|
||||||
|
/* initially mark the dta as invalid for further findnexts */
|
||||||
|
((dmatch FAR *)dta)->dm_attr_fnd = D_DEVICE;
|
||||||
|
|
||||||
memset(&SearchDir, 0, sizeof(struct dirent));
|
memset(&SearchDir, 0, sizeof(struct dirent));
|
||||||
|
|
||||||
rc = truename(name, PriPathName, FALSE);
|
rc = truename(name, PriPathName, FALSE);
|
||||||
@ -1303,13 +1315,8 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
|||||||
}
|
}
|
||||||
/* /// End of additions. - Ron Cemer ; heavily edited - Bart Oldeman */
|
/* /// End of additions. - Ron Cemer ; heavily edited - Bart Oldeman */
|
||||||
|
|
||||||
nDrive=get_verify_drive(name);
|
|
||||||
if (nDrive < 0)
|
|
||||||
return nDrive;
|
|
||||||
SAttr = (BYTE) attr;
|
SAttr = (BYTE) attr;
|
||||||
|
|
||||||
current_ldt = &CDSp->cds_table[nDrive];
|
|
||||||
|
|
||||||
#if defined(FIND_DEBUG)
|
#if defined(FIND_DEBUG)
|
||||||
printf("Remote Find: n='%Fs\n", PriPathName);
|
printf("Remote Find: n='%Fs\n", PriPathName);
|
||||||
#endif
|
#endif
|
||||||
@ -1324,12 +1331,10 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
|||||||
|
|
||||||
dta = p;
|
dta = p;
|
||||||
|
|
||||||
if (rc != SUCCESS)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
fmemcpy(dta, TempBuffer, 21);
|
fmemcpy(dta, TempBuffer, 21);
|
||||||
pop_dmp((dmatch FAR *)dta);
|
pop_dmp((dmatch FAR *)dta);
|
||||||
return SUCCESS;
|
if (rc != SUCCESS) ((dmatch FAR *)dta)->dm_attr_fnd = D_DEVICE; /* mark invalid */
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT DosFindNext(void)
|
COUNT DosFindNext(void)
|
||||||
@ -1371,12 +1376,9 @@ COUNT DosFindNext(void)
|
|||||||
dos_findnext();
|
dos_findnext();
|
||||||
|
|
||||||
dta = p;
|
dta = p;
|
||||||
if (rc != SUCCESS)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
fmemcpy(dta, TempBuffer, 21);
|
fmemcpy(dta, TempBuffer, 21);
|
||||||
pop_dmp((dmatch FAR *)dta);
|
pop_dmp((dmatch FAR *)dta);
|
||||||
return SUCCESS;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT DosGetFtime(COUNT hndl, date FAR * dp, time FAR * tp)
|
COUNT DosGetFtime(COUNT hndl, date FAR * dp, time FAR * tp)
|
||||||
|
10
kernel/dsk.c
10
kernel/dsk.c
@ -26,12 +26,17 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "dyndata.h"
|
||||||
|
|
||||||
#ifdef VERSION_STRINGS
|
#ifdef VERSION_STRINGS
|
||||||
static BYTE *dskRcsId = "$Id$";
|
static BYTE *dskRcsId = "$Id$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.19 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.18 2001/07/22 01:58:58 bartoldeman
|
* Revision 1.18 2001/07/22 01:58:58 bartoldeman
|
||||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||||
*
|
*
|
||||||
@ -216,11 +221,10 @@ struct FS_info
|
|||||||
BYTE fstype[8];
|
BYTE fstype[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
ddt *pddt0; /* Internal media info structs */
|
extern struct DynS Dyn;
|
||||||
/* STATIC bpb *bpbptrs[NDEV]; pointers to bpbs */
|
|
||||||
|
|
||||||
/*TE - array access functions */
|
/*TE - array access functions */
|
||||||
ddt *getddt(int dev) { return &pddt0[dev];}
|
ddt *getddt(int dev) { return &(((ddt*)Dyn.Buffer)[dev]);}
|
||||||
|
|
||||||
#define N_PART 4 /* number of partitions per
|
#define N_PART 4 /* number of partitions per
|
||||||
table partition */
|
table partition */
|
||||||
|
@ -9,16 +9,11 @@
|
|||||||
moveable and Dyn.Buffer resizable, but not before
|
moveable and Dyn.Buffer resizable, but not before
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *DynAlloc(char far *what, unsigned num, unsigned size);
|
void far *DynAlloc(char *what, unsigned num, unsigned size);
|
||||||
void DynFree(unsigned memory_needed);
|
|
||||||
void far *DynLast(void);
|
void far *DynLast(void);
|
||||||
|
void DynFree(void *ptr);
|
||||||
|
|
||||||
struct DynS {
|
struct DynS {
|
||||||
unsigned Allocated;
|
unsigned Allocated;
|
||||||
unsigned UsedByDiskInit;
|
char Buffer[0];
|
||||||
unsigned AllocMax;
|
|
||||||
char Buffer[NDEV*sizeof(ddt) /* for InitDisk - Drive Data Table */
|
|
||||||
+ 16 * 71 /* initial f_nodes */
|
|
||||||
+200 /* give some extra bytes */
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
@ -50,57 +50,36 @@ additionally:
|
|||||||
|
|
||||||
extern struct DynS FAR Dyn;
|
extern struct DynS FAR Dyn;
|
||||||
|
|
||||||
void *DynAlloc(char FAR *what, unsigned num, unsigned size)
|
void far *DynAlloc(char *what, unsigned num, unsigned size)
|
||||||
{
|
{
|
||||||
void *now;
|
void far *now;
|
||||||
unsigned total = num * size;
|
unsigned total = num * size;
|
||||||
|
#ifndef DEBUG
|
||||||
UNREFERENCED_PARAMETER(what);
|
UNREFERENCED_PARAMETER(what);
|
||||||
|
#endif
|
||||||
|
|
||||||
DebugPrintf(("DYNDATA:allocating %Fs - %u * %u bytes, total %u, %u..%u\n",
|
if ((ULONG)total + Dyn.Allocated > 0xffff)
|
||||||
|
{
|
||||||
|
printf("PANIC:Dyn %lu\n", (ULONG)total + Dyn.Allocated);
|
||||||
|
for (;;);
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugPrintf(("DYNDATA:allocating %s - %u * %u bytes, total %u, %u..%u\n",
|
||||||
what, num, size, total, Dyn.Allocated,Dyn.Allocated+total));
|
what, num, size, total, Dyn.Allocated,Dyn.Allocated+total));
|
||||||
|
|
||||||
if (total > Dyn.AllocMax - Dyn.Allocated)
|
now = (void far *)&Dyn.Buffer[Dyn.Allocated];
|
||||||
{
|
fmemset(now, 0, total);
|
||||||
printf("DYNDATA overflow");
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
now = (void*)&Dyn.Buffer[Dyn.Allocated];
|
|
||||||
|
|
||||||
Dyn.Allocated += total;
|
Dyn.Allocated += total;
|
||||||
|
|
||||||
|
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynFree(unsigned memory_needed)
|
void DynFree(void *ptr)
|
||||||
{
|
{
|
||||||
if (memory_needed == 0) /* this is pass 0 */
|
Dyn.Allocated = (char *)ptr - (char *)Dyn.Buffer;
|
||||||
{
|
}
|
||||||
|
|
||||||
Dyn.Allocated = NDEV*sizeof(ddt); /* this reserves space for initDisk */
|
|
||||||
Dyn.AllocMax = sizeof(Dyn.Buffer);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* enlarge kernel data segment to 64K */
|
|
||||||
if (memory_needed + Dyn.UsedByDiskInit > sizeof(Dyn.Buffer))
|
|
||||||
{
|
|
||||||
if ((ULONG)memory_needed + Dyn.UsedByDiskInit > 0xffff)
|
|
||||||
{
|
|
||||||
printf("PANIC:Dyn %lu\n",memory_needed + Dyn.UsedByDiskInit);
|
|
||||||
for (;;);
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveKernel(FP_SEG(&Dyn.UsedByDiskInit) + 0x1000);
|
|
||||||
|
|
||||||
Dyn.AllocMax = 0xffff - (unsigned)&Dyn.Buffer;
|
|
||||||
}
|
|
||||||
Dyn.Allocated = Dyn.UsedByDiskInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugPrintf(("DYNDATA:free to %u, max %u\n",Dyn.Allocated,Dyn.AllocMax));
|
|
||||||
}
|
|
||||||
|
|
||||||
void FAR *DynLast()
|
void FAR *DynLast()
|
||||||
{
|
{
|
||||||
DebugPrintf(("dynamic data end at %p\n",(void FAR *)(Dyn.Buffer+Dyn.Allocated)));
|
DebugPrintf(("dynamic data end at %p\n",(void FAR *)(Dyn.Buffer+Dyn.Allocated)));
|
||||||
|
@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.21 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.20 2001/07/24 16:56:29 bartoldeman
|
* Revision 1.20 2001/07/24 16:56:29 bartoldeman
|
||||||
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
||||||
*
|
*
|
||||||
@ -652,7 +655,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
|||||||
/* directory and only searched for once. So we need to open */
|
/* directory and only searched for once. So we need to open */
|
||||||
/* the root and return only the first entry that contains the */
|
/* the root and return only the first entry that contains the */
|
||||||
/* volume id bit set. */
|
/* volume id bit set. */
|
||||||
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
|
if (attr & D_VOLID)
|
||||||
{
|
{
|
||||||
szDirName[2] = '\\';
|
szDirName[2] = '\\';
|
||||||
szDirName[3] = '\0';
|
szDirName[3] = '\0';
|
||||||
@ -676,7 +679,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
|||||||
fbcopy((BYTE FAR *) SearchDir.dir_name, dmp->dm_name_pat,
|
fbcopy((BYTE FAR *) SearchDir.dir_name, dmp->dm_name_pat,
|
||||||
FNAME_SIZE + FEXT_SIZE);
|
FNAME_SIZE + FEXT_SIZE);
|
||||||
|
|
||||||
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
|
if (attr & D_VOLID)
|
||||||
{
|
{
|
||||||
/* Now do the search */
|
/* Now do the search */
|
||||||
while (dir_read(fnp) == DIRENT_SIZE)
|
while (dir_read(fnp) == DIRENT_SIZE)
|
||||||
|
@ -47,6 +47,9 @@ BYTE *RcsId = "$Id$";
|
|||||||
* performance killer on large drives. (~0.5 sec /dos_mkdir) TE
|
* performance killer on large drives. (~0.5 sec /dos_mkdir) TE
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.22 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.21 2001/07/24 16:56:29 bartoldeman
|
* Revision 1.21 2001/07/24 16:56:29 bartoldeman
|
||||||
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
||||||
*
|
*
|
||||||
@ -293,7 +296,6 @@ COUNT dos_open(BYTE * path, COUNT flag)
|
|||||||
/* new directory and name of new directory. */
|
/* new directory and name of new directory. */
|
||||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp);
|
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,20 +368,14 @@ COUNT dos_close(COUNT fd)
|
|||||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||||
return DE_INVLDHNDL;
|
return DE_INVLDHNDL;
|
||||||
|
|
||||||
if (fnp->f_mode != RDONLY)
|
if (fnp->f_mode != RDONLY && fnp->f_flags.f_dmod)
|
||||||
{
|
{
|
||||||
/*TE experimental */
|
fnp->f_dir.dir_attrib |= D_ARCHIVE;
|
||||||
if (fnp->f_flags.f_dmod)
|
fnp->f_dir.dir_time = dos_gettime();
|
||||||
{
|
fnp->f_dir.dir_date = dos_getdate();
|
||||||
fnp->f_dir.dir_attrib |= D_ARCHIVE;
|
|
||||||
fnp->f_dir.dir_time = dos_gettime();
|
|
||||||
fnp->f_dir.dir_date = dos_getdate();
|
|
||||||
|
|
||||||
shrink_file(fnp); /* reduce allocated filesize in FAT */
|
shrink_file(fnp); /* reduce allocated filesize in FAT */
|
||||||
}
|
|
||||||
|
|
||||||
fnp->f_dir.dir_size = fnp->f_highwater;
|
fnp->f_dir.dir_size = fnp->f_highwater;
|
||||||
fnp->f_flags.f_dmod = TRUE;
|
|
||||||
merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */
|
merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */
|
||||||
}
|
}
|
||||||
fnp->f_flags.f_ddir = TRUE;
|
fnp->f_flags.f_ddir = TRUE;
|
||||||
@ -568,7 +564,6 @@ COUNT dos_creat(BYTE * path, COUNT attrib)
|
|||||||
/* path to new directory and name of new directory */
|
/* path to new directory and name of new directory */
|
||||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp);
|
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,7 +663,6 @@ COUNT dos_delete(BYTE * path)
|
|||||||
/* path to new directory and name of new directory */
|
/* path to new directory and name of new directory */
|
||||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp);
|
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +714,6 @@ COUNT dos_rmdir(BYTE * path)
|
|||||||
/* path to new directory and name of new directory */
|
/* path to new directory and name of new directory */
|
||||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp);
|
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,9 +735,9 @@ COUNT dos_rmdir(BYTE * path)
|
|||||||
|
|
||||||
/* directories may have attributes, too. at least my WinNT disk
|
/* directories may have attributes, too. at least my WinNT disk
|
||||||
has many 'archive' directories
|
has many 'archive' directories
|
||||||
we still don't allow SYSTEM or RDONLY directories to be deleted TE*/
|
we still don't allow RDONLY directories to be deleted TE*/
|
||||||
|
|
||||||
if (fnp->f_dir.dir_attrib & ~(D_DIR |D_HIDDEN|D_ARCHIVE))
|
if (fnp->f_dir.dir_attrib & ~(D_DIR |D_HIDDEN|D_ARCHIVE|D_SYSTEM))
|
||||||
{
|
{
|
||||||
dir_close(fnp);
|
dir_close(fnp);
|
||||||
return DE_ACCESS;
|
return DE_ACCESS;
|
||||||
@ -826,7 +819,6 @@ COUNT dos_rename(BYTE * path1, BYTE * path2)
|
|||||||
/* new file name and name of new file name */
|
/* new file name and name of new file name */
|
||||||
if ((fnp2 = split_path(path2, szFileName, szFileExt)) == NULL)
|
if ((fnp2 = split_path(path2, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp2);
|
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,7 +834,6 @@ COUNT dos_rename(BYTE * path1, BYTE * path2)
|
|||||||
/* old file name and name of old file name */
|
/* old file name and name of old file name */
|
||||||
if ((fnp1 = split_path(path1, szFileName, szFileExt)) == NULL)
|
if ((fnp1 = split_path(path1, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp1);
|
|
||||||
dir_close(fnp2);
|
dir_close(fnp2);
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
@ -1192,7 +1183,6 @@ COUNT dos_mkdir(BYTE * dir)
|
|||||||
/* path to new directory and name of new directory */
|
/* path to new directory and name of new directory */
|
||||||
if ((fnp = split_path(dir, szFileName, szFileExt)) == NULL)
|
if ((fnp = split_path(dir, szFileName, szFileExt)) == NULL)
|
||||||
{
|
{
|
||||||
dir_close(fnp);
|
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1995,9 +1985,6 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fnp->f_flags.f_dmod = TRUE; /* mark file as modified */
|
|
||||||
|
|
||||||
|
|
||||||
/* update pointers and counters */
|
/* update pointers and counters */
|
||||||
ret_cnt += xfr_cnt;
|
ret_cnt += xfr_cnt;
|
||||||
to_xfer -= xfr_cnt;
|
to_xfer -= xfr_cnt;
|
||||||
@ -2439,8 +2426,12 @@ STATIC VOID shrink_file(f_node_ptr fnp)
|
|||||||
UCOUNT next,st;
|
UCOUNT next,st;
|
||||||
struct dpb FAR *dpbp = fnp->f_dpb;
|
struct dpb FAR *dpbp = fnp->f_dpb;
|
||||||
|
|
||||||
|
if (fnp->f_flags.f_ddir) /* can't shrink dirs */
|
||||||
|
return;
|
||||||
|
|
||||||
fnp->f_offset = fnp->f_highwater; /* end of file */
|
fnp->f_offset = fnp->f_highwater; /* end of file */
|
||||||
|
|
||||||
|
if (fnp->f_offset) fnp->f_offset--; /* last existing cluster */
|
||||||
|
|
||||||
if (map_cluster(fnp, XFR_READ) != SUCCESS) /* error, don't truncate */
|
if (map_cluster(fnp, XFR_READ) != SUCCESS) /* error, don't truncate */
|
||||||
goto done;
|
goto done;
|
||||||
@ -2457,7 +2448,7 @@ STATIC VOID shrink_file(f_node_ptr fnp)
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* Loop from start until either a FREE entry is */
|
/* Loop from start until either a FREE entry is */
|
||||||
/* encountered (due to a fractured file system) of the */
|
/* encountered (due to a damaged file system) or the */
|
||||||
/* last cluster is encountered. */
|
/* last cluster is encountered. */
|
||||||
/* zap the FAT pointed to */
|
/* zap the FAT pointed to */
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ extern fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len);
|
|||||||
#define NUMBUFF 6 /* Number of track buffers */
|
#define NUMBUFF 6 /* Number of track buffers */
|
||||||
/* -- must be at least 3 */
|
/* -- must be at least 3 */
|
||||||
#define MAX_HARD_DRIVE 8
|
#define MAX_HARD_DRIVE 8
|
||||||
#define NDEV 20 /* only one for demo */
|
#define NDEV 26 /* up to Z: */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ static BYTE *dskRcsId = "$Id$";
|
|||||||
/*
|
/*
|
||||||
data shared between DSK.C and INITDISK.C
|
data shared between DSK.C and INITDISK.C
|
||||||
*/
|
*/
|
||||||
extern ddt * FAR pddt0; /* Pointer to drive data tables */
|
|
||||||
|
|
||||||
extern UBYTE FAR DiskTransferBuffer[1 * SEC_SIZE];
|
extern UBYTE FAR DiskTransferBuffer[1 * SEC_SIZE];
|
||||||
|
|
||||||
extern COUNT FAR nUnits;
|
extern COUNT FAR nUnits;
|
||||||
@ -190,6 +188,16 @@ struct DriveParamS
|
|||||||
struct CHS chs; /* for normal INT 13 */
|
struct CHS chs; /* for normal INT 13 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PartTableEntry /* INTERNAL representation of partition table entry */
|
||||||
|
{
|
||||||
|
UBYTE Bootable;
|
||||||
|
UBYTE FileSystem;
|
||||||
|
struct CHS Begin;
|
||||||
|
struct CHS End;
|
||||||
|
ULONG RelSect;
|
||||||
|
ULONG NumSect;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
internal global data
|
internal global data
|
||||||
*/
|
*/
|
||||||
@ -376,10 +384,9 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
|||||||
|
|
||||||
|
|
||||||
void DosDefinePartition(struct DriveParamS *driveParam,
|
void DosDefinePartition(struct DriveParamS *driveParam,
|
||||||
ULONG StartSector, ULONG NumSectors, UBYTE FileSystem)
|
ULONG StartSector, struct PartTableEntry *pEntry)
|
||||||
{
|
{
|
||||||
extern struct DynS FAR Dyn;
|
ddt FAR *pddt = DynAlloc("ddt", 1, sizeof(ddt));
|
||||||
ddt FAR *pddt = &((ddt FAR *)&Dyn.Buffer[0])[nUnits];
|
|
||||||
struct CHS chs;
|
struct CHS chs;
|
||||||
|
|
||||||
if ( nUnits >= NDEV)
|
if ( nUnits >= NDEV)
|
||||||
@ -397,19 +404,20 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
|||||||
DebugPrintf(("LBA enabled for drive %c:\n", 'A'+nUnits));
|
DebugPrintf(("LBA enabled for drive %c:\n", 'A'+nUnits));
|
||||||
|
|
||||||
pddt->ddt_offset = StartSector;
|
pddt->ddt_offset = StartSector;
|
||||||
|
|
||||||
pddt->ddt_defbpb.bpb_nbyte = SEC_SIZE;
|
pddt->ddt_defbpb.bpb_nbyte = SEC_SIZE;
|
||||||
pddt->ddt_defbpb.bpb_mdesc = 0xf8;
|
pddt->ddt_defbpb.bpb_mdesc = 0xf8;
|
||||||
pddt->ddt_defbpb.bpb_nheads = driveParam->chs.Head;
|
pddt->ddt_defbpb.bpb_nheads = driveParam->chs.Head;
|
||||||
pddt->ddt_defbpb.bpb_nsecs = driveParam->chs.Sector;
|
pddt->ddt_defbpb.bpb_nsecs = driveParam->chs.Sector;
|
||||||
pddt->ddt_defbpb.bpb_nsize = 0;
|
pddt->ddt_defbpb.bpb_nsize = 0;
|
||||||
if (NumSectors > 0xffff)
|
pddt->ddt_defbpb.bpb_hidden = pEntry->RelSect;
|
||||||
pddt->ddt_defbpb.bpb_huge = NumSectors;
|
if (pEntry->NumSect > 0xffff)
|
||||||
|
pddt->ddt_defbpb.bpb_huge = pEntry->NumSect;
|
||||||
else
|
else
|
||||||
pddt->ddt_defbpb.bpb_nsize = (UWORD)NumSectors;
|
pddt->ddt_defbpb.bpb_nsize = (UWORD)(pEntry->NumSect);
|
||||||
|
|
||||||
/* sectors per cluster, sectors per FAT etc. */
|
/* sectors per cluster, sectors per FAT etc. */
|
||||||
CalculateFATData(pddt, NumSectors, FileSystem);
|
CalculateFATData(pddt, pEntry->NumSect, pEntry->FileSystem);
|
||||||
|
|
||||||
pddt->ddt_serialno = 0x12345678l;
|
pddt->ddt_serialno = 0x12345678l;
|
||||||
pddt->ddt_descflags = 0x200; /* drive inaccessible until bldbpb successful */
|
pddt->ddt_descflags = 0x200; /* drive inaccessible until bldbpb successful */
|
||||||
@ -425,7 +433,7 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
|||||||
printCHS(" CHS= ",&chs);
|
printCHS(" CHS= ",&chs);
|
||||||
|
|
||||||
printf(" start = %5luMB,size =%5lu",
|
printf(" start = %5luMB,size =%5lu",
|
||||||
StartSector/2048,NumSectors/2048);
|
StartSector/2048,pEntry->NumSect/2048);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
@ -583,16 +591,6 @@ ErrorReturn:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct PartTableEntry /* INTERNAL representation of partition table entry */
|
|
||||||
{
|
|
||||||
UBYTE Bootable;
|
|
||||||
UBYTE FileSystem;
|
|
||||||
struct CHS Begin;
|
|
||||||
struct CHS End;
|
|
||||||
ULONG RelSect;
|
|
||||||
ULONG NumSect;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
converts physical into logical representation of partition entry
|
converts physical into logical representation of partition entry
|
||||||
*/
|
*/
|
||||||
@ -740,7 +738,7 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
|||||||
|
|
||||||
partitionsToIgnore |= 1 << i;
|
partitionsToIgnore |= 1 << i;
|
||||||
|
|
||||||
DosDefinePartition(driveParam,partitionStart, pEntry->NumSect, pEntry->FileSystem);
|
DosDefinePartition(driveParam,partitionStart, pEntry);
|
||||||
|
|
||||||
if (scan_type == SCAN_PRIMARYBOOT ||
|
if (scan_type == SCAN_PRIMARYBOOT ||
|
||||||
scan_type == SCAN_PRIMARY )
|
scan_type == SCAN_PRIMARY )
|
||||||
@ -1052,19 +1050,15 @@ void ReadAllPartitionTables(void)
|
|||||||
|
|
||||||
int HardDrive;
|
int HardDrive;
|
||||||
int nHardDisk = BIOS_nrdrives();
|
int nHardDisk = BIOS_nrdrives();
|
||||||
ddt FAR *pddt;
|
|
||||||
bpb FAR *pbpbarray;
|
bpb FAR *pbpbarray;
|
||||||
int Unit;
|
int Unit;
|
||||||
|
ddt FAR *pddt;
|
||||||
extern struct DynS FAR Dyn;
|
|
||||||
/* ddt *miarrayptr; /* Internal media info structs */
|
|
||||||
|
|
||||||
pddt0 = (ddt *)&Dyn.Buffer[0];
|
|
||||||
|
|
||||||
/* Setup media info and BPBs arrays for floppies (this is a 360kb flop) */
|
/* Setup media info and BPBs arrays for floppies (this is a 360kb flop) */
|
||||||
for (Unit = 0; Unit < nUnits; Unit++)
|
for (Unit = 0; Unit < nUnits; Unit++)
|
||||||
{
|
{
|
||||||
pddt = &((ddt FAR *)&Dyn.Buffer[0])[Unit];
|
pddt = DynAlloc("ddt", 1, sizeof(ddt));
|
||||||
|
|
||||||
pbpbarray = &pddt->ddt_defbpb;
|
pbpbarray = &pddt->ddt_defbpb;
|
||||||
|
|
||||||
pbpbarray->bpb_nbyte = SEC_SIZE;
|
pbpbarray->bpb_nbyte = SEC_SIZE;
|
||||||
@ -1138,10 +1132,6 @@ void ReadAllPartitionTables(void)
|
|||||||
{
|
{
|
||||||
ProcessDisk(SCAN_PRIMARY2, HardDrive ,foundPartitions[HardDrive]);
|
ProcessDisk(SCAN_PRIMARY2, HardDrive ,foundPartitions[HardDrive]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dyn.UsedByDiskInit = nUnits * sizeof(ddt);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* disk initialization: returns number of units */
|
/* disk initialization: returns number of units */
|
||||||
|
@ -81,6 +81,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.8 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.7 2001/07/09 22:19:33 bartoldeman
|
* Revision 1.7 2001/07/09 22:19:33 bartoldeman
|
||||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||||
*
|
*
|
||||||
@ -106,6 +109,7 @@ static BYTE *RcsId = "$Id$";
|
|||||||
* initial creation
|
* initial creation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void ClaimHMA(VOID);
|
||||||
|
|
||||||
BYTE DosLoadedInHMA=FALSE; /* set to TRUE if loaded HIGH */
|
BYTE DosLoadedInHMA=FALSE; /* set to TRUE if loaded HIGH */
|
||||||
BYTE HMAclaimed=FALSE; /* set to TRUE if claimed from HIMEM */
|
BYTE HMAclaimed=FALSE; /* set to TRUE if claimed from HIMEM */
|
||||||
@ -174,34 +178,6 @@ fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Enable / Disable borrowed without understanding from FDXMS. Thanks.
|
|
||||||
gone done to KERNEL.ASM
|
|
||||||
|
|
||||||
OutportWithDelay(WORD port, BYTE val)
|
|
||||||
{
|
|
||||||
int loop;
|
|
||||||
|
|
||||||
__outportb__(port,val);
|
|
||||||
|
|
||||||
for (loop = 100; --loop && __inportb__(0x64) & 0x02;)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void _EnableHMA()
|
|
||||||
{
|
|
||||||
OutportWithDelay(0x64, 0xd1);
|
|
||||||
OutportWithDelay(0x60, 0xdf);
|
|
||||||
OutportWithDelay(0x64, 0xff);
|
|
||||||
}
|
|
||||||
void _DisableHMA()
|
|
||||||
{
|
|
||||||
OutportWithDelay(0x64, 0xd1);
|
|
||||||
OutportWithDelay(0x60, 0xdd);
|
|
||||||
OutportWithDelay(0x64, 0xff);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this tests, if the HMA area can be enabled.
|
this tests, if the HMA area can be enabled.
|
||||||
if so, it simply leaves it on
|
if so, it simply leaves it on
|
||||||
@ -261,20 +237,15 @@ int MoveKernelToHMA()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ /* is very improbable - we are just booting - but
|
{
|
||||||
there might already a XMS handler installed
|
|
||||||
this is the case for DOSEMU
|
|
||||||
*/
|
|
||||||
|
|
||||||
void FAR *pXMS = DetectXMSDriver();
|
void FAR *pXMS = DetectXMSDriver();
|
||||||
|
|
||||||
if (pXMS != NULL)
|
if (pXMS != NULL)
|
||||||
{
|
{
|
||||||
XMSDriverAddress = pXMS;
|
XMSDriverAddress = pXMS;
|
||||||
|
|
||||||
printf("DOSEMU ? detected XMS driver at %p\n", XMSDriverAddress);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -297,7 +268,9 @@ int MoveKernelToHMA()
|
|||||||
printf("Can't enable HMA area (the famous A20), NOT moving to HMA\n");
|
printf("Can't enable HMA area (the famous A20), NOT moving to HMA\n");
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClaimHMA();
|
||||||
|
|
||||||
MoveKernel(0xffff);
|
MoveKernel(0xffff);
|
||||||
|
|
||||||
@ -326,12 +299,7 @@ errorReturn:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* not necessary anymore : BO */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
now protect against HIMEM/FDXMS/... by simulating a VDISK
|
now protect against HIMEM/FDXMS/... by simulating a VDISK
|
||||||
FDXMS should detect us and not give HMA access to ohers
|
FDXMS should detect us and not give HMA access to ohers
|
||||||
@ -339,6 +307,7 @@ errorReturn:
|
|||||||
|
|
||||||
so: we install this after all drivers have been loaded
|
so: we install this after all drivers have been loaded
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
void InstallVDISK(VOID)
|
void InstallVDISK(VOID)
|
||||||
{
|
{
|
||||||
static struct { /* Boot-Sektor of a RAM-Disk */
|
static struct { /* Boot-Sektor of a RAM-Disk */
|
||||||
@ -370,14 +339,14 @@ void InstallVDISK(VOID)
|
|||||||
|
|
||||||
*(WORD FAR *)MK_FP(0xffff,0x002e) = 1024+64;
|
*(WORD FAR *)MK_FP(0xffff,0x002e) = 1024+64;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int init_call_XMScall( void FAR * driverAddress, UWORD ax, UWORD dx);
|
int init_call_XMScall( void FAR * driverAddress, UWORD ax, UWORD dx);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
after each driver, we try to allocate the HMA.
|
allocate HMA through XMS driver
|
||||||
it might be HIMEM.SYS we just loaded.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ClaimHMA(VOID)
|
void ClaimHMA(VOID)
|
||||||
@ -412,7 +381,7 @@ void ClaimHMA(VOID)
|
|||||||
on finalize, will install a VDISK
|
on finalize, will install a VDISK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if 0 /* not necessary anymore */
|
||||||
|
|
||||||
void HMAconfig(int finalize)
|
void HMAconfig(int finalize)
|
||||||
{
|
{
|
||||||
@ -420,7 +389,8 @@ void HMAconfig(int finalize)
|
|||||||
|
|
||||||
if (finalize)
|
if (finalize)
|
||||||
InstallVDISK();
|
InstallVDISK();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this allocates some bytes from the HMA area
|
this allocates some bytes from the HMA area
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.11 2001/07/28 18:13:06 bartoldeman
|
||||||
|
; Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
;
|
||||||
; Revision 1.10 2001/07/22 01:58:58 bartoldeman
|
; Revision 1.10 2001/07/22 01:58:58 bartoldeman
|
||||||
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||||
;
|
;
|
||||||
@ -313,7 +316,7 @@ _QRemote_Fn
|
|||||||
stc
|
stc
|
||||||
int 2fh
|
int 2fh
|
||||||
mov ax,0xffff
|
mov ax,0xffff
|
||||||
jnc QRemote_Fn_out
|
jc QRemote_Fn_out
|
||||||
xor ax,ax
|
xor ax,ax
|
||||||
QRemote_Fn_out:
|
QRemote_Fn_out:
|
||||||
pop di
|
pop di
|
||||||
|
@ -37,6 +37,9 @@ BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.29 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.28 2001/07/24 16:56:29 bartoldeman
|
* Revision 1.28 2001/07/24 16:56:29 bartoldeman
|
||||||
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
||||||
*
|
*
|
||||||
@ -1503,7 +1506,7 @@ dispatch:
|
|||||||
case 0x60: /* TRUENAME */
|
case 0x60: /* TRUENAME */
|
||||||
CLEAR_CARRY_FLAG();
|
CLEAR_CARRY_FLAG();
|
||||||
if ((rc = truename(MK_FP(r->DS, r->SI),
|
if ((rc = truename(MK_FP(r->DS, r->SI),
|
||||||
adjust_far(MK_FP(r->ES, r->DI)), TRUE)) != SUCCESS)
|
adjust_far(MK_FP(r->ES, r->DI)), FALSE)) != SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.16 2001/07/28 18:13:06 bartoldeman
|
||||||
|
; Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
;
|
||||||
; Revision 1.15 2001/07/22 01:58:58 bartoldeman
|
; Revision 1.15 2001/07/22 01:58:58 bartoldeman
|
||||||
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||||
;
|
;
|
||||||
@ -676,6 +679,8 @@ __ib_end:
|
|||||||
init_tos:
|
init_tos:
|
||||||
; the last paragraph of conventional memory might become an MCB
|
; the last paragraph of conventional memory might become an MCB
|
||||||
resb 16
|
resb 16
|
||||||
|
global __init_end
|
||||||
|
__init_end:
|
||||||
init_end:
|
init_end:
|
||||||
|
|
||||||
segment _BSSEND
|
segment _BSSEND
|
||||||
@ -919,22 +924,6 @@ __HMARelocationTableEnd:
|
|||||||
; will be only ever called, if HMA (DOS=HIGH) is enabled.
|
; will be only ever called, if HMA (DOS=HIGH) is enabled.
|
||||||
; for obvious reasons it should be located at the relocation table
|
; for obvious reasons it should be located at the relocation table
|
||||||
;
|
;
|
||||||
global enableA20 ; to see it in the map
|
|
||||||
|
|
||||||
delay:
|
|
||||||
in al, 64h
|
|
||||||
delay_check:
|
|
||||||
and al, 2
|
|
||||||
jnz delay
|
|
||||||
ret
|
|
||||||
|
|
||||||
;void _EnableHMA()
|
|
||||||
;{
|
|
||||||
; OutportWithDelay(0x64, 0xd1);
|
|
||||||
; OutportWithDelay(0x60, 0xdf);
|
|
||||||
; OutportWithDelay(0x64, 0xff);
|
|
||||||
;}
|
|
||||||
|
|
||||||
global _XMSDriverAddress
|
global _XMSDriverAddress
|
||||||
_XMSDriverAddress:
|
_XMSDriverAddress:
|
||||||
dw 0 ; XMS driver, if detected
|
dw 0 ; XMS driver, if detected
|
||||||
@ -942,25 +931,6 @@ _XMSDriverAddress:
|
|||||||
|
|
||||||
global __EnableA20
|
global __EnableA20
|
||||||
__EnableA20:
|
__EnableA20:
|
||||||
cmp word [cs:_XMSDriverAddress],0
|
|
||||||
jne enableUsingXMSdriver
|
|
||||||
cmp word [cs:_XMSDriverAddress+2],0
|
|
||||||
jne enableUsingXMSdriver
|
|
||||||
|
|
||||||
|
|
||||||
; we do it ourself, without an XMS driver
|
|
||||||
mov al,0d1h
|
|
||||||
out 64h,al
|
|
||||||
call delay
|
|
||||||
mov al,0dfh
|
|
||||||
out 60h,al
|
|
||||||
call delay
|
|
||||||
mov al,0ffh
|
|
||||||
out 64h,al
|
|
||||||
call delay
|
|
||||||
retf
|
|
||||||
|
|
||||||
enableUsingXMSdriver:
|
|
||||||
mov ah,3
|
mov ah,3
|
||||||
UsingXMSdriver:
|
UsingXMSdriver:
|
||||||
push bx
|
push bx
|
||||||
@ -971,27 +941,7 @@ UsingXMSdriver:
|
|||||||
global __DisableA20
|
global __DisableA20
|
||||||
__DisableA20:
|
__DisableA20:
|
||||||
mov ah,4
|
mov ah,4
|
||||||
cmp word [cs:_XMSDriverAddress],0
|
jmp short UsingXMSdriver
|
||||||
jne UsingXMSdriver
|
|
||||||
cmp word [cs:_XMSDriverAddress+2],0
|
|
||||||
jne UsingXMSdriver
|
|
||||||
|
|
||||||
; we do it ourself, without an XMS driver
|
|
||||||
;OutportWithDelay(0x64, 0xd1);
|
|
||||||
;OutportWithDelay(0x60, 0xdd);
|
|
||||||
;OutportWithDelay(0x64, 0xff);
|
|
||||||
mov al,0d1h
|
|
||||||
out 64h,al
|
|
||||||
call delay
|
|
||||||
mov al,0ddh
|
|
||||||
out 60h,al
|
|
||||||
call delay
|
|
||||||
mov al,0ffh
|
|
||||||
out 64h,al
|
|
||||||
call delay
|
|
||||||
|
|
||||||
retf
|
|
||||||
|
|
||||||
|
|
||||||
dslowmem dw 0
|
dslowmem dw 0
|
||||||
eshighmem dw 0ffffh
|
eshighmem dw 0ffffh
|
||||||
|
@ -62,8 +62,8 @@ extern struct dhdr FAR con_dev, /* console device drive
|
|||||||
FAR blk_dev; /* Block device (Disk) driver */
|
FAR blk_dev; /* Block device (Disk) driver */
|
||||||
extern UWORD
|
extern UWORD
|
||||||
FAR ram_top; /* How much ram in Kbytes */
|
FAR ram_top; /* How much ram in Kbytes */
|
||||||
|
|
||||||
extern iregs FAR * FAR user_r; /* User registers for int 21h call */
|
extern iregs FAR * FAR user_r; /* User registers for int 21h call */
|
||||||
|
extern BYTE FAR _HMATextEnd[];
|
||||||
|
|
||||||
#ifdef VERSION_STRINGS
|
#ifdef VERSION_STRINGS
|
||||||
static BYTE *mainRcsId = "$Id$";
|
static BYTE *mainRcsId = "$Id$";
|
||||||
@ -71,6 +71,9 @@ static BYTE *mainRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.20 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.19 2001/07/22 01:58:58 bartoldeman
|
* Revision 1.19 2001/07/22 01:58:58 bartoldeman
|
||||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||||
*
|
*
|
||||||
@ -218,8 +221,10 @@ static BYTE *mainRcsId = "$Id$";
|
|||||||
|
|
||||||
extern WORD days[2][13];
|
extern WORD days[2][13];
|
||||||
extern BYTE FAR * lpBase;
|
extern BYTE FAR * lpBase;
|
||||||
|
extern BYTE FAR * lpOldTop;
|
||||||
|
extern BYTE FAR * lpTop;
|
||||||
extern BYTE FAR * upBase;
|
extern BYTE FAR * upBase;
|
||||||
extern BYTE _ib_start[], _ib_end[];
|
extern BYTE _ib_start[], _ib_end[], _init_end[];
|
||||||
|
|
||||||
INIT VOID configDone(VOID);
|
INIT VOID configDone(VOID);
|
||||||
INIT static void InitIO(void);
|
INIT static void InitIO(void);
|
||||||
@ -282,6 +287,13 @@ INIT void init_kernel(void)
|
|||||||
/* Init oem hook - returns memory size in KB */
|
/* Init oem hook - returns memory size in KB */
|
||||||
ram_top = init_oem();
|
ram_top = init_oem();
|
||||||
|
|
||||||
|
/* move kernel to high conventional RAM, just below the init code */
|
||||||
|
lpTop = MK_FP(ram_top * 64 - (FP_OFF(_init_end)+15)/16 -
|
||||||
|
(FP_OFF(_HMATextEnd)+15)/16, 0);
|
||||||
|
|
||||||
|
MoveKernel(FP_SEG(lpTop));
|
||||||
|
lpOldTop = lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0);
|
||||||
|
|
||||||
/* Fake int 21h stack frame */
|
/* Fake int 21h stack frame */
|
||||||
user_r = (iregs FAR *) DOS_PSP + 0xD0;
|
user_r = (iregs FAR *) DOS_PSP + 0xD0;
|
||||||
|
|
||||||
@ -316,10 +328,11 @@ INIT void init_kernel(void)
|
|||||||
/* we can read config.sys later. */
|
/* we can read config.sys later. */
|
||||||
lastdrive = Config.cfgLastdrive;
|
lastdrive = Config.cfgLastdrive;
|
||||||
|
|
||||||
PreConfig();
|
|
||||||
|
|
||||||
/* init_device((struct dhdr FAR *)&blk_dev, NULL, NULL, ram_top); */
|
/* init_device((struct dhdr FAR *)&blk_dev, NULL, NULL, ram_top); */
|
||||||
blk_dev.dh_name[0] = dsk_init();
|
blk_dev.dh_name[0] = dsk_init();
|
||||||
|
|
||||||
|
PreConfig();
|
||||||
|
|
||||||
/* Number of units */
|
/* Number of units */
|
||||||
if (blk_dev.dh_name[0] > 0)
|
if (blk_dev.dh_name[0] > 0)
|
||||||
update_dcb(&blk_dev);
|
update_dcb(&blk_dev);
|
||||||
|
@ -31,6 +31,9 @@ static BYTE *mainRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.12 2001/07/28 18:13:06 bartoldeman
|
||||||
|
* Fixes for FORMAT+SYS, FATFS, get current dir, kernel init memory situation.
|
||||||
|
*
|
||||||
* Revision 1.11 2001/04/15 03:21:50 bartoldeman
|
* Revision 1.11 2001/04/15 03:21:50 bartoldeman
|
||||||
* See history.txt for the list of fixes.
|
* See history.txt for the list of fixes.
|
||||||
*
|
*
|
||||||
@ -254,7 +257,6 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
|
|||||||
static char buf[128] = "A:\\\0\0\0\0\0\0\0\0\0";
|
static char buf[128] = "A:\\\0\0\0\0\0\0\0\0\0";
|
||||||
char *bufp = buf + 3;
|
char *bufp = buf + 3;
|
||||||
COUNT i, rootEndPos = 2; /* renamed x to rootEndPos - Ron Cemer */
|
COUNT i, rootEndPos = 2; /* renamed x to rootEndPos - Ron Cemer */
|
||||||
struct cds FAR *cdsp;
|
|
||||||
struct dhdr FAR *dhp;
|
struct dhdr FAR *dhp;
|
||||||
BYTE FAR *froot;
|
BYTE FAR *froot;
|
||||||
WORD d;
|
WORD d;
|
||||||
@ -329,21 +331,20 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
|
|||||||
goto exit_tn;
|
goto exit_tn;
|
||||||
}
|
}
|
||||||
|
|
||||||
cdsp = &CDSp->cds_table[i];
|
current_ldt = &CDSp->cds_table[i];
|
||||||
current_ldt = cdsp;
|
|
||||||
|
|
||||||
/* Always give the redirector a chance to rewrite the filename */
|
/* Always give the redirector a chance to rewrite the filename */
|
||||||
fsncopy((BYTE FAR *) src, bufp -1, sizeof(buf) - (bufp - buf));
|
fsncopy((BYTE FAR *) src, bufp -1, sizeof(buf) - (bufp - buf));
|
||||||
if ((QRemote_Fn(buf, dest) == SUCCESS) && (dest[0] != '\0')) {
|
if ((t == FALSE) && (QRemote_Fn(buf, dest) == SUCCESS) && (dest[0] != '\0')) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
bufp[-1] = '\\';
|
bufp[-1] = '\\';
|
||||||
}
|
}
|
||||||
if (t == FALSE)
|
if (t == FALSE)
|
||||||
{
|
{
|
||||||
fsncopy((BYTE FAR *) & cdsp->cdsCurrentPath[0], (BYTE FAR *) & buf[0], cdsp->cdsJoinOffset);
|
fsncopy((BYTE FAR *) & current_ldt->cdsCurrentPath[0], (BYTE FAR *) & buf[0], current_ldt->cdsJoinOffset);
|
||||||
bufp = buf + cdsp->cdsJoinOffset;
|
bufp = buf + current_ldt->cdsJoinOffset;
|
||||||
rootEndPos = cdsp->cdsJoinOffset; /* renamed x to rootEndPos - Ron Cemer */
|
rootEndPos = current_ldt->cdsJoinOffset; /* renamed x to rootEndPos - Ron Cemer */
|
||||||
*bufp++ = '\\';
|
*bufp++ = '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user