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)
|
||||
+ fixes Tom
|
||||
* dyninit allocation fix
|
||||
|
@ -44,4 +44,4 @@ static BYTE *date_hRcsId = "$Id$";
|
||||
#define REVISION_MINOR 1
|
||||
#define REVISION_SEQ 24
|
||||
#define BUILD 2024
|
||||
#define SUB_BUILD "e"
|
||||
#define SUB_BUILD "f"
|
||||
|
135
kernel/config.c
135
kernel/config.c
@ -89,6 +89,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $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
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
@ -272,7 +275,8 @@ struct config Config
|
||||
|
||||
BYTE FAR *lpBase;
|
||||
BYTE FAR *upBase;
|
||||
static BYTE FAR *lpOldLast;
|
||||
BYTE FAR *lpTop;
|
||||
BYTE FAR *lpOldTop;
|
||||
static COUNT nCfgLine;
|
||||
static COUNT nPass;
|
||||
COUNT UmbState;
|
||||
@ -364,7 +368,11 @@ INIT BYTE FAR *KernelAllocDma(WORD);
|
||||
|
||||
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)
|
||||
{
|
||||
@ -374,7 +382,7 @@ void FAR * ConfigAlloc(COUNT 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;
|
||||
}
|
||||
@ -390,14 +398,6 @@ INIT void PreConfig(void)
|
||||
|
||||
/* Initialize the base memory pointers */
|
||||
|
||||
DynFree(0);
|
||||
|
||||
|
||||
if ( HMATextIsAvailable )
|
||||
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _HMATextAvailable);
|
||||
else
|
||||
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _InitTextStart);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
extern BYTE FAR internal_data[];
|
||||
@ -412,7 +412,6 @@ INIT void PreConfig(void)
|
||||
|
||||
|
||||
|
||||
config_init_buffers( Config.cfgBuffers );
|
||||
/* buffers = (struct buffer FAR *)
|
||||
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
||||
#ifdef DEBUG
|
||||
@ -423,7 +422,6 @@ INIT void PreConfig(void)
|
||||
/* f_nodes = (f_node_ptr)
|
||||
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));*/
|
||||
|
||||
|
||||
f_nodes = (f_node_ptr)
|
||||
DynAlloc("f_nodes", Config.cfgFiles , sizeof(struct f_node));
|
||||
|
||||
@ -433,6 +431,11 @@ INIT void PreConfig(void)
|
||||
/* FCBp = (sfttbl FAR *)
|
||||
KernelAlloc(sizeof(sftheader)
|
||||
+ Config.cfgFiles * sizeof(sft));*/
|
||||
|
||||
lpBase = AlignParagraph((BYTE FAR *)DynLast()+0x0f);
|
||||
|
||||
config_init_buffers( Config.cfgBuffers);
|
||||
|
||||
sfthead->sftt_next = (sfttbl FAR *)
|
||||
KernelAlloc(sizeof(sftheader)
|
||||
+ (Config.cfgFiles-5) * sizeof(sft));
|
||||
@ -446,7 +449,7 @@ INIT void PreConfig(void)
|
||||
KernelAlloc(blk_dev.dh_name[0]*sizeof(struct dpb));
|
||||
|
||||
#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(" sft table 0x%p\n",sfthead->sftt_next);
|
||||
printf(" CDS table 0x%p\n",CDSp);
|
||||
@ -487,10 +490,8 @@ INIT void PostConfig(void)
|
||||
|
||||
/* initialize NEAR allocated things */
|
||||
|
||||
DynFree(Config.cfgFiles * sizeof(struct f_node));
|
||||
|
||||
|
||||
/* Initialize the file table */
|
||||
DynFree(f_nodes);
|
||||
f_nodes = (f_node_ptr)
|
||||
DynAlloc("f_nodes", Config.cfgFiles , sizeof(struct f_node));
|
||||
|
||||
@ -505,26 +506,11 @@ INIT void PostConfig(void)
|
||||
and allocation starts after the kernel.
|
||||
*/
|
||||
|
||||
if ( HMATextIsAvailable )
|
||||
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));
|
||||
|
||||
|
||||
lpOldLast = lpBase;
|
||||
|
||||
/* Begin by initializing our system buffers */
|
||||
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
||||
#ifdef DEBUG
|
||||
@ -534,13 +520,6 @@ INIT void PostConfig(void)
|
||||
|
||||
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; */
|
||||
/* FCBp = (sfttbl FAR *)&FcbSft; */
|
||||
/* FCBp = (sfttbl FAR *)
|
||||
@ -560,7 +539,7 @@ INIT void PostConfig(void)
|
||||
|
||||
|
||||
#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(" sft table 0x%p\n",sfthead->sftt_next);
|
||||
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 */
|
||||
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) {
|
||||
|
||||
@ -713,6 +704,10 @@ INIT VOID DoConfig(VOID)
|
||||
bEof = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* immediately convert to upper case */
|
||||
*pLine = toupper(*pLine);
|
||||
|
||||
if (pLine >= szLine + sizeof(szLine)-3)
|
||||
{
|
||||
CfgFailure(pLine);
|
||||
@ -1033,7 +1028,7 @@ INIT static VOID Lastdrive(BYTE * pLine)
|
||||
INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
{
|
||||
BYTE *pTmp;
|
||||
BYTE UMBwanted = FALSE, HMAwanted = FALSE;
|
||||
BYTE UMBwanted = FALSE;
|
||||
|
||||
/* extern BYTE FAR INITDataSegmentClaimed; */
|
||||
|
||||
@ -1047,7 +1042,7 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
for (pTmp = szBuf ; ; )
|
||||
{
|
||||
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; }*/
|
||||
pTmp = skipwh(pTmp);
|
||||
|
||||
@ -1062,10 +1057,9 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
uppermem_root = 0;
|
||||
UmbState = UMBwanted ? 2 : 0;
|
||||
}
|
||||
|
||||
if (HMAwanted)
|
||||
{
|
||||
HMATextIsAvailable = MoveKernelToHMA();
|
||||
/* Check if HMA is available straight away */
|
||||
if (HMAState == HMA_REQ && MoveKernelToHMA()){
|
||||
HMAState = HMA_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1280,27 +1274,6 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||
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 */
|
||||
strcat(szBuf, "\r\n");
|
||||
|
||||
@ -1322,9 +1295,14 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||
dhp->dh_next = nul_dev.dh_next;
|
||||
nul_dev.dh_next = dhp;
|
||||
}
|
||||
|
||||
HMAconfig(FALSE); /* let the HMA claim HMA usage */
|
||||
|
||||
/* We could just have loaded FDXMS or HIMEM */
|
||||
if (HMAState == HMA_REQ && MoveKernelToHMA())
|
||||
{
|
||||
/* final HMA processing: */
|
||||
/* final buffer processing, now upwards */
|
||||
HMAState = HMA_DONE;
|
||||
config_init_buffers( Config.cfgBuffers);
|
||||
}
|
||||
}
|
||||
else
|
||||
CfgFailure(pLine);
|
||||
@ -1580,6 +1558,7 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
REG WORD i;
|
||||
struct buffer FAR *pbuffer;
|
||||
int HMAcount = 0;
|
||||
BYTE FAR *tmplpBase = lpBase;
|
||||
|
||||
anzBuffers = max(anzBuffers,6);
|
||||
if (anzBuffers > 99)
|
||||
@ -1588,6 +1567,11 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
anzBuffers = 99;
|
||||
}
|
||||
|
||||
lpTop = lpOldTop;
|
||||
|
||||
if (HMAState == HMA_NONE || HMAState == HMA_REQ)
|
||||
lpTop = lpBase = lpTop - anzBuffers * (sizeof (struct buffer) + 0xf);
|
||||
|
||||
firstbuf = ConfigAlloc(sizeof (struct buffer));
|
||||
|
||||
pbuffer = firstbuf;
|
||||
@ -1606,7 +1590,7 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
pbuffer->b_offset_hi = 0;
|
||||
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))
|
||||
pbuffer->b_next = ConfigAlloc(sizeof (struct buffer));
|
||||
@ -1617,9 +1601,10 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
pbuffer = pbuffer->b_next;
|
||||
}
|
||||
|
||||
if (HMAcount > 0)
|
||||
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
||||
HMAcount, HMAcount*sizeof (struct buffer));
|
||||
DebugPrintf(("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
||||
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
|
||||
*
|
||||
* $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
|
||||
* 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)
|
||||
{
|
||||
BYTE FAR *cp;
|
||||
|
||||
/* next - "log" in the drive */
|
||||
drive = (drive == 0 ? default_drive : drive - 1);
|
||||
|
||||
@ -1182,8 +1187,11 @@ COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
||||
|
||||
current_ldt = &CDSp->cds_table[drive];
|
||||
|
||||
fsncopy((BYTE FAR *) & current_ldt->cdsCurrentPath[1 + current_ldt->cdsJoinOffset],
|
||||
s, 64);
|
||||
cp = ¤t_ldt->cdsCurrentPath[current_ldt->cdsJoinOffset];
|
||||
if (*cp == '\0')
|
||||
s[0]='\0';
|
||||
else
|
||||
fstrncpy(s, cp+1, 64);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -1264,7 +1272,7 @@ STATIC VOID pop_dmp(dmatch FAR * dmp)
|
||||
|
||||
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
{
|
||||
COUNT nDrive, rc;
|
||||
COUNT rc;
|
||||
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
||||
BYTE FAR *p;
|
||||
|
||||
@ -1277,6 +1285,10 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
- Ron Cemer */
|
||||
|
||||
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));
|
||||
|
||||
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 */
|
||||
|
||||
nDrive=get_verify_drive(name);
|
||||
if (nDrive < 0)
|
||||
return nDrive;
|
||||
SAttr = (BYTE) attr;
|
||||
|
||||
current_ldt = &CDSp->cds_table[nDrive];
|
||||
|
||||
#if defined(FIND_DEBUG)
|
||||
printf("Remote Find: n='%Fs\n", PriPathName);
|
||||
#endif
|
||||
@ -1324,12 +1331,10 @@ COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name)
|
||||
|
||||
dta = p;
|
||||
|
||||
if (rc != SUCCESS)
|
||||
return rc;
|
||||
|
||||
fmemcpy(dta, TempBuffer, 21);
|
||||
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)
|
||||
@ -1371,12 +1376,9 @@ COUNT DosFindNext(void)
|
||||
dos_findnext();
|
||||
|
||||
dta = p;
|
||||
if (rc != SUCCESS)
|
||||
return rc;
|
||||
|
||||
fmemcpy(dta, TempBuffer, 21);
|
||||
pop_dmp((dmatch FAR *)dta);
|
||||
return SUCCESS;
|
||||
return rc;
|
||||
}
|
||||
|
||||
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 "globals.h"
|
||||
#include "dyndata.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dskRcsId = "$Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* $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
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
@ -216,11 +221,10 @@ struct FS_info
|
||||
BYTE fstype[8];
|
||||
};
|
||||
|
||||
ddt *pddt0; /* Internal media info structs */
|
||||
/* STATIC bpb *bpbptrs[NDEV]; pointers to bpbs */
|
||||
extern struct DynS Dyn;
|
||||
|
||||
/*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
|
||||
table partition */
|
||||
|
@ -9,16 +9,11 @@
|
||||
moveable and Dyn.Buffer resizable, but not before
|
||||
*/
|
||||
|
||||
void *DynAlloc(char far *what, unsigned num, unsigned size);
|
||||
void DynFree(unsigned memory_needed);
|
||||
void far *DynAlloc(char *what, unsigned num, unsigned size);
|
||||
void far *DynLast(void);
|
||||
void DynFree(void *ptr);
|
||||
|
||||
struct DynS {
|
||||
unsigned Allocated;
|
||||
unsigned UsedByDiskInit;
|
||||
unsigned AllocMax;
|
||||
char Buffer[NDEV*sizeof(ddt) /* for InitDisk - Drive Data Table */
|
||||
+ 16 * 71 /* initial f_nodes */
|
||||
+200 /* give some extra bytes */
|
||||
];
|
||||
char Buffer[0];
|
||||
};
|
||||
|
@ -50,55 +50,34 @@ additionally:
|
||||
|
||||
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;
|
||||
|
||||
#ifndef DEBUG
|
||||
UNREFERENCED_PARAMETER(what);
|
||||
#endif
|
||||
|
||||
DebugPrintf(("DYNDATA:allocating %Fs - %u * %u bytes, total %u, %u..%u\n",
|
||||
what, num, size, total, Dyn.Allocated,Dyn.Allocated+total));
|
||||
|
||||
if (total > Dyn.AllocMax - Dyn.Allocated)
|
||||
if ((ULONG)total + Dyn.Allocated > 0xffff)
|
||||
{
|
||||
printf("DYNDATA overflow");
|
||||
printf("PANIC:Dyn %lu\n", (ULONG)total + Dyn.Allocated);
|
||||
for (;;);
|
||||
}
|
||||
now = (void*)&Dyn.Buffer[Dyn.Allocated];
|
||||
|
||||
DebugPrintf(("DYNDATA:allocating %s - %u * %u bytes, total %u, %u..%u\n",
|
||||
what, num, size, total, Dyn.Allocated,Dyn.Allocated+total));
|
||||
|
||||
now = (void far *)&Dyn.Buffer[Dyn.Allocated];
|
||||
fmemset(now, 0, total);
|
||||
|
||||
Dyn.Allocated += total;
|
||||
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
void DynFree(unsigned memory_needed)
|
||||
void DynFree(void *ptr)
|
||||
{
|
||||
if (memory_needed == 0) /* this is pass 0 */
|
||||
{
|
||||
|
||||
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));
|
||||
Dyn.Allocated = (char *)ptr - (char *)Dyn.Buffer;
|
||||
}
|
||||
|
||||
void FAR *DynLast()
|
||||
|
@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $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
|
||||
* 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 */
|
||||
/* the root and return only the first entry that contains the */
|
||||
/* volume id bit set. */
|
||||
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
|
||||
if (attr & D_VOLID)
|
||||
{
|
||||
szDirName[2] = '\\';
|
||||
szDirName[3] = '\0';
|
||||
@ -676,7 +679,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE *name)
|
||||
fbcopy((BYTE FAR *) SearchDir.dir_name, dmp->dm_name_pat,
|
||||
FNAME_SIZE + FEXT_SIZE);
|
||||
|
||||
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
|
||||
if (attr & D_VOLID)
|
||||
{
|
||||
/* Now do the search */
|
||||
while (dir_read(fnp) == DIRENT_SIZE)
|
||||
|
@ -47,6 +47,9 @@ BYTE *RcsId = "$Id$";
|
||||
* performance killer on large drives. (~0.5 sec /dos_mkdir) TE
|
||||
*
|
||||
* $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
|
||||
* 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. */
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
@ -366,20 +368,14 @@ COUNT dos_close(COUNT fd)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
if (fnp->f_mode != RDONLY)
|
||||
{
|
||||
/*TE experimental */
|
||||
if (fnp->f_flags.f_dmod)
|
||||
if (fnp->f_mode != RDONLY && fnp->f_flags.f_dmod)
|
||||
{
|
||||
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 */
|
||||
}
|
||||
|
||||
fnp->f_dir.dir_size = fnp->f_highwater;
|
||||
fnp->f_flags.f_dmod = TRUE;
|
||||
merge_file_changes(fnp, FALSE); /* /// Added - Ron Cemer */
|
||||
}
|
||||
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 */
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
@ -668,7 +663,6 @@ COUNT dos_delete(BYTE * path)
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
@ -720,7 +714,6 @@ COUNT dos_rmdir(BYTE * path)
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(path, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
@ -742,9 +735,9 @@ COUNT dos_rmdir(BYTE * path)
|
||||
|
||||
/* directories may have attributes, too. at least my WinNT disk
|
||||
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);
|
||||
return DE_ACCESS;
|
||||
@ -826,7 +819,6 @@ COUNT dos_rename(BYTE * path1, BYTE * path2)
|
||||
/* new file name and name of new file name */
|
||||
if ((fnp2 = split_path(path2, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp2);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
@ -842,7 +834,6 @@ COUNT dos_rename(BYTE * path1, BYTE * path2)
|
||||
/* old file name and name of old file name */
|
||||
if ((fnp1 = split_path(path1, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp1);
|
||||
dir_close(fnp2);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
@ -1192,7 +1183,6 @@ COUNT dos_mkdir(BYTE * dir)
|
||||
/* path to new directory and name of new directory */
|
||||
if ((fnp = split_path(dir, szFileName, szFileExt)) == NULL)
|
||||
{
|
||||
dir_close(fnp);
|
||||
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 */
|
||||
ret_cnt += xfr_cnt;
|
||||
to_xfer -= xfr_cnt;
|
||||
@ -2439,9 +2426,13 @@ STATIC VOID shrink_file(f_node_ptr fnp)
|
||||
UCOUNT next,st;
|
||||
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 */
|
||||
|
||||
if (fnp->f_offset) fnp->f_offset--; /* last existing cluster */
|
||||
|
||||
if (map_cluster(fnp, XFR_READ) != SUCCESS) /* error, don't truncate */
|
||||
goto done;
|
||||
|
||||
@ -2457,7 +2448,7 @@ STATIC VOID shrink_file(f_node_ptr fnp)
|
||||
goto done;
|
||||
|
||||
/* 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. */
|
||||
/* 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 */
|
||||
/* -- must be at least 3 */
|
||||
#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
|
||||
*/
|
||||
extern ddt * FAR pddt0; /* Pointer to drive data tables */
|
||||
|
||||
extern UBYTE FAR DiskTransferBuffer[1 * SEC_SIZE];
|
||||
|
||||
extern COUNT FAR nUnits;
|
||||
@ -190,6 +188,16 @@ struct DriveParamS
|
||||
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
|
||||
*/
|
||||
@ -376,10 +384,9 @@ VOID CalculateFATData(ddt FAR *pddt, ULONG NumSectors, UBYTE FileSystem)
|
||||
|
||||
|
||||
void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
ULONG StartSector, ULONG NumSectors, UBYTE FileSystem)
|
||||
ULONG StartSector, struct PartTableEntry *pEntry)
|
||||
{
|
||||
extern struct DynS FAR Dyn;
|
||||
ddt FAR *pddt = &((ddt FAR *)&Dyn.Buffer[0])[nUnits];
|
||||
ddt FAR *pddt = DynAlloc("ddt", 1, sizeof(ddt));
|
||||
struct CHS chs;
|
||||
|
||||
if ( nUnits >= NDEV)
|
||||
@ -403,13 +410,14 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
pddt->ddt_defbpb.bpb_nheads = driveParam->chs.Head;
|
||||
pddt->ddt_defbpb.bpb_nsecs = driveParam->chs.Sector;
|
||||
pddt->ddt_defbpb.bpb_nsize = 0;
|
||||
if (NumSectors > 0xffff)
|
||||
pddt->ddt_defbpb.bpb_huge = NumSectors;
|
||||
pddt->ddt_defbpb.bpb_hidden = pEntry->RelSect;
|
||||
if (pEntry->NumSect > 0xffff)
|
||||
pddt->ddt_defbpb.bpb_huge = pEntry->NumSect;
|
||||
else
|
||||
pddt->ddt_defbpb.bpb_nsize = (UWORD)NumSectors;
|
||||
pddt->ddt_defbpb.bpb_nsize = (UWORD)(pEntry->NumSect);
|
||||
|
||||
/* sectors per cluster, sectors per FAT etc. */
|
||||
CalculateFATData(pddt, NumSectors, FileSystem);
|
||||
CalculateFATData(pddt, pEntry->NumSect, pEntry->FileSystem);
|
||||
|
||||
pddt->ddt_serialno = 0x12345678l;
|
||||
pddt->ddt_descflags = 0x200; /* drive inaccessible until bldbpb successful */
|
||||
@ -425,7 +433,7 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
||||
printCHS(" CHS= ",&chs);
|
||||
|
||||
printf(" start = %5luMB,size =%5lu",
|
||||
StartSector/2048,NumSectors/2048);
|
||||
StartSector/2048,pEntry->NumSect/2048);
|
||||
|
||||
printf("\n");
|
||||
#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
|
||||
*/
|
||||
@ -740,7 +738,7 @@ ScanForPrimaryPartitions(struct DriveParamS *driveParam,int scan_type,
|
||||
|
||||
partitionsToIgnore |= 1 << i;
|
||||
|
||||
DosDefinePartition(driveParam,partitionStart, pEntry->NumSect, pEntry->FileSystem);
|
||||
DosDefinePartition(driveParam,partitionStart, pEntry);
|
||||
|
||||
if (scan_type == SCAN_PRIMARYBOOT ||
|
||||
scan_type == SCAN_PRIMARY )
|
||||
@ -1052,19 +1050,15 @@ void ReadAllPartitionTables(void)
|
||||
|
||||
int HardDrive;
|
||||
int nHardDisk = BIOS_nrdrives();
|
||||
ddt FAR *pddt;
|
||||
bpb FAR *pbpbarray;
|
||||
int Unit;
|
||||
|
||||
extern struct DynS FAR Dyn;
|
||||
/* ddt *miarrayptr; /* Internal media info structs */
|
||||
|
||||
pddt0 = (ddt *)&Dyn.Buffer[0];
|
||||
ddt FAR *pddt;
|
||||
|
||||
/* Setup media info and BPBs arrays for floppies (this is a 360kb flop) */
|
||||
for (Unit = 0; Unit < nUnits; Unit++)
|
||||
{
|
||||
pddt = &((ddt FAR *)&Dyn.Buffer[0])[Unit];
|
||||
pddt = DynAlloc("ddt", 1, sizeof(ddt));
|
||||
|
||||
pbpbarray = &pddt->ddt_defbpb;
|
||||
|
||||
pbpbarray->bpb_nbyte = SEC_SIZE;
|
||||
@ -1138,10 +1132,6 @@ void ReadAllPartitionTables(void)
|
||||
{
|
||||
ProcessDisk(SCAN_PRIMARY2, HardDrive ,foundPartitions[HardDrive]);
|
||||
}
|
||||
|
||||
|
||||
Dyn.UsedByDiskInit = nUnits * sizeof(ddt);
|
||||
|
||||
}
|
||||
|
||||
/* disk initialization: returns number of units */
|
||||
|
@ -81,6 +81,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $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
|
||||
* LBA/FCB/FAT/SYS/Ctrl-C/ioctl fixes + memory savings
|
||||
*
|
||||
@ -106,6 +109,7 @@ static BYTE *RcsId = "$Id$";
|
||||
* initial creation
|
||||
*/
|
||||
|
||||
void ClaimHMA(VOID);
|
||||
|
||||
BYTE DosLoadedInHMA=FALSE; /* set to TRUE if loaded HIGH */
|
||||
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.
|
||||
if so, it simply leaves it on
|
||||
@ -261,20 +237,15 @@ int MoveKernelToHMA()
|
||||
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();
|
||||
|
||||
if (pXMS != NULL)
|
||||
{
|
||||
XMSDriverAddress = pXMS;
|
||||
|
||||
printf("DOSEMU ? detected XMS driver at %p\n", XMSDriverAddress);
|
||||
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -299,6 +270,8 @@ int MoveKernelToHMA()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ClaimHMA();
|
||||
|
||||
MoveKernel(0xffff);
|
||||
|
||||
|
||||
@ -326,12 +299,7 @@ errorReturn:
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* not necessary anymore : BO */
|
||||
/*
|
||||
now protect against HIMEM/FDXMS/... by simulating a VDISK
|
||||
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
|
||||
*/
|
||||
#if 0
|
||||
void InstallVDISK(VOID)
|
||||
{
|
||||
static struct { /* Boot-Sektor of a RAM-Disk */
|
||||
@ -370,14 +339,14 @@ void InstallVDISK(VOID)
|
||||
|
||||
*(WORD FAR *)MK_FP(0xffff,0x002e) = 1024+64;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int init_call_XMScall( void FAR * driverAddress, UWORD ax, UWORD dx);
|
||||
|
||||
|
||||
/*
|
||||
after each driver, we try to allocate the HMA.
|
||||
it might be HIMEM.SYS we just loaded.
|
||||
allocate HMA through XMS driver
|
||||
*/
|
||||
|
||||
void ClaimHMA(VOID)
|
||||
@ -412,7 +381,7 @@ void ClaimHMA(VOID)
|
||||
on finalize, will install a VDISK
|
||||
*/
|
||||
|
||||
|
||||
#if 0 /* not necessary anymore */
|
||||
|
||||
void HMAconfig(int finalize)
|
||||
{
|
||||
@ -421,6 +390,7 @@ void HMAconfig(int finalize)
|
||||
if (finalize)
|
||||
InstallVDISK();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
this allocates some bytes from the HMA area
|
||||
|
@ -30,6 +30,9 @@
|
||||
; $Id$
|
||||
;
|
||||
; $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
|
||||
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
;
|
||||
@ -313,7 +316,7 @@ _QRemote_Fn
|
||||
stc
|
||||
int 2fh
|
||||
mov ax,0xffff
|
||||
jnc QRemote_Fn_out
|
||||
jc QRemote_Fn_out
|
||||
xor ax,ax
|
||||
QRemote_Fn_out:
|
||||
pop di
|
||||
|
@ -37,6 +37,9 @@ BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $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
|
||||
* fixes for FCBs, DJGPP ls, DBLBYTE, dyninit allocation (2024e).
|
||||
*
|
||||
@ -1503,7 +1506,7 @@ dispatch:
|
||||
case 0x60: /* TRUENAME */
|
||||
CLEAR_CARRY_FLAG();
|
||||
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;
|
||||
break;
|
||||
|
||||
|
@ -28,6 +28,9 @@
|
||||
; $Id$
|
||||
;
|
||||
; $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
|
||||
; Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
;
|
||||
@ -676,6 +679,8 @@ __ib_end:
|
||||
init_tos:
|
||||
; the last paragraph of conventional memory might become an MCB
|
||||
resb 16
|
||||
global __init_end
|
||||
__init_end:
|
||||
init_end:
|
||||
|
||||
segment _BSSEND
|
||||
@ -919,22 +924,6 @@ __HMARelocationTableEnd:
|
||||
; will be only ever called, if HMA (DOS=HIGH) is enabled.
|
||||
; 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
|
||||
_XMSDriverAddress:
|
||||
dw 0 ; XMS driver, if detected
|
||||
@ -942,25 +931,6 @@ _XMSDriverAddress:
|
||||
|
||||
global __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
|
||||
UsingXMSdriver:
|
||||
push bx
|
||||
@ -971,27 +941,7 @@ UsingXMSdriver:
|
||||
global __DisableA20
|
||||
__DisableA20:
|
||||
mov ah,4
|
||||
cmp word [cs:_XMSDriverAddress],0
|
||||
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
|
||||
|
||||
jmp short UsingXMSdriver
|
||||
|
||||
dslowmem dw 0
|
||||
eshighmem dw 0ffffh
|
||||
|
@ -62,8 +62,8 @@ extern struct dhdr FAR con_dev, /* console device drive
|
||||
FAR blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD
|
||||
FAR ram_top; /* How much ram in Kbytes */
|
||||
|
||||
extern iregs FAR * FAR user_r; /* User registers for int 21h call */
|
||||
extern BYTE FAR _HMATextEnd[];
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *mainRcsId = "$Id$";
|
||||
@ -71,6 +71,9 @@ static BYTE *mainRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $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
|
||||
* Support for Brian's FORMAT, DJGPP libc compilation, cleanups, MSCDEX
|
||||
*
|
||||
@ -218,8 +221,10 @@ static BYTE *mainRcsId = "$Id$";
|
||||
|
||||
extern WORD days[2][13];
|
||||
extern BYTE FAR * lpBase;
|
||||
extern BYTE FAR * lpOldTop;
|
||||
extern BYTE FAR * lpTop;
|
||||
extern BYTE FAR * upBase;
|
||||
extern BYTE _ib_start[], _ib_end[];
|
||||
extern BYTE _ib_start[], _ib_end[], _init_end[];
|
||||
|
||||
INIT VOID configDone(VOID);
|
||||
INIT static void InitIO(void);
|
||||
@ -282,6 +287,13 @@ INIT void init_kernel(void)
|
||||
/* Init oem hook - returns memory size in KB */
|
||||
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 */
|
||||
user_r = (iregs FAR *) DOS_PSP + 0xD0;
|
||||
|
||||
@ -316,10 +328,11 @@ INIT void init_kernel(void)
|
||||
/* we can read config.sys later. */
|
||||
lastdrive = Config.cfgLastdrive;
|
||||
|
||||
PreConfig();
|
||||
|
||||
/* init_device((struct dhdr FAR *)&blk_dev, NULL, NULL, ram_top); */
|
||||
blk_dev.dh_name[0] = dsk_init();
|
||||
|
||||
PreConfig();
|
||||
|
||||
/* Number of units */
|
||||
if (blk_dev.dh_name[0] > 0)
|
||||
update_dcb(&blk_dev);
|
||||
|
@ -31,6 +31,9 @@ static BYTE *mainRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $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
|
||||
* 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";
|
||||
char *bufp = buf + 3;
|
||||
COUNT i, rootEndPos = 2; /* renamed x to rootEndPos - Ron Cemer */
|
||||
struct cds FAR *cdsp;
|
||||
struct dhdr FAR *dhp;
|
||||
BYTE FAR *froot;
|
||||
WORD d;
|
||||
@ -329,21 +331,20 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
goto exit_tn;
|
||||
}
|
||||
|
||||
cdsp = &CDSp->cds_table[i];
|
||||
current_ldt = cdsp;
|
||||
current_ldt = &CDSp->cds_table[i];
|
||||
|
||||
/* Always give the redirector a chance to rewrite the filename */
|
||||
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;
|
||||
} else {
|
||||
bufp[-1] = '\\';
|
||||
}
|
||||
if (t == FALSE)
|
||||
{
|
||||
fsncopy((BYTE FAR *) & cdsp->cdsCurrentPath[0], (BYTE FAR *) & buf[0], cdsp->cdsJoinOffset);
|
||||
bufp = buf + cdsp->cdsJoinOffset;
|
||||
rootEndPos = cdsp->cdsJoinOffset; /* renamed x to rootEndPos - Ron Cemer */
|
||||
fsncopy((BYTE FAR *) & current_ldt->cdsCurrentPath[0], (BYTE FAR *) & buf[0], current_ldt->cdsJoinOffset);
|
||||
bufp = buf + current_ldt->cdsJoinOffset;
|
||||
rootEndPos = current_ldt->cdsJoinOffset; /* renamed x to rootEndPos - Ron Cemer */
|
||||
*bufp++ = '\\';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user