Misc fixes and implementation of SHELLHIGH. See history.txt for details.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@181 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-03-30 19:30:06 +00:00
parent ac1d293d9c
commit 31b068e497
15 changed files with 257 additions and 89 deletions

View File

@ -1,5 +1,19 @@
2001 Mar 28 - Build 2023
2001 Mar 30 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Tom: Kernel alloc initialises to 0. This avoids some weird errors.
Implemented default divide by 0 handler (INT 0)
FILES= fixes from config.sys. fatfs.c ignored it and always
used the default of 16.
Misc debug code removal.
int 21/ax=3306 report running HIGH fix.
int 21/ah=69 : save CX
InitializeAllBPBs() or MakeNortonDiskEditorHappy()
More extended information if MCB chain corruption occurs.
Bart: getdpb fixes (int 21/ah=32).
fix carry handling in int 21/ah=5e.
fix {get,set}_machine_name in network.c
+ Add Support for SHELLHIGH in config.sys
2001 Mar 28 - Build 2023
+ Fixes Bug fix release 2023b: dsk.c (reported by Nagy Daniel), inthndlr and
int25/26 fixes by Tom Ehlert.
2001 Mar 27 - Build 2023

View File

@ -40,6 +40,9 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.14 2001/03/30 19:30:00 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.13 2001/03/27 20:27:27 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
@ -197,6 +200,7 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode);
INIT VOID Dosmem(BYTE * pLine);
INIT VOID Country(BYTE * pLine);
INIT VOID InitPgm(BYTE * pLine);
INIT VOID InitPgmHigh(BYTE * pLine);
INIT VOID Switchar(BYTE * pLine);
INIT VOID CfgFailure(BYTE * pLine);
INIT VOID Stacks(BYTE * pLine);
@ -251,6 +255,7 @@ static struct table commands[] =
/* rem is never executed by locking out pass */
{"REM", 0, CfgFailure},
{"SHELL", 1, InitPgm},
{"SHELLHIGH", 1, InitPgmHigh},
{"STACKS", 1, Stacks},
{"SWITCHAR", 1, Switchar},
{"SCREEN", 1, sysScreenMode}, /* JPP */
@ -322,6 +327,8 @@ INIT void PreConfig(void)
/* Initialize the file table */
f_nodes = (struct f_node FAR *)
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));
f_nodes_cnt = Config.cfgFiles;
/* sfthead = (sfttbl FAR *)&basesft; */
/* FCBp = (sfttbl FAR *)&FcbSft; */
FCBp = (sfttbl FAR *)
@ -399,7 +406,9 @@ INIT void PostConfig(void)
/* Initialize the file table */
f_nodes = (struct f_node FAR *)
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));
/* sfthead = (sfttbl FAR *)&basesft; */
f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */
/* sfthead = (sfttbl FAR *)&basesft; */
/* FCBp = (sfttbl FAR *)&FcbSft; */
FCBp = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader)
@ -920,6 +929,13 @@ INIT static VOID Stacks(BYTE * pLine)
}
}
INIT static VOID InitPgmHigh(BYTE * pLine)
{
InitPgm(pLine);
Config.cfgP_0_startmode = 0x80;
}
INIT static VOID InitPgm(BYTE * pLine)
{
/* Get the string argument that represents the new init pgm */
@ -931,6 +947,8 @@ INIT static VOID InitPgm(BYTE * pLine)
/* and add a DOS new line just to be safe */
strcat(Config.cfgInitTail, "\r\n");
Config.cfgP_0_startmode = 0;
}
INIT static VOID Break(BYTE * pLine)
@ -1101,6 +1119,8 @@ INIT BYTE FAR *KernelAlloc(WORD nBytes)
else
lpBase += nBytes;
fmemset( lpAllocated, 0, nBytes);
return lpAllocated;
}
#endif

View File

@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
* /// Added SHARE support. 2000/09/04 Ron Cemer
*
* $Log$
* Revision 1.12 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.11 2001/03/21 02:56:25 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -1419,7 +1422,7 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
BYTE DosSelectDrv(BYTE drv)
{
if ((0 <= drv) && (drv <= (lastdrive -1 )) &&(CDSp->cds_table[drv].cdsFlags & 0xf000))
if ((0 <= drv) && (drv < lastdrive) &&(CDSp->cds_table[drv].cdsFlags & 0xf000))
{
current_ldt = &CDSp->cds_table[drv];
default_drive = drv;

View File

@ -28,6 +28,9 @@
; $Id$
;
; $Log$
; Revision 1.9 2001/03/30 19:30:06 bartoldeman
; Misc fixes and implementation of SHELLHIGH. See history.txt for details.
;
; Revision 1.8 2001/03/27 20:27:43 bartoldeman
; dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
;
@ -192,6 +195,39 @@ _RestartSysCall:
jmp short int21_reentry ; restart the system call
;
; interrupt zero divide handler:
; print a message 'Interrupt divide by zero'
; Terminate the current process
;
; VOID INRPT far
; int20_handler(iregs UserRegs)
;
divide_by_zero_message db 0dh,0ah,'Interrupt divide by zero',0dh,0ah,0
global reloc_call_int0_handler
reloc_call_int0_handler:
mov si,divide_by_zero_message
zero_message_loop:
mov al, [cs:si]
test al,al
je zero_done
inc si
mov bx, 0070h
mov ah, 0eh
int 10h
jmp short zero_message_loop
zero_done:
mov ax,04c7fh ; terminate with errorlevel 127
int 21h
;
; Terminate the current process
;

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.13 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.12 2001/03/24 22:13:05 bartoldeman
* See history.txt: dsk.c changes, warning removal and int21 entry handling.
*
@ -464,7 +467,7 @@ static void merge_file_changes(struct f_node FAR *fnp, int collect) {
int i;
if (!IsShareInstalled()) return;
for (i = 0; i < NFILES; i++) {
for (i = 0; i < f_nodes_cnt; i++) {
fnp2 = &f_nodes[i];
if ( (fnp != (struct f_node FAR *)0)
&& (fnp != fnp2)
@ -2078,7 +2081,7 @@ struct f_node FAR *get_f_node(void)
{
REG i;
for (i = 0; i < NFILES; i++)
for (i = 0; i < f_nodes_cnt; i++)
{
if (f_nodes[i].f_count == 0)
{
@ -2297,7 +2300,7 @@ COUNT media_check(REG struct dpb * dpbp)
/* translate the fd into an f_node pointer */
struct f_node FAR *xlt_fd(COUNT fd)
{
return fd >= NFILES ? (struct f_node FAR *)0 : &f_nodes[fd];
return fd >= f_nodes_cnt ? (struct f_node FAR *)0 : &f_nodes[fd];
}
/* translate the f_node pointer into an fd */

View File

@ -36,6 +36,9 @@ static BYTE *Globals_hRcsId = "$Id$";
/*
* $Log$
* Revision 1.8 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.7 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -604,6 +607,8 @@ GLOBAL struct dpb
GLOBAL struct f_node FAR
* f_nodes; /* pointer to the array */
GLOBAL UWORD f_nodes_cnt; /* number of allocated f_nodes */
GLOBAL struct buffer
FAR *lastbuf; /* tail of ditto */
/* FAR * buffers; /* pointer to array of track buffers */
@ -637,6 +642,7 @@ GLOBAL struct config
WORD cfgCSYS_memory; /* number of bytes required for the NLS pkg;
0 if none */
VOID FAR *cfgCSYS_data; /* where the loaded data is for PostConfig() */
UBYTE cfgP_0_startmode; /* load command.com high or not */
} Config
#ifdef MAIN
=
@ -656,6 +662,7 @@ GLOBAL struct config
,"" /* filename */
,0 /* amount required memory */
,0 /* pointer to loaded data */
,0 /* strategy for command.com is low by default */
};
#else
;

View File

@ -75,6 +75,9 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.2 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.1 2001/03/21 03:01:45 bartoldeman
* New file by Tom Ehlert for HMA initialization.
*
@ -233,8 +236,6 @@ int MoveKernelToHMA()
unsigned len;
int3();
if (DosLoadedInHMA)
{
@ -306,7 +307,6 @@ int MoveKernelToHMA()
HMAFree = FP_OFF(HMADest)+len; /* first free byte after HMA_TEXT */
int3();
}
{
@ -388,13 +388,15 @@ int MoveKernelToHMA()
DosLoadedInHMA = TRUE;
}
/* report the fact we are running high thorugh int 21, ax=3306 */
version_flags |= 0x10;
int3();
return TRUE;
errorReturn:
printf("HMA errors, not doing HMA\n");
int3();
return FALSE;
}
@ -415,7 +417,7 @@ errorReturn:
void InstallVDISK()
{
static struct { /* Boot-Sektor of a RAM-Disk */
BYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */
UBYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */
char Name[5];
BYTE dummy2[3];
WORD BpS;
@ -529,6 +531,8 @@ VOID FAR *HMAalloc(COUNT bytesToAllocate)
/*printf("HMA allocated %d byte at %x\n", bytesToAllocate, HMAptr); */
fmemset( HMAptr,0, bytesToAllocate);
return HMAptr;
}

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.17 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.16 2001/03/27 20:27:43 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
@ -840,7 +843,10 @@ dispatch:
if (r->DL <= (lastdrive - 1))
{
struct dpb FAR *dpb = CDSp->cds_table[r->DL].cdsDpb;
if (dpb == 0)
if (dpb == 0 ||
(CDSp->cds_table[r->DL].cdsFlags & CDSNETWDRV) ||
FP_SEG(dpb) != FP_SEG(&dpb) || /* check if it's a NEAR pointer */
media_check((struct dpb *)dpb) < 0)
{
r->AL = 0xff;
CritErrCode = 0x0f;
@ -1485,6 +1491,7 @@ dispatch:
break;
case 0x5e:
CLEAR_CARRY_FLAG();
switch (r->AL)
{
case 0x00:
@ -1500,13 +1507,9 @@ dispatch:
COUNT result;
result = int2f_Remote_call(REM_PRINTSET, r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX)));
r->AX = result;
if (result != SUCCESS) {
goto error_out;
} else {
CLEAR_CARRY_FLAG();
}
break;
}
if (result != SUCCESS) goto error_out;
break;
}
}
break;
@ -1679,6 +1682,7 @@ dispatch:
rc = ( r->BL == 0 ? default_drive : r->BL - 1);
if (rc <= (lastdrive -1))
{
UWORD saveCX = r->CX;
if (CDSp->cds_table[rc].cdsFlags & CDSNETWDRV) {
goto error_invalid;
}
@ -1695,6 +1699,7 @@ dispatch:
rc = DosDevIOctl(r, (COUNT FAR *) & rc1);
break;
}
r->CX = saveCX;
if (rc1 != SUCCESS)
{
r->AX = -rc1;

View File

@ -28,6 +28,9 @@
; $Id$
;
; $Log$
; Revision 1.8 2001/03/30 19:30:06 bartoldeman
; Misc fixes and implementation of SHELLHIGH. See history.txt for details.
;
; Revision 1.7 2001/03/21 02:56:26 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones.
;
@ -235,9 +238,7 @@ dos_data db 0
times (0eh - ($ - DATASTART)) db 0
global _NetBios
_NetBios db 0 ; NetBios Number
global _Num_Name
_Num_Name db 0
_NetBios dw 0 ; NetBios Number
times (26h - 0ch - ($ - DATASTART)) db 0
@ -829,7 +830,10 @@ _low_int26_handler: jmp far reloc_call_low_int26_handler
_int27_handler: jmp far reloc_call_int27_handler
call near forceEnableA20
global _int0_handler
extern reloc_call_int0_handler
_int0_handler: jmp far reloc_call_int0_handler
call near forceEnableA20
global _cpm_entry
extern reloc_call_cpm_entry

View File

@ -39,6 +39,9 @@ static BYTE *mainRcsId = "$Id$";
/*
* $Log$
* Revision 1.10 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.9 2001/03/25 17:11:54 bartoldeman
* Fixed sys.com compilation. Updated to 2023. Also: see history.txt.
*
@ -184,6 +187,7 @@ void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
INIT VOID main(void)
{
setvec(0, int0_handler); /* zero divide */
setvec(1, empty_handler); /* single step */
setvec(3, empty_handler); /* debug breakpoint */
@ -209,6 +213,30 @@ INIT VOID main(void)
kernel();
}
/*
InitializeAllBPBs()
or MakeNortonDiskEditorHappy()
it has been determined, that FDOS's BPB tables are initialized,
only when used (like DIR H:).
at least one known utility (norton DE) seems to access them directly.
ok, so we access for all drives, that the stuff gets build
*/
void InitializeAllBPBs()
{
static char filename[] = "A:-@JUNK@-.TMP";
int drive,fileno;
for (drive = 'Z'; drive >= 'C'; drive--)
{
filename[0] = drive;
if ((fileno = dos_open((BYTE FAR *) filename, O_RDONLY)) >= 0)
dos_close(fileno);
}
}
INIT void init_kernel(void)
{
COUNT i;
@ -296,6 +324,9 @@ INIT void init_kernel(void)
version_flags = 0;
pDirFileNode = 0;
dosidle_flag = 0;
InitializeAllBPBs();
}
INIT VOID FsConfig(VOID)
@ -303,7 +334,6 @@ INIT VOID FsConfig(VOID)
REG COUNT i;
date Date;
time Time;
BYTE x;
/* Get the start-up date and time */
Date = dos_getdate();
@ -439,7 +469,6 @@ INIT void kernel()
seg asize;
BYTE FAR *ep,
*sp;
COUNT ret_code;
#ifndef KDB
static BYTE *path = "PATH=.";
#endif

View File

@ -35,6 +35,9 @@ static BYTE *memmgrRcsId = "$Id$";
/*
* $Log$
* Revision 1.10 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.9 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -518,7 +521,7 @@ COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize)
COUNT DosMemCheck(void)
{
REG mcb FAR *p;
REG mcb FAR *u;
REG mcb FAR *pprev = 0;
/* Initialize */
p = para2far(first_mcb);
@ -528,9 +531,15 @@ COUNT DosMemCheck(void)
{
/* check for corruption */
if (p->m_type != MCB_NORMAL)
{
printf("dos mem corrupt, first_mcb=%04x\n", first_mcb);
hexd("prev " ,pprev,16);
hexd("notMZ",p,16);
return DE_MCBDESTRY;
}
/* not corrupted - but not end, bump the pointer */
pprev = p;
p = nxtMCB(p);
}
return SUCCESS;

View File

@ -36,6 +36,9 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.9 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.8 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -75,25 +78,20 @@ static BYTE *RcsId = "$Id$";
*
*/
/* see RBIL D-2152 and D-215D06 before attempting
to change these two functions!
*/
UWORD get_machine_name(BYTE FAR * netname)
{
BYTE FAR *xn;
xn = MK_FP(net_name, 0);
fbcopy((BYTE FAR *) netname, xn, 15);
fmemcpy(netname, &net_name, 15);
return (NetBios);
}
VOID set_machine_name(BYTE FAR * netname, UWORD name_num)
{
BYTE FAR *xn;
xn = MK_FP(net_name, 0);
NetBios = name_num;
fbcopy(xn, (BYTE FAR *) netname, 15);
fmemcpy(&net_name, netname, 15);
net_set_count++;
}
/*
@ -161,44 +159,7 @@ COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp )
dmp->dm_date = SDp->dir_date;
dmp->dm_size = (LONG) SDp->dir_size;
/*
Needed Code Rep-off.;)
*/
/*
p = dmp->dm_name;
if (SDp->dir_name[0] == '.')
{
for (x = 0, q = (BYTE FAR *) SDp->dir_name; x < FNAME_SIZE; x++)
{
if (*q == ' ')
break;
*p++ = *q++;
}
}
else
{
for (x = 0, q = (BYTE FAR *) SDp->dir_name; x < FNAME_SIZE; x++)
{
if (*q == ' ')
break;
*p++ = *q++;
}
if (SDp->dir_ext[0] != ' ')
{
*p++ = '.';
for (x = 0, q = (BYTE FAR *) SDp->dir_ext; x < FEXT_SIZE; x++)
{
if (*q == ' ')
break;
*p++ = *q++;
}
}
}
*p++ = NULL;
*/
ConvertName83ToNameSZ((BYTE FAR *) dmp->dm_name, (BYTE FAR *) SDp->dir_name);
return i;
}

View File

@ -34,6 +34,9 @@ static BYTE *prfRcsId = "$Id$";
/*
* $Log$
* Revision 1.6 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.5 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -41,6 +44,9 @@ static BYTE *prfRcsId = "$Id$";
* recoded for smaller object footprint, added main() for testing+QA
*
* $Log$
* Revision 1.6 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.5 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -348,6 +354,20 @@ do_outputstring:
return 0;
}
void hexd(char *title,UBYTE FAR *p,COUNT numBytes)
{
int loop;
printf("%s%04x|",title,p);
for (loop = 0; loop < numBytes; loop++)
printf("%02x ", p[loop]);
printf("|");
for (loop = 0; loop < numBytes; loop++)
printf("%c", p[loop] < 0x20 ? '.' : p[loop]);
printf("\n");
}
#ifdef TEST
/*

View File

@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
/*
* $Log$
* Revision 1.12 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.11 2001/03/27 20:27:43 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
@ -243,6 +246,8 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2);
COUNT DosMkdir(BYTE FAR * dir);
COUNT DosRmdir(BYTE FAR * dir);
struct dhdr FAR * IsDevice(BYTE FAR * FileName);
/* extern sft FAR *get_free_sft(WORD FAR * sft_idx);
#define FcbGetFreeSft(sft_idx) get_free_sft(sft_idx) */
/*dosidle.asm */
VOID DosIdle_int(void);
@ -269,6 +274,7 @@ COUNT dir_write(REG struct f_node FAR * fnp);
VOID dir_close(REG struct f_node FAR * fnp);
COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name);
COUNT dos_findnext(void);
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName);
/* fatfs.c */
__FAR_WRAPPER(COUNT, dos_open, (BYTE FAR * path, COUNT flag))
@ -353,6 +359,7 @@ BOOL FcbFindNext(xfcb FAR * lpXfcb);
/* inithma.c */
int MoveKernelToHMA(void);
VOID FAR *HMAalloc(COUNT bytesToAllocate);
/* initoem.c */
UWORD init_oem(void);
@ -375,6 +382,7 @@ VOID INRPT FAR int28_handler(void);
VOID INRPT FAR int2a_handler(void);
VOID INRPT FAR int2f_handler(void);
VOID INRPT FAR empty_handler(void);
VOID INRPT FAR int0_handler(void);
/* ioctl.c */
COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err);
@ -454,6 +462,7 @@ UWORD syscall_MUX14(DIRECT_IREGS);
VOID put_console(COUNT c);
__FAR_WRAPPER(WORD, printf, (CONST BYTE * fmt,...))
WORD sprintf(BYTE * buff, CONST BYTE * fmt,...);
VOID hexd(char *title,VOID FAR *p,COUNT numBytes);
/* strings.c */
__FAR_WRAPPER(COUNT, strlen, (REG BYTE * s))
@ -547,8 +556,3 @@ unsigned long FAR is_dosemu(void);
*/
#define ASSERT_CONST(x) { typedef struct { char x[2 * (x) - 1]; } xx ; }
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName);
VOID FAR *HMAalloc(COUNT bytesToAllocate);

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.8 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details.
*
* Revision 1.7 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones.
*
@ -149,6 +152,8 @@ static BYTE *RcsId = "$Id$";
#define LOAD 1
#define OVERLAY 3
#define LOAD_HIGH 0x80
static exe_header header;
#define CHUNK 32256
@ -176,7 +181,7 @@ LONG doslseek(COUNT fd, LONG foffset, COUNT origin)
LONG DosGetFsize(COUNT hndl)
{
sft FAR *s;
sfttbl FAR *sp;
/* sfttbl FAR *sp;*/
/* Test that the handle is valid */
if (hndl < 0)
@ -444,8 +449,8 @@ set_name:
COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
{
COUNT rc,
err,
env_size;
err
/*,env_size*/;
COUNT nread;
UWORD mem;
UWORD env,
@ -456,6 +461,11 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
iregs FAR *irp;
LONG com_size;
int ModeLoadHigh = mode & 0x80;
int UMBstate = uppermem_link;
mode &= 0x7f;
if (mode != OVERLAY)
{
@ -470,6 +480,12 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
return rc;
}
com_size = asize;
if ( ModeLoadHigh && uppermem_root)
{
DosUmbLink(1); /* link in UMB's */
}
/* Allocate our memory and pass back any errors */
if ((rc = DosMemAlloc((seg) com_size, mem_access_mode, (seg FAR *) & mem
,(UWORD FAR *) & asize)) < 0)
@ -500,6 +516,12 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
}
else
mem = exp->load.load_seg;
if ( ModeLoadHigh && uppermem_root)
{
DosUmbLink(UMBstate); /* restore link state */
}
/* Now load the executable */
/* If file not found - error */
@ -596,7 +618,7 @@ VOID return_user(void)
FAR * q;
REG COUNT i;
iregs FAR *irp;
long j;
/* long j;*/
/* restore parent */
p = MK_FP(cu_psp, 0);
@ -630,11 +652,11 @@ VOID return_user(void)
exec_user((iregs FAR *) q->ps_stack);
}
static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
{
COUNT rc,
err,
env_size,
/*env_size,*/
i;
COUNT nBytesRead;
UWORD mem,
@ -652,6 +674,12 @@ static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
seg FAR *spot;
LONG exe_size;
int ModeLoadHigh = mode & 0x80;
int UMBstate = uppermem_link;
mode &= 0x7f;
/* Clone the environement and create a memory arena */
if (mode != OVERLAY)
{
@ -675,7 +703,7 @@ static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
/* and finally add in the psp size */
if (mode != OVERLAY)
image_size += sizeof(psp); /*TE 03/20/01*/
if (mode != OVERLAY)
{
/* Now find out how many paragraphs are available */
@ -704,11 +732,18 @@ static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
overlay (replace) the current exe file with a new one.
Jun 11, 2000 - rbc
} */
if ( ModeLoadHigh && uppermem_root)
{
DosUmbLink(1); /* link in UMB's */
}
/* Allocate our memory and pass back any errors */
/* We can still get an error on first fit if the above */
/* returned size was a bet fit case */
if ((rc = DosMemAlloc((seg) exe_size, mem_access_mode, (seg FAR *) & mem
/* ModeLoadHigh = 80 = try high, then low */
if ((rc = DosMemAlloc((seg) exe_size, mem_access_mode | ModeLoadHigh, (seg FAR *) & mem
,(UWORD FAR *) & asize)) < 0)
{
if (rc == DE_NOMEM)
@ -737,6 +772,10 @@ static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
/* with no error, we got exactly what we asked for */
asize = exe_size;
#ifdef DEBUG
printf("loading %s at %04x\n", (char*)namep,mem);
#endif
/* /// Added open curly brace and "else" clause. We should not attempt
to allocate memory if we are overlaying the current process, because
the new process will simply re-use the block we already have allocated.
@ -747,6 +786,12 @@ static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
else
asize = exe_size;
/* /// End of additions. Jun 11, 2000 - rbc */
if ( ModeLoadHigh && uppermem_root)
{
DosUmbLink(UMBstate); /* restore link state */
}
if (mode != OVERLAY)
{
@ -905,7 +950,7 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
COUNT rc,
err;
exec_blk leb = *ep;
BYTE FAR *cp;
/* BYTE FAR *cp;*/
BOOL bIsCom = FALSE;
/* If file not found - free ram and return error */
@ -918,6 +963,7 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
return DE_FILENOTFND;
}
if (DosRead(rc, sizeof(exe_header), (VOID FAR *) & header, &err)
!= sizeof(exe_header))
{
@ -955,6 +1001,8 @@ VOID InitPSP(VOID)
new_psp(p, 0);
}
UBYTE P_0_startmode = 0;
/* process 0 */
VOID FAR reloc_call_p_0(VOID)
{
@ -979,7 +1027,8 @@ VOID FAR reloc_call_p_0(VOID)
#ifdef DEBUG
printf("Process 0 starting: %s\n\n", (BYTE *) szfInitialPrgm);
#endif
if ((rc = DosExec(0, (exec_blk FAR *) & exb, szfInitialPrgm)) != SUCCESS)
if ((rc = DosExec(Config.cfgP_0_startmode,
(exec_blk FAR *) & exb, szfInitialPrgm)) != SUCCESS)
printf("\nBad or missing Command Interpreter: %d\n", rc);
else
printf("\nSystem shutdown complete\nReboot now.\n");