mirror of https://github.com/FDOS/kernel.git
introduce lol structure for list of lists; avoid lots of relocations
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@592 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
05df4d89f4
commit
ed78089e0b
11
docs/copying
11
docs/copying
|
@ -2,7 +2,7 @@
|
|||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
|
|||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
|
@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
|
|||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -305,14 +305,15 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/****************************************************************/
|
||||
/* */
|
||||
/* lol.h */
|
||||
/* */
|
||||
/* DOS List of Lists structure */
|
||||
/* */
|
||||
/* Copyright (c) 2003 */
|
||||
/* Bart Oldeman */
|
||||
/* All Rights Reserved */
|
||||
/* */
|
||||
/* This file is part of DOS-C. */
|
||||
/* */
|
||||
/* DOS-C is free software; you can redistribute it and/or */
|
||||
/* modify it under the terms of the GNU General Public License */
|
||||
/* as published by the Free Software Foundation; either version */
|
||||
/* 2, or (at your option) any later version. */
|
||||
/* */
|
||||
/* DOS-C is distributed in the hope that it will be useful, but */
|
||||
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
|
||||
/* the GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public */
|
||||
/* License along with DOS-C; if not, write to the Free Software */
|
||||
/* Foundation, Inc., 59 Temple Place, Suite 330, */
|
||||
/* Boston, MA 02111-1307 USA. */
|
||||
/****************************************************************/
|
||||
|
||||
/* note: we start at DOSDS:0, but the "official" list of lists starts a
|
||||
little later at DOSDS:26 (this is what is returned by int21/ah=52) */
|
||||
|
||||
struct lol {
|
||||
char filler[0x22];
|
||||
char *inputptr; /* -4 Pointer to unread CON input */
|
||||
unsigned short first_mcb; /* -2 Start of user memory */
|
||||
struct dpb far *DPBp; /* 0 First drive Parameter Block */
|
||||
struct sfttbl far *sfthead; /* 4 System File Table head */
|
||||
struct dhdr far *clock; /* 8 CLOCK$ device */
|
||||
struct dhdr far *syscon; /* c console device */
|
||||
unsigned short maxsecbytes; /* 10 max bytes per sector for any blkdev */
|
||||
void far *inforecptr; /* 12 pointer to disk buffer info record */
|
||||
struct cds far *CDSp; /* 16 Current Directory Structure */
|
||||
struct sfttbl far *FCBp; /* 1a FCB table pointer */
|
||||
unsigned short nprotfcb; /* 1e number of protected fcbs */
|
||||
unsigned char nblkdev; /* 20 number of block devices */
|
||||
unsigned char lastdrive; /* 21 value of last drive */
|
||||
struct dhdr nul_dev; /* 22 NUL device driver header(no pointer!)*/
|
||||
unsigned char njoined; /* 34 number of joined devices */
|
||||
unsigned short specialptr; /* 35 pointer to list of spec. prog(unused)*/
|
||||
void far *setverPtr; /* 37 pointer to SETVER list */
|
||||
void (*a20ptr)(void); /* 3b pointer to fix A20 ctrl */
|
||||
unsigned short recentpsp; /* 3d PSP of most recently exec'ed prog */
|
||||
unsigned short nbuffers; /* 3f Number of buffers */
|
||||
unsigned short nlookahead; /* 41 Number of lookahead buffers */
|
||||
unsigned char BootDrive; /* 43 bootdrive (1=A:) */
|
||||
unsigned char dwordmoves; /* 44 use dword moves (unused) */
|
||||
unsigned short xmssize; /* 45 extended memory size in KB */
|
||||
struct buffer far *firstbuf; /* 47 head of buffers linked list */
|
||||
unsigned short dirtybuf; /* 4b number of dirty buffers */
|
||||
struct buffer far *lookahead;/* 4d pointer to lookahead buffer */
|
||||
unsigned short slookahead; /* 51 number of lookahead sectors */
|
||||
unsigned char bufloc; /* 53 BUFFERS loc (1=HMA) */
|
||||
struct buffer far *deblock; /* 54 pointer to workspace buffer */
|
||||
char filler2[5]; /* 58 ???/unused */
|
||||
unsigned char int24fail; /* 5d int24 fail while making i/o stat call*/
|
||||
unsigned char memstrat; /* 5e memory allocation strat during exec */
|
||||
unsigned char a20count; /* 5f nr. of int21 calls for which a20 off */
|
||||
unsigned char VgaSet; /* 60 bitflags switches=/w, int21/4b05 */
|
||||
unsigned short unpack; /* 61 offset of unpack code start */
|
||||
unsigned char uppermem_link; /* 63 UMB Link flag */
|
||||
unsigned short min_pars; /* 64 minimum para req by program execed */
|
||||
unsigned short uppermem_root;/* 66 Start of umb chain (usually 9fff) */
|
||||
unsigned short last_para; /* 68 para: start scanning during memalloc */
|
||||
/* FreeDOS specific entries */
|
||||
unsigned char os_minor; /* 6a minor DOS version */
|
||||
unsigned char os_major; /* 6b major DOS version */
|
||||
unsigned char rev_number; /* 6c minor DOS version */
|
||||
unsigned char version_flags; /* 6d DOS version flags */
|
||||
f_node_ptr f_nodes; /* 6e pointer to the array */
|
||||
unsigned short f_nodes_cnt; /* 70 number of allocated f_nodes */
|
||||
char *os_release; /* 72 near pointer to os_release string */
|
||||
};
|
|
@ -76,15 +76,15 @@ typedef struct {
|
|||
|
||||
/* SFT Table header definition */
|
||||
typedef struct _sftheader {
|
||||
struct _sfttbl FAR * /* link to next table in list */
|
||||
struct sfttbl FAR * /* link to next table in list */
|
||||
sftt_next;
|
||||
WORD sftt_count; /* # of handle definition */
|
||||
/* entries, this table */
|
||||
} sftheader;
|
||||
|
||||
/* System File Definition List */
|
||||
typedef struct _sfttbl {
|
||||
struct _sfttbl FAR * /* link to next table in list */
|
||||
typedef struct sfttbl {
|
||||
struct sfttbl FAR * /* link to next table in list */
|
||||
sftt_next;
|
||||
WORD sftt_count; /* # of handle definition */
|
||||
/* entries, this table */
|
||||
|
|
157
kernel/config.c
157
kernel/config.c
|
@ -31,6 +31,7 @@
|
|||
#include "init-mod.h"
|
||||
#include "init-dat.h"
|
||||
#include "dyndata.h"
|
||||
#include "lol.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId =
|
||||
|
@ -52,34 +53,19 @@ static BYTE *RcsId =
|
|||
|
||||
-- Bart
|
||||
*/
|
||||
extern f_node_ptr DOSFAR f_nodes; /* pointer to the array */
|
||||
extern UWORD DOSFAR f_nodes_cnt, /* number of allocated f_nodes */
|
||||
DOSFAR ASM first_mcb; /* Start of user memory */
|
||||
|
||||
extern UBYTE DOSFAR ASM lastdrive, DOSFAR ASM nblkdev, DOSFAR ASM uppermem_link;
|
||||
extern struct dhdr
|
||||
DOSTEXTFAR ASM blk_dev, /* Block device (Disk) driver */
|
||||
DOSFAR ASM nul_dev;
|
||||
extern struct buffer FAR *DOSFAR ASM firstbuf; /* head of buffers linked list */
|
||||
DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
||||
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
||||
extern struct dpb FAR *DOSFAR ASM DPBp;
|
||||
/* First drive Parameter Block */
|
||||
extern struct cds FAR *DOSFAR ASM CDSp;
|
||||
/* Current Directory Structure */
|
||||
extern sfttbl FAR *DOSFAR ASM sfthead;
|
||||
/* System File Table head */
|
||||
extern sfttbl FAR *DOSFAR ASM FCBp;
|
||||
extern struct lol ASM DOSFAR DATASTART;
|
||||
struct lol FAR *LoL = &DATASTART;
|
||||
|
||||
extern BYTE DOSFAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
FAR _HMATextEnd[], DOSFAR ASM break_ena, /* break enabled flag */
|
||||
DOSFAR os_major, /* major version number */
|
||||
DOSFAR os_minor, /* minor version number */
|
||||
DOSFAR ASM switchar, DOSFAR _InitTextStart, /* first available byte of ram */
|
||||
DOSFAR _InitTextStart, /* first available byte of ram */
|
||||
DOSFAR ReturnAnyDosVersionExpected;
|
||||
|
||||
extern UWORD DOSFAR ASM uppermem_root, DOSFAR ASM LoL_nbuffers;
|
||||
|
||||
UWORD umb_start = 0, UMB_top = 0;
|
||||
UWORD ram_top = 0; /* How much ram in Kbytes */
|
||||
|
||||
|
@ -183,7 +169,7 @@ STATIC char * stristr(char *s1, char *s2);
|
|||
#endif
|
||||
STATIC COUNT strcasecmp(REG BYTE * d, REG BYTE * s);
|
||||
STATIC int LoadCountryInfoHardCoded(char *filename, COUNT ctryCode, COUNT codePage);
|
||||
STATIC unsigned alloc(size_t size);
|
||||
STATIC void umb_init(void);
|
||||
|
||||
void HMAconfig(int finalize);
|
||||
VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */
|
||||
|
@ -297,33 +283,33 @@ void PreConfig(void)
|
|||
/* f_nodes = (f_node_ptr)
|
||||
KernelAlloc(Config.cfgFiles * sizeof(struct f_node));*/
|
||||
|
||||
f_nodes = (f_node_ptr)
|
||||
LoL->f_nodes = (f_node_ptr)
|
||||
DynAlloc("f_nodes", Config.cfgFiles, sizeof(struct f_node));
|
||||
|
||||
f_nodes_cnt = Config.cfgFiles;
|
||||
/* sfthead = (sfttbl FAR *)&basesft; */
|
||||
/* FCBp = (sfttbl FAR *)&FcbSft; */
|
||||
/* FCBp = (sfttbl FAR *)
|
||||
LoL->f_nodes_cnt = Config.cfgFiles;
|
||||
LoL->sfthead = MK_FP(FP_SEG(LoL), 0xcc); /* &(LoL->firstsftt) */
|
||||
/* LoL->FCBp = (sfttbl FAR *)&FcbSft; */
|
||||
/* LoL->FCBp = (sfttbl FAR *)
|
||||
KernelAlloc(sizeof(sftheader)
|
||||
+ Config.cfgFiles * sizeof(sft)); */
|
||||
|
||||
config_init_buffers(Config.cfgBuffers);
|
||||
|
||||
sfthead->sftt_next =
|
||||
LoL->sfthead->sftt_next =
|
||||
KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 5) * sizeof(sft), 'F', 0);
|
||||
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
|
||||
sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
|
||||
LoL->sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
|
||||
LoL->sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
|
||||
|
||||
CDSp = KernelAlloc(sizeof(struct cds) * lastdrive, 'L', 0);
|
||||
LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', 0);
|
||||
|
||||
DPBp = KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb), 'E', 0);
|
||||
LoL->DPBp = KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb), 'E', 0);
|
||||
|
||||
#ifdef DEBUG
|
||||
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);
|
||||
printf(" DPB table 0x%p\n", DPBp);
|
||||
printf("Preliminary:\n f_node 0x%x", LoL->f_nodes);
|
||||
/* printf(" FCB table 0x%p\n",LoL->FCBp);*/
|
||||
printf(" sft table 0x%p\n", LoL->sfthead->sftt_next);
|
||||
printf(" CDS table 0x%p\n", LoL->CDSp);
|
||||
printf(" DPB table 0x%p\n", LoL->DPBp);
|
||||
#endif
|
||||
|
||||
/* Done. Now initialize the MCB structure */
|
||||
|
@ -339,11 +325,11 @@ void PreConfig2(void)
|
|||
/* initialize NEAR allocated things */
|
||||
|
||||
/* Initialize the file table */
|
||||
DynFree(f_nodes);
|
||||
f_nodes = (f_node_ptr)
|
||||
DynFree(LoL->f_nodes);
|
||||
LoL->f_nodes = (f_node_ptr)
|
||||
DynAlloc("f_nodes", Config.cfgFiles, sizeof(struct f_node));
|
||||
|
||||
f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */
|
||||
LoL->f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */
|
||||
|
||||
/* Initialize the base memory pointers from last time. */
|
||||
/*
|
||||
|
@ -353,10 +339,10 @@ void PreConfig2(void)
|
|||
and allocation starts after the kernel.
|
||||
*/
|
||||
|
||||
base_seg = first_mcb = FP_SEG(AlignParagraph((BYTE FAR *) DynLast() + 0x0f));
|
||||
base_seg = LoL->first_mcb = FP_SEG(AlignParagraph((BYTE FAR *) DynLast() + 0x0f));
|
||||
|
||||
/* We expect ram_top as Kbytes, so convert to paragraphs */
|
||||
mcb_init(first_mcb, ram_top * 64 - first_mcb - 1);
|
||||
mcb_init(LoL->first_mcb, ram_top * 64 - LoL->first_mcb - 1);
|
||||
if (UmbState == 2)
|
||||
umb_init();
|
||||
}
|
||||
|
@ -379,9 +365,9 @@ void PostConfig(void)
|
|||
/* close all (device) files */
|
||||
|
||||
/* compute lastdrive ... */
|
||||
lastdrive = Config.cfgLastdrive;
|
||||
if (lastdrive < nblkdev)
|
||||
lastdrive = nblkdev;
|
||||
LoL->lastdrive = Config.cfgLastdrive;
|
||||
if (LoL->lastdrive < LoL->nblkdev)
|
||||
LoL->lastdrive = LoL->nblkdev;
|
||||
|
||||
DebugPrintf(("starting FAR allocations at %x\n", base_seg));
|
||||
|
||||
|
@ -393,27 +379,27 @@ void PostConfig(void)
|
|||
|
||||
config_init_buffers(Config.cfgBuffers);
|
||||
|
||||
/* sfthead = (sfttbl FAR *)&basesft; */
|
||||
/* FCBp = (sfttbl FAR *)&FcbSft; */
|
||||
/* FCBp = KernelAlloc(sizeof(sftheader)
|
||||
/* LoL->sfthead = (sfttbl FAR *)&basesft; */
|
||||
/* LoL->FCBp = (sfttbl FAR *)&FcbSft; */
|
||||
/* LoL->FCBp = KernelAlloc(sizeof(sftheader)
|
||||
+ Config.cfgFiles * sizeof(sft)); */
|
||||
sfthead->sftt_next = (sfttbl FAR *)
|
||||
LoL->sfthead->sftt_next = (sfttbl FAR *)
|
||||
KernelAlloc(sizeof(sftheader) + (Config.cfgFiles - 5) * sizeof(sft), 'F',
|
||||
Config.cfgFilesHigh);
|
||||
sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
|
||||
sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
|
||||
LoL->sfthead->sftt_next->sftt_next = (sfttbl FAR *) - 1;
|
||||
LoL->sfthead->sftt_next->sftt_count = Config.cfgFiles - 5;
|
||||
|
||||
CDSp = KernelAlloc(sizeof(struct cds) * lastdrive, 'L', Config.cfgLastdriveHigh);
|
||||
LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', Config.cfgLastdriveHigh);
|
||||
|
||||
DPBp = KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb), 'E',
|
||||
LoL->DPBp = KernelAlloc(blk_dev.dh_name[0] * sizeof(struct dpb), 'E',
|
||||
Config.cfgDosDataUmb);
|
||||
|
||||
#ifdef DEBUG
|
||||
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);
|
||||
printf(" DPB table 0x%p\n", DPBp);
|
||||
printf("Final: \n f_node 0x%x\n", LoL->f_nodes);
|
||||
/* printf(" FCB table 0x%p\n",LoL->FCBp);*/
|
||||
printf(" sft table 0x%p\n", LoL->sfthead->sftt_next);
|
||||
printf(" CDS table 0x%p\n", LoL->CDSp);
|
||||
printf(" DPB table 0x%p\n", LoL->DPBp);
|
||||
#endif
|
||||
if (Config.cfgStacks)
|
||||
{
|
||||
|
@ -436,9 +422,12 @@ VOID configDone(VOID)
|
|||
|
||||
if (HMAState != HMA_DONE)
|
||||
{
|
||||
seg kernel_seg = alloc((HMAFree+0xf)/16);
|
||||
mcb FAR *p = para2far(kernel_seg - 1);
|
||||
|
||||
mcb FAR *p;
|
||||
unsigned short kernel_seg;
|
||||
|
||||
allocmem((HMAFree+0xf)/16, &kernel_seg);
|
||||
p = para2far(kernel_seg - 1);
|
||||
|
||||
p->m_name[0] = 'S';
|
||||
p->m_name[1] = 'C';
|
||||
p->m_psp = 8;
|
||||
|
@ -480,12 +469,12 @@ STATIC void umb_init(void)
|
|||
UmbState = 1;
|
||||
|
||||
/* reset root */
|
||||
uppermem_root = ram_top * 64 - 1;
|
||||
LoL->uppermem_root = ram_top * 64 - 1;
|
||||
|
||||
/* create link mcb (below) */
|
||||
para2far(base_seg)->m_type = MCB_NORMAL;
|
||||
para2far(base_seg)->m_size--;
|
||||
mumcb_init(uppermem_root, umb_seg - uppermem_root - 1);
|
||||
mumcb_init(LoL->uppermem_root, umb_seg - LoL->uppermem_root - 1);
|
||||
|
||||
/* setup the real mcb for the devicehigh block */
|
||||
mcb_init(umb_seg, umb_size - 2);
|
||||
|
@ -511,7 +500,7 @@ STATIC void umb_init(void)
|
|||
mcb_init(umb_seg, umb_size - 2);
|
||||
|
||||
/* determine prev and next umbs */
|
||||
umb_prev = prev_mcb(umb_seg, uppermem_root);
|
||||
umb_prev = prev_mcb(umb_seg, LoL->uppermem_root);
|
||||
umb_next = umb_prev + para2far(umb_prev)->m_size + 1;
|
||||
para2far(umb_seg)->m_type = MCB_NORMAL;
|
||||
|
||||
|
@ -893,8 +882,8 @@ STATIC VOID sysVersion(BYTE * pLine)
|
|||
|
||||
printf("Changing reported version to %d.%d\n", major, minor);
|
||||
|
||||
os_major = major;
|
||||
os_minor = minor;
|
||||
LoL->os_major = major;
|
||||
LoL->os_minor = minor;
|
||||
}
|
||||
|
||||
STATIC VOID Files(BYTE * pLine)
|
||||
|
@ -982,8 +971,8 @@ STATIC VOID Dosmem(BYTE * pLine)
|
|||
|
||||
if (UmbState == 0)
|
||||
{
|
||||
uppermem_link = 0;
|
||||
uppermem_root = 0xffff;
|
||||
LoL->uppermem_link = 0;
|
||||
LoL->uppermem_root = 0xffff;
|
||||
UmbState = UMBwanted ? 2 : 0;
|
||||
}
|
||||
/* Check if HMA is available straight away */
|
||||
|
@ -1013,7 +1002,7 @@ STATIC VOID CfgSwitchar(BYTE * pLine)
|
|||
/* Format: SWITCHAR = character */
|
||||
|
||||
GetStringArg(pLine, szBuf);
|
||||
switchar = *szBuf;
|
||||
init_switchar(*szBuf);
|
||||
}
|
||||
|
||||
STATIC VOID Fcbs(BYTE * pLine)
|
||||
|
@ -1213,7 +1202,7 @@ STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode)
|
|||
else
|
||||
{
|
||||
base = base_seg;
|
||||
start = first_mcb;
|
||||
start = LoL->first_mcb;
|
||||
}
|
||||
|
||||
if (base == start)
|
||||
|
@ -1261,9 +1250,9 @@ STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode)
|
|||
printf("multisegmented device driver found, next %p\n", next_dhp);
|
||||
/* give warning message */
|
||||
#endif
|
||||
/* Link in device driver and save nul_dev pointer to next */
|
||||
dhp->dh_next = nul_dev.dh_next;
|
||||
nul_dev.dh_next = dhp;
|
||||
/* Link in device driver and save LoL->nul_dev pointer to next */
|
||||
dhp->dh_next = LoL->nul_dev.dh_next;
|
||||
LoL->nul_dev.dh_next = dhp;
|
||||
}
|
||||
|
||||
/* might have been the UMB driver or DOS=UMB */
|
||||
|
@ -1318,7 +1307,7 @@ void FAR * KernelAllocPara(size_t nPara, char type, char *name, int mode)
|
|||
else
|
||||
{
|
||||
base = base_seg;
|
||||
start = first_mcb;
|
||||
start = LoL->first_mcb;
|
||||
}
|
||||
|
||||
/* create the special DOS data MCB if it doesn't exist yet */
|
||||
|
@ -1360,7 +1349,7 @@ void FAR * KernelAlloc(size_t nBytes, char type, int mode)
|
|||
void FAR *p;
|
||||
size_t nPara = (nBytes + 15)/16;
|
||||
|
||||
if (first_mcb == 0)
|
||||
if (LoL->first_mcb == 0)
|
||||
{
|
||||
/* prealloc */
|
||||
lpTop = MK_FP(FP_SEG(lpTop) - nPara, FP_OFF(lpTop));
|
||||
|
@ -1634,16 +1623,17 @@ VOID config_init_buffers(COUNT anzBuffers)
|
|||
printf("BUFFERS=%u not supported, reducing to 99\n", anzBuffers);
|
||||
anzBuffers = 99;
|
||||
}
|
||||
LoL_nbuffers = anzBuffers;
|
||||
LoL->nbuffers = anzBuffers;
|
||||
|
||||
lpTop = lpOldTop;
|
||||
|
||||
firstbuf = ConfigAlloc(sizeof(struct buffer) * anzBuffers, 'B');
|
||||
LoL->inforecptr = &LoL->firstbuf;
|
||||
LoL->firstbuf = ConfigAlloc(sizeof(struct buffer) * anzBuffers, 'B');
|
||||
|
||||
pbuffer = firstbuf;
|
||||
pbuffer = LoL->firstbuf;
|
||||
|
||||
DebugPrintf(("init_buffers (size %u) at", sizeof(struct buffer)));
|
||||
DebugPrintf((" (%p)", firstbuf));
|
||||
DebugPrintf((" (%p)", LoL->firstbuf));
|
||||
|
||||
pbuffer->b_prev = FP_OFF(pbuffer + (anzBuffers-1));
|
||||
for (i = 1; i < anzBuffers; ++i)
|
||||
|
@ -2355,16 +2345,6 @@ void InstallExec(char *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC unsigned alloc(size_t size)
|
||||
{
|
||||
iregs r;
|
||||
|
||||
r.a.b.h = 0x48; /* alloc memory */
|
||||
r.b.x = size;
|
||||
init_call_intr(0x21, &r);
|
||||
return r.a.x;
|
||||
}
|
||||
|
||||
STATIC void free(seg segment)
|
||||
{
|
||||
iregs r;
|
||||
|
@ -2397,7 +2377,7 @@ VOID DoInstall(void)
|
|||
r.b.b.l = 0x02; /*low memory, last fit */
|
||||
init_call_intr(0x21, &r);
|
||||
|
||||
installMemory = alloc(((unsigned)_init_end+15)/16);
|
||||
allocmem(((unsigned)_init_end+15)/16, &installMemory);
|
||||
|
||||
InstallPrintf(("allocated memory at %x\n",installMemory));
|
||||
|
||||
|
@ -2421,4 +2401,3 @@ VOID DoInstall(void)
|
|||
InstallPrintf(("Done with installing commands\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,4 +30,3 @@ extern __segment DosTextSeg;
|
|||
#error unknown compiler - please adjust
|
||||
We might even deal with a pre-ANSI compiler. This will certainly not compile.
|
||||
#endif
|
||||
extern BYTE DOSFAR version_flags; /* minor version number */
|
||||
|
|
|
@ -147,7 +147,10 @@ int ASMCFUNC allocmem(UWORD size, seg * segp);
|
|||
VOID ASMCFUNC init_PSPInit(seg psp_seg);
|
||||
VOID ASMCFUNC init_PSPSet(seg psp_seg);
|
||||
COUNT ASMCFUNC init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
||||
int ASMCFUNC init_setdrive(int drive);
|
||||
int ASMCFUNC init_switchar(int chr);
|
||||
VOID ASMCFUNC keycheck(VOID);
|
||||
void ASMCFUNC set_DTA(void far *dta);
|
||||
|
||||
/* irqstack.asm */
|
||||
VOID ASMCFUNC init_stacks(VOID FAR * stack_base, COUNT nStacks,
|
||||
|
@ -193,3 +196,6 @@ ULONG ASMCFUNC FAR MULULUL(ULONG mul1, ULONG mul2); /* MULtiply ULong by ULo
|
|||
ULONG ASMCFUNC FAR DIVULUS(ULONG mul1, UWORD mul2); /* DIVide ULong by UShort */
|
||||
ULONG ASMCFUNC FAR DIVMODULUS(ULONG mul1, UWORD mul2, UWORD * rem); /* DIVide ULong by UShort */
|
||||
#endif
|
||||
|
||||
extern struct lol FAR *LoL;
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "portab.h"
|
||||
#include "init-mod.h"
|
||||
#include "init-dat.h"
|
||||
#include "lol.h"
|
||||
|
||||
extern BYTE FAR ASM _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR ASM _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
|
@ -246,7 +247,7 @@ int MoveKernelToHMA()
|
|||
InstallVDISK();
|
||||
|
||||
/* report the fact we are running high through int 21, ax=3306 */
|
||||
version_flags |= 0x10;
|
||||
LoL->version_flags |= 0x10;
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -323,7 +324,8 @@ void MoveKernel(unsigned NewKernelSegment)
|
|||
UBYTE FAR *HMADest;
|
||||
UBYTE FAR *HMASource;
|
||||
unsigned len;
|
||||
|
||||
unsigned jmpseg = CurrentKernelSegment;
|
||||
|
||||
if (CurrentKernelSegment == 0)
|
||||
CurrentKernelSegment = FP_SEG(_HMATextEnd);
|
||||
|
||||
|
@ -404,7 +406,7 @@ void MoveKernel(unsigned NewKernelSegment)
|
|||
for (rp = _HMARelocationTableStart; rp < _HMARelocationTableEnd; rp++)
|
||||
{
|
||||
if (rp->jmpFar != 0xea || /* jmp FAR */
|
||||
rp->jmpSegment != CurrentKernelSegment || /* will only relocate HMA_TEXT */
|
||||
rp->jmpSegment != jmpseg || /* will only relocate HMA_TEXT */
|
||||
rp->callNear != 0xe8 || /* call NEAR */
|
||||
0)
|
||||
{
|
||||
|
|
|
@ -285,6 +285,24 @@ _init_DosExec:
|
|||
exec_no_error
|
||||
ret
|
||||
|
||||
;; int init_setdrive(int drive)
|
||||
global _init_setdrive
|
||||
_init_setdrive:
|
||||
mov ah, 0x0e
|
||||
mov bx, sp
|
||||
mov dl, [bx+2]
|
||||
int 21h
|
||||
ret
|
||||
|
||||
;; int init_switchar(int char)
|
||||
global _init_switchar
|
||||
_init_switchar:
|
||||
mov ax, 0x3701
|
||||
mov bx, sp
|
||||
mov dl, [bx+2]
|
||||
int 21h
|
||||
ret
|
||||
|
||||
;; int allocmem(UWORD size, seg *segp)
|
||||
global _allocmem
|
||||
_allocmem:
|
||||
|
@ -299,3 +317,13 @@ _allocmem:
|
|||
xor ax, ax
|
||||
ret
|
||||
|
||||
;; void set_DTA(void far *dta)
|
||||
global _set_DTA
|
||||
_set_DTA
|
||||
mov ah, 1ah
|
||||
mov bx, sp
|
||||
push ds
|
||||
lds dx, [bx+2]
|
||||
int 21h
|
||||
pop ds
|
||||
ret
|
||||
|
|
|
@ -101,7 +101,7 @@ beyond_entry: resb 256-(beyond_entry-entry)
|
|||
|
||||
segment INIT_TEXT
|
||||
|
||||
extern _FreeDOSmain:wrt I_GROUP
|
||||
extern _FreeDOSmain
|
||||
|
||||
;
|
||||
; kernel start-up
|
||||
|
@ -118,7 +118,7 @@ kernel_start:
|
|||
pop bx
|
||||
pop ax
|
||||
|
||||
mov ax,I_GROUP
|
||||
mov ax,cs
|
||||
cli
|
||||
mov ss,ax
|
||||
mov sp,init_tos
|
||||
|
@ -142,23 +142,10 @@ kernel_start:
|
|||
mov ax,cont
|
||||
push ax
|
||||
retf
|
||||
cont: ; inititalize api stacks for high water tests
|
||||
mov ax,cs
|
||||
cont: mov ax,cs
|
||||
mov ss,ax
|
||||
mov di,seg apistk_bottom
|
||||
mov es,di
|
||||
mov di,apistk_bottom
|
||||
mov ax,apistk_top
|
||||
sub ax,di
|
||||
sar ax,1
|
||||
mov cx,ax
|
||||
mov ax,09090h
|
||||
cld
|
||||
rep stosw
|
||||
; Now set up call frame
|
||||
mov ax,DGROUP
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
mov ds,[cs:_INIT_DGROUP]
|
||||
mov bp,sp ; and set up stack frame for c
|
||||
sti ; now enable them
|
||||
|
||||
|
@ -230,6 +217,7 @@ _nul_intr:
|
|||
pop es
|
||||
retf
|
||||
|
||||
segment _LOWTEXT
|
||||
; floppy parameter table
|
||||
global _int1e_table
|
||||
_int1e_table: times 0eh db 0
|
||||
|
@ -278,16 +266,14 @@ _first_mcb dw 0 ;-0002 Start of user memory
|
|||
MARK0026H equ $
|
||||
_DPBp dd 0 ; 0000 First drive Parameter Block
|
||||
global _sfthead
|
||||
_sfthead dw _firstsftt ; 0004 System File Table head
|
||||
dw seg _firstsftt
|
||||
_sfthead dd 0 ; 0004 System File Table head
|
||||
global _clock
|
||||
_clock dd 0 ; 0008 CLOCK$ device
|
||||
global _syscon
|
||||
_syscon dw _con_dev,seg _con_dev ; 000c console device
|
||||
global _maxbksize
|
||||
_maxbksize dw 512 ; 0010 maximum bytes/sector of any block device
|
||||
dw buf_info ; 0012 pointer to buffers info structure
|
||||
dw seg buf_info
|
||||
dd 0 ; 0012 pointer to buffers info structure
|
||||
global _CDSp
|
||||
_CDSp dd 0 ; 0016 Current Directory Structure
|
||||
global _FCBp
|
||||
|
@ -348,6 +334,22 @@ _min_pars dw 0 ; 0064 minimum paragraphs of memory
|
|||
_uppermem_root dw 0ffffh ; 0066 dmd_upper_root (usually 9fff)
|
||||
_last_para dw 0 ; 0068 para of last mem search
|
||||
SysVarEnd:
|
||||
;; FreeDOS specific entries
|
||||
global _os_minor
|
||||
_os_minor db 0
|
||||
global _os_major
|
||||
_os_major db 5
|
||||
global _rev_number
|
||||
_rev_number db 0
|
||||
global _version_flags
|
||||
_version_flags db 0
|
||||
global _f_nodes
|
||||
_f_nodes dw 0
|
||||
global _f_nodes_cnt
|
||||
_f_nodes_cnt dw 0
|
||||
global os_release
|
||||
extern _os_release
|
||||
os_release dw _os_release
|
||||
|
||||
;; The first 5 sft entries appear to have to be at DS:00cc
|
||||
times (0cch - ($ - DATASTART)) db 0
|
||||
|
@ -438,8 +440,7 @@ _CritErrCode dw 0 ; 04 - DOS format error Code
|
|||
_CritErrAction db 0 ; 06 - Error Action Code
|
||||
_CritErrClass db 0 ; 07 - Error Class
|
||||
_CritErrDev dd 0 ; 08 - Failing Device Address
|
||||
_dta dw _sda_tmp_dm, seg _sda_tmp_dm
|
||||
; 0C - current DTA, initialize to TempBuffer.
|
||||
_dta dd 0 ; 0C - current DTA
|
||||
_cu_psp dw 0 ; 10 - Current PSP
|
||||
break_sp dw 0 ; 12 - used in int 23
|
||||
_return_code dw 0 ; 14 - return code from process
|
||||
|
@ -596,13 +597,13 @@ _FcbSearchBuffer: ; of error stack as scratch buffer
|
|||
|
||||
global apistk_bottom
|
||||
apistk_bottom:
|
||||
times STACK_SIZE dw 0 ;300 - Error Processing Stack
|
||||
times STACK_SIZE dw 0x9090 ;300 - Error Processing Stack
|
||||
global _error_tos
|
||||
_error_tos:
|
||||
times STACK_SIZE dw 0 ;480 - Disk Function Stack
|
||||
times STACK_SIZE dw 0x9090 ;480 - Disk Function Stack
|
||||
global _disk_api_tos
|
||||
_disk_api_tos:
|
||||
times STACK_SIZE dw 0 ;600 - Char Function Stack
|
||||
times STACK_SIZE dw 0x9090 ;600 - Char Function Stack
|
||||
global _char_api_tos
|
||||
_char_api_tos:
|
||||
apistk_top:
|
||||
|
@ -656,7 +657,7 @@ clk_stk_top:
|
|||
|
||||
; have a jump to the real thing here for AARD compliance
|
||||
global _CharMapSrvc ; in _DATA (see AARD)
|
||||
_CharMapSrvc: jmp far CharMapSrvc2
|
||||
_CharMapSrvc: jmp 0x70:CharMapSrvc2
|
||||
|
||||
; Dynamic data:
|
||||
; member of the DOS DATA GROUP
|
||||
|
@ -750,14 +751,6 @@ _empty_handler:
|
|||
iret
|
||||
|
||||
|
||||
; to minimize relocations
|
||||
global _DGROUP_
|
||||
_DGROUP_:
|
||||
dw DGROUP
|
||||
|
||||
|
||||
segment _LOWTEXT
|
||||
|
||||
global _initforceEnableA20
|
||||
initforceEnableA20:
|
||||
call near forceEnableA20
|
||||
|
@ -768,65 +761,65 @@ __HMARelocationTableStart:
|
|||
|
||||
global _int2f_handler
|
||||
extern reloc_call_int2f_handler
|
||||
_int2f_handler: jmp far reloc_call_int2f_handler
|
||||
_int2f_handler: jmp 0:reloc_call_int2f_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _int20_handler
|
||||
extern reloc_call_int20_handler
|
||||
_int20_handler: jmp far reloc_call_int20_handler
|
||||
_int20_handler: jmp 0:reloc_call_int20_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _int21_handler
|
||||
extern reloc_call_int21_handler
|
||||
_int21_handler: jmp far reloc_call_int21_handler
|
||||
_int21_handler: jmp 0:reloc_call_int21_handler
|
||||
call near forceEnableA20
|
||||
|
||||
|
||||
global _low_int25_handler
|
||||
extern reloc_call_low_int25_handler
|
||||
_low_int25_handler: jmp far reloc_call_low_int25_handler
|
||||
_low_int25_handler: jmp 0:reloc_call_low_int25_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _low_int26_handler
|
||||
extern reloc_call_low_int26_handler
|
||||
_low_int26_handler: jmp far reloc_call_low_int26_handler
|
||||
_low_int26_handler: jmp 0:reloc_call_low_int26_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _int27_handler
|
||||
extern reloc_call_int27_handler
|
||||
_int27_handler: jmp far reloc_call_int27_handler
|
||||
_int27_handler: jmp 0:reloc_call_int27_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _int0_handler
|
||||
extern reloc_call_int0_handler
|
||||
_int0_handler: jmp far reloc_call_int0_handler
|
||||
_int0_handler: jmp 0:reloc_call_int0_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _int6_handler
|
||||
extern reloc_call_int6_handler
|
||||
_int6_handler: jmp far reloc_call_int6_handler
|
||||
_int6_handler: jmp 0:reloc_call_int6_handler
|
||||
call near forceEnableA20
|
||||
|
||||
global _cpm_entry
|
||||
extern reloc_call_cpm_entry
|
||||
_cpm_entry: jmp far reloc_call_cpm_entry
|
||||
_cpm_entry: jmp 0:reloc_call_cpm_entry
|
||||
call near forceEnableA20
|
||||
|
||||
global _reloc_call_blk_driver
|
||||
extern _blk_driver
|
||||
_reloc_call_blk_driver:
|
||||
jmp far _blk_driver
|
||||
jmp 0:_blk_driver
|
||||
call near forceEnableA20
|
||||
|
||||
global _reloc_call_clk_driver
|
||||
extern _clk_driver
|
||||
_reloc_call_clk_driver:
|
||||
jmp far _clk_driver
|
||||
jmp 0:_clk_driver
|
||||
call near forceEnableA20
|
||||
|
||||
; global _CharMapSrvc ; in _DATA (see AARD)
|
||||
extern _reloc_call_CharMapSrvc
|
||||
CharMapSrvc2: jmp far _reloc_call_CharMapSrvc
|
||||
CharMapSrvc2: jmp 0:_reloc_call_CharMapSrvc
|
||||
call near forceEnableA20
|
||||
|
||||
|
||||
|
@ -946,6 +939,11 @@ _int24_handler: mov al,FAIL
|
|||
; this makes some things easier
|
||||
;
|
||||
|
||||
; to minimize relocations
|
||||
segment HMA_TEXT
|
||||
global _DGROUP_
|
||||
_DGROUP_ dw DGROUP
|
||||
|
||||
segment _LOWTEXT
|
||||
global _TEXT_DGROUP
|
||||
_TEXT_DGROUP dw DGROUP
|
||||
|
@ -953,4 +951,3 @@ _TEXT_DGROUP dw DGROUP
|
|||
segment INIT_TEXT
|
||||
global _INIT_DGROUP
|
||||
_INIT_DGROUP dw DGROUP
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "init-mod.h"
|
||||
#include "dyndata.h"
|
||||
#include "init-dat.h"
|
||||
#include "lol.h"
|
||||
|
||||
char copyright[] =
|
||||
"(C) Copyright 1995-2003 Pasquale J. Villani and The FreeDOS Project.\n"
|
||||
|
@ -47,24 +48,10 @@ char copyright[] =
|
|||
|
||||
-- Bart
|
||||
*/
|
||||
extern UBYTE DOSFAR ASM nblkdev, DOSFAR ASM lastdrive; /* value of last drive */
|
||||
|
||||
GLOBAL BYTE DOSFAR os_major, /* major version number */
|
||||
DOSFAR os_minor, /* minor version number */
|
||||
DOSFAR ASM default_drive; /* default drive for dos */
|
||||
GLOBAL UBYTE DOSFAR ASM BootDrive; /* Drive we came up from */
|
||||
|
||||
GLOBAL BYTE DOSFAR os_release[];
|
||||
|
||||
extern struct dpb FAR *DOSFAR ASM DPBp; /* First drive Parameter Block */
|
||||
extern struct cds FAR *DOSFAR ASM CDSp; /* Current Directory Structure */
|
||||
|
||||
extern struct dhdr FAR *DOSFAR ASM clock, /* CLOCK$ device */
|
||||
FAR * DOSFAR ASM syscon; /* console device */
|
||||
extern struct dhdr ASM DOSTEXTFAR con_dev, /* console device drive */
|
||||
DOSTEXTFAR ASM clk_dev, /* Clock device driver */
|
||||
DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
||||
extern iregs FAR *DOSFAR ASM user_r; /* User registers for int 21h call */
|
||||
extern BYTE FAR ASM _HMATextEnd[];
|
||||
|
||||
extern struct _KernelConfig FAR ASM LowKernelConfig;
|
||||
|
@ -90,7 +77,7 @@ STATIC VOID signon(VOID);
|
|||
STATIC VOID kernel(VOID);
|
||||
STATIC VOID FsConfig(VOID);
|
||||
STATIC VOID InitPrinters(VOID);
|
||||
void CheckContinueBootFromHarddisk();
|
||||
void CheckContinueBootFromHarddisk(void);
|
||||
|
||||
extern void Init_clk_driver(void);
|
||||
|
||||
|
@ -133,8 +120,6 @@ void fmemcpy(void far *dest, const void far *src, unsigned n)
|
|||
while(n--) *d++ = *s++;
|
||||
}
|
||||
|
||||
void CheckContinueBootFromHarddisk(void);
|
||||
|
||||
VOID ASMCFUNC FreeDOSmain(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
|
@ -155,10 +140,10 @@ VOID ASMCFUNC FreeDOSmain(void)
|
|||
{
|
||||
fmemcpy(&InitKernelConfig, MK_FP(0x50,0xe0+2), sizeof(InitKernelConfig));
|
||||
|
||||
BootDrive = *(BYTE FAR *)MK_FP(0x50,0xe0) + 1;
|
||||
LoL->BootDrive = *(BYTE FAR *)MK_FP(0x50,0xe0) + 1;
|
||||
|
||||
if (BootDrive >= 0x80)
|
||||
BootDrive = 3; /* C: */
|
||||
if (LoL->BootDrive >= 0x80)
|
||||
LoL->BootDrive = 3; /* C: */
|
||||
|
||||
*(DWORD FAR *)MK_FP(0x50,0xe0+2) = 0;
|
||||
}
|
||||
|
@ -167,10 +152,6 @@ VOID ASMCFUNC FreeDOSmain(void)
|
|||
fmemcpy(&InitKernelConfig, &LowKernelConfig, sizeof(InitKernelConfig));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
setvec(0, int0_handler); /* zero divide */
|
||||
setvec(1, empty_handler); /* single step */
|
||||
setvec(3, empty_handler); /* debug breakpoint */
|
||||
|
@ -189,7 +170,7 @@ VOID ASMCFUNC FreeDOSmain(void)
|
|||
|
||||
#ifdef DEBUG
|
||||
/* Non-portable message kludge alert! */
|
||||
printf("KERNEL: Boot drive = %c\n", 'A' + BootDrive - 1);
|
||||
printf("KERNEL: Boot drive = %c\n", 'A' + LoL->BootDrive - 1);
|
||||
#endif
|
||||
|
||||
DoInstall();
|
||||
|
@ -211,7 +192,7 @@ void InitializeAllBPBs(VOID)
|
|||
{
|
||||
static char filename[] = "A:-@JUNK@-.TMP";
|
||||
int drive, fileno;
|
||||
for (drive = 'C'; drive < 'A' + nblkdev; drive++)
|
||||
for (drive = 'C'; drive < 'A' + LoL->nblkdev; drive++)
|
||||
{
|
||||
filename[0] = drive;
|
||||
if ((fileno = open(filename, O_RDONLY)) >= 0)
|
||||
|
@ -223,8 +204,8 @@ STATIC void init_kernel(void)
|
|||
{
|
||||
COUNT i;
|
||||
|
||||
os_major = MAJOR_RELEASE;
|
||||
os_minor = MINOR_RELEASE;
|
||||
LoL->os_major = MAJOR_RELEASE;
|
||||
LoL->os_minor = MINOR_RELEASE;
|
||||
|
||||
/* Init oem hook - returns memory size in KB */
|
||||
ram_top = init_oem();
|
||||
|
@ -236,9 +217,6 @@ STATIC void init_kernel(void)
|
|||
MoveKernel(FP_SEG(lpTop));
|
||||
lpOldTop = lpTop = MK_FP(FP_SEG(lpTop) - 0xfff, 0xfff0);
|
||||
|
||||
/* Fake int 21h stack frame */
|
||||
user_r = (iregs FAR *) MK_FP(DOS_PSP, 0xD0);
|
||||
|
||||
for (i = 0x20; i <= 0x3f; i++)
|
||||
setvec(i, empty_handler);
|
||||
|
||||
|
@ -260,6 +238,7 @@ STATIC void init_kernel(void)
|
|||
setvec(0x2a, int2a_handler);
|
||||
setvec(0x2f, int2f_handler);
|
||||
|
||||
set_DTA(MK_FP(DOS_PSP, 0x80));
|
||||
init_PSPSet(DOS_PSP);
|
||||
init_PSPInit(DOS_PSP);
|
||||
|
||||
|
@ -267,7 +246,7 @@ STATIC void init_kernel(void)
|
|||
|
||||
/* Do first initialization of system variable buffers so that */
|
||||
/* we can read config.sys later. */
|
||||
lastdrive = Config.cfgLastdrive;
|
||||
LoL->lastdrive = Config.cfgLastdrive;
|
||||
|
||||
/* init_device((struct dhdr FAR *)&blk_dev, NULL, NULL, ram_top); */
|
||||
blk_dev.dh_name[0] = dsk_init();
|
||||
|
@ -291,12 +270,12 @@ STATIC void init_kernel(void)
|
|||
DoConfig(2);
|
||||
|
||||
/* Close all (device) files */
|
||||
for (i = 0; i < lastdrive; i++)
|
||||
for (i = 0; i < LoL->lastdrive; i++)
|
||||
close(i);
|
||||
|
||||
/* and do final buffer allocation. */
|
||||
PostConfig();
|
||||
nblkdev = 0;
|
||||
LoL->nblkdev = 0;
|
||||
update_dcb(&blk_dev);
|
||||
|
||||
/* Init the file system one more time */
|
||||
|
@ -312,21 +291,18 @@ STATIC VOID FsConfig(VOID)
|
|||
REG COUNT i;
|
||||
struct dpb FAR *dpb;
|
||||
|
||||
/* Log-in the default drive. */
|
||||
/* Get the boot drive from the ipl and use it for default. */
|
||||
default_drive = BootDrive - 1;
|
||||
dpb = DPBp;
|
||||
dpb = LoL->DPBp;
|
||||
|
||||
/* Initialize the current directory structures */
|
||||
for (i = 0; i < lastdrive; i++)
|
||||
for (i = 0; i < LoL->lastdrive; i++)
|
||||
{
|
||||
struct cds FAR *pcds_table = &CDSp[i];
|
||||
struct cds FAR *pcds_table = &LoL->CDSp[i];
|
||||
|
||||
fmemcpy(pcds_table->cdsCurrentPath, "A:\\\0", 4);
|
||||
|
||||
pcds_table->cdsCurrentPath[0] += i;
|
||||
|
||||
if (i < nblkdev && (ULONG) dpb != 0xffffffffl)
|
||||
if (i < LoL->nblkdev && (ULONG) dpb != 0xffffffffl)
|
||||
{
|
||||
pcds_table->cdsDpb = dpb;
|
||||
pcds_table->cdsFlags = CDSPHYSDRV;
|
||||
|
@ -342,6 +318,9 @@ STATIC VOID FsConfig(VOID)
|
|||
pcds_table->cdsJoinOffset = 2;
|
||||
}
|
||||
|
||||
/* Log-in the default drive. */
|
||||
init_setdrive(LoL->BootDrive - 1);
|
||||
|
||||
/* The system file tables need special handling and are "hand */
|
||||
/* built. Included is the stdin, stdout, stdaux and stdprn. */
|
||||
/* a little bit of shuffling is necessary for compatibility */
|
||||
|
@ -370,7 +349,7 @@ STATIC VOID FsConfig(VOID)
|
|||
|
||||
STATIC VOID signon()
|
||||
{
|
||||
printf("\r%S", (void FAR *)os_release);
|
||||
printf("\r%S", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)));
|
||||
|
||||
printf("Kernel compatibility %d.%d", MAJOR_RELEASE, MINOR_RELEASE);
|
||||
|
||||
|
@ -516,11 +495,11 @@ STATIC VOID update_dcb(struct dhdr FAR * dhp)
|
|||
COUNT nunits = dhp->dh_name[0];
|
||||
struct dpb FAR *dpb;
|
||||
|
||||
if (nblkdev == 0)
|
||||
dpb = DPBp;
|
||||
if (LoL->nblkdev == 0)
|
||||
dpb = LoL->DPBp;
|
||||
else
|
||||
{
|
||||
for (dpb = DPBp; (ULONG) dpb->dpb_next != 0xffffffffl;
|
||||
for (dpb = LoL->DPBp; (ULONG) dpb->dpb_next != 0xffffffffl;
|
||||
dpb = dpb->dpb_next)
|
||||
;
|
||||
dpb = dpb->dpb_next =
|
||||
|
@ -530,17 +509,17 @@ STATIC VOID update_dcb(struct dhdr FAR * dhp)
|
|||
for (Index = 0; Index < nunits; Index++)
|
||||
{
|
||||
dpb->dpb_next = dpb + 1;
|
||||
dpb->dpb_unit = nblkdev;
|
||||
dpb->dpb_unit = LoL->nblkdev;
|
||||
dpb->dpb_subunit = Index;
|
||||
dpb->dpb_device = dhp;
|
||||
dpb->dpb_flags = M_CHANGED;
|
||||
if ((CDSp != 0) && (nblkdev < lastdrive))
|
||||
if ((LoL->CDSp != 0) && (LoL->nblkdev < LoL->lastdrive))
|
||||
{
|
||||
CDSp[nblkdev].cdsDpb = dpb;
|
||||
CDSp[nblkdev].cdsFlags = CDSPHYSDRV;
|
||||
LoL->CDSp[LoL->nblkdev].cdsDpb = dpb;
|
||||
LoL->CDSp[LoL->nblkdev].cdsFlags = CDSPHYSDRV;
|
||||
}
|
||||
++dpb;
|
||||
++nblkdev;
|
||||
++LoL->nblkdev;
|
||||
}
|
||||
(dpb - 1)->dpb_next = (void FAR *)0xFFFFFFFFl;
|
||||
}
|
||||
|
@ -568,7 +547,7 @@ BOOL init_device(struct dhdr FAR * dhp, char *cmdLine, COUNT mode,
|
|||
rq.r_length = sizeof(request);
|
||||
rq.r_endaddr = r_top;
|
||||
rq.r_bpbptr = (void FAR *)(cmdLine ? cmdLine : "\n");
|
||||
rq.r_firstunit = nblkdev;
|
||||
rq.r_firstunit = LoL->nblkdev;
|
||||
|
||||
execrh((request FAR *) & rq, dhp);
|
||||
|
||||
|
@ -595,9 +574,9 @@ BOOL init_device(struct dhdr FAR * dhp, char *cmdLine, COUNT mode,
|
|||
}
|
||||
|
||||
if (dhp->dh_attr & ATTR_CONIN)
|
||||
syscon = dhp;
|
||||
LoL->syscon = dhp;
|
||||
else if (dhp->dh_attr & ATTR_CLOCK)
|
||||
clock = dhp;
|
||||
LoL->clock = dhp;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -681,7 +660,7 @@ void CheckContinueBootFromHarddisk(void)
|
|||
if (InitKernelConfig.BootHarddiskSeconds == 0)
|
||||
return;
|
||||
|
||||
if (BootDrive >= 3)
|
||||
if (LoL->BootDrive >= 3)
|
||||
{
|
||||
if (!EmulatedDriveStatus(0x80,1))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue