kernel 2026 final changes

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@348 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2002-02-09 00:40:33 +00:00
parent 9502a97d91
commit f7fb744248
14 changed files with 116 additions and 155 deletions

View File

@ -27,10 +27,24 @@ ftp://ftp.kernel.org/pub/software/devel/nasm
or a mirror of ftp.kernel.org. or a mirror of ftp.kernel.org.
This program will now compile with Turbo C 2.01 (now freely This kernel will now compile with Turbo C 2.01 (now freely
available!), Turbo C 3.0, Borland C 4.51 & 5.01. It should work with available!), Turbo C 3.0, Borland C 4.51 & 5.01. It should work with
other Borland compilers, Microsoft C and Watcom C. other Borland compilers, Microsoft C and Watcom C.
The Watcom C 11.0c beta compiler for DOS can now be downloaded at
www.openwatcom.org: you need at least the following zips from
ftp://ftp.openwatcom.org/watcom/zips/
core_all - Core binaries (All hosts)
clib_hdr - C runtime library header files
clib_a16 - C runtime libraries (16-bit all targets)
clib_d16 - C runtime libraries (16-bit DOS)
core_binw - Core binaries (DOS host)
c_binw - C compiler (DOS host)
Replace binw by binnt for an NT host or binp for an OS/2 host.
The host needs to be a 386+ with at least 8MB of memory.
If you feel hardy, read on to understand the directory structure. A If you feel hardy, read on to understand the directory structure. A
more complete description of the build environment is contained in a more complete description of the build environment is contained in a
companion book, "The FreeDOS Kernel" (ISBN: 0-87930-436-7) published companion book, "The FreeDOS Kernel" (ISBN: 0-87930-436-7) published

View File

@ -1,9 +1,24 @@
2002 Feb xx - Build 2026test 2002 Feb 9 - Build 2026
-------- Bart Oldeman (bart@dosemu.org) -------- Bart Oldeman (bart@dosemu.org)
+ Changes Tom + Changes Tom
* FCB clean-ups and fixes (CYRUS CHESS, bug #1014) * fixed various typos, #includes
+ Changes Bart
* fixed ECHO in config.sys
* made passing parameters to command.com more robust:
zero commandline before use, fixed buffer overflow for F5+F8
* "uppermem_root" in the List of Lists is now FFFF if no UMBs
available, as documented in RBIL
* removed all direct hooks from init_text to hma_text; duplicated
the remaining functions (memset, memcpy and friends).
* bumped up default DOS version of FAT32 enabled kernel to 7.10
2002 Feb 3 - Build 2026test
-------- Bart Oldeman (bart@dosemu.org)
+ Changes Tom
* FCB clean-ups and fixes (bug in FCB Random IO,
CYRUS CHESS, bug #1014)
* initial config.sys menus (see config.txt) * initial config.sys menus (see config.txt)
* execrh * execrh.asm: construct 'interrupt' address after strategy to avoid
some issues with non-trivial 'strategy' routines.
* make kernel UPX-able * make kernel UPX-able
* cleaned up midnight flag, dates * cleaned up midnight flag, dates
* tmark() and friends are floppy specific and implemented in C * tmark() and friends are floppy specific and implemented in C
@ -11,7 +26,7 @@
* DMA boundary checking gives the right number of sectors if * DMA boundary checking gives the right number of sectors if
the start sector is 512-bytes-aligned. the start sector is 512-bytes-aligned.
+ Changes Victor + Changes Victor
* lfn fixes * lfn fixes (lfn is only a place holder, does not work yet)
* FAT32 fixes * FAT32 fixes
* dosemu log nicer * dosemu log nicer
+ Changes Martin + Changes Martin

View File

@ -134,7 +134,7 @@ file (CONFIG.SYS) processing). A 0 means you must
have pressed the key precisely for when the kernel have pressed the key precisely for when the kernel
checks for it - essentially skipping, though a well checks for it - essentially skipping, though a well
timed finger will still get to use it. And any value timed finger will still get to use it. And any value
greater than 0 I belive is the seconds the kernel will greater than 0 is the number of seconds the kernel will
display the prompt and wait for you to press the key display the prompt and wait for you to press the key
before assuming you didn't. before assuming you didn't.
@ -143,7 +143,7 @@ FORCELBA=0 or FORCELBA=1
If 1 then the kernel will use LBA (extended INT13) If 1 then the kernel will use LBA (extended INT13)
techniques to address all partitions if possible, techniques to address all partitions if possible,
even if these have a non-LBA partition type and even if these have a non-LBA partition type and
are completely below cylinder 1023 (usually the 8MB are completely below cylinder 1023 (usually the 8GB
boundary). This is 0 by default, for compatibility boundary). This is 0 by default, for compatibility
reasons. Setting this to 1 may bypass some buggy reasons. Setting this to 1 may bypass some buggy
BIOSes and gives slightly better performance. BIOSes and gives slightly better performance.

View File

@ -33,10 +33,14 @@ static BYTE *date_hRcsId =
#endif #endif
#endif #endif
/* This Kernel is at a min Dos Ver. 5.00 */ /* This Kernel is at a min Dos Ver. 5.00 or 7.10 with FAT32 support */
#ifdef WITHFAT32
#define MAJOR_RELEASE 7
#define MINOR_RELEASE 10
#else
#define MAJOR_RELEASE 5 #define MAJOR_RELEASE 5
#define MINOR_RELEASE 00 #define MINOR_RELEASE 00
#endif
#define REV_NUMBER 0 #define REV_NUMBER 0
#define OEM_ID 0xfd /* FreeDos version */ #define OEM_ID 0xfd /* FreeDos version */
@ -45,6 +49,6 @@ static BYTE *date_hRcsId =
#define REVISION_MINOR 1 #define REVISION_MINOR 1
#define REVISION_SEQ 26 #define REVISION_SEQ 26
#define BUILD "2026" #define BUILD "2026"
#define SUB_BUILD "test" #define SUB_BUILD ""
#define KERNEL_VERSION_STRING "1.1.26test" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */ #define KERNEL_VERSION_STRING "1.1.26" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */
#define KERNEL_BUILD_STRING "2026test" /*#BUILD SUB_BUILD */ #define KERNEL_BUILD_STRING "2026" /*#BUILD SUB_BUILD */

View File

@ -591,7 +591,7 @@ VOID DoConfig(int pass)
if (pEntry->pass >= 0 && pEntry->pass != nPass) if (pEntry->pass >= 0 && pEntry->pass != nPass)
continue; continue;
if (nPass == 0) /* pass 0 always executed (rem Menu prompt) */ if (nPass == 0) /* pass 0 always executed (rem Menu prompt) */
{ {
(*(pEntry->func)) (pLine); (*(pEntry->func)) (pLine);
continue; continue;
@ -602,9 +602,10 @@ VOID DoConfig(int pass)
continue; continue;
} }
pLine = skipwh(pLine); if (pEntry->func != CfgMenu)
pLine = skipwh(pLine);
if ('=' != *pLine) if ('=' != *pLine && pEntry->func != CfgMenu)
CfgFailure(pLine); CfgFailure(pLine);
else /* YES. DO IT */ else /* YES. DO IT */
(*(pEntry->func)) (skipwh(pLine + 1)); (*(pEntry->func)) (skipwh(pLine + 1));
@ -948,7 +949,7 @@ STATIC VOID Dosmem(BYTE * pLine)
if (UmbState == 0) if (UmbState == 0)
{ {
uppermem_link = 0; uppermem_link = 0;
uppermem_root = 0; uppermem_root = 0xffff;
UmbState = UMBwanted ? 2 : 0; UmbState = UMBwanted ? 2 : 0;
} }
/* Check if HMA is available straight away */ /* Check if HMA is available straight away */

View File

@ -42,7 +42,9 @@ segment HMA_TEXT
; The stack is very critical in here. ; The stack is very critical in here.
; ;
global _execrh global _execrh
_execrh: global _init_execrh
%macro EXECRH 0
push bp ; perform c entry push bp ; perform c entry
mov bp,sp mov bp,sp
push si push si
@ -67,6 +69,15 @@ _execrh:
pop si pop si
pop bp pop bp
ret ret
%endmacro
_execrh:
EXECRH
segment INIT_TEXT
_init_execrh:
EXECRH
; Log: execrh.asm,v ; Log: execrh.asm,v
; Revision 1.3 2000/03/09 06:07:11 kernel ; Revision 1.3 2000/03/09 06:07:11 kernel

View File

@ -31,21 +31,16 @@ extern struct _KernelConfig InitKernelConfig;
*/ */
#define printf init_printf #define printf init_printf
#define sprintf init_sprintf #define sprintf init_sprintf
#define execrh reloc_call_execrh #define execrh init_execrh
#define fmemcpy reloc_call_fmemcpy #define fmemcpy init_fmemcpy
#define fmemset reloc_call_fmemset #define fmemset init_fmemset
#define memset reloc_call_memset #define memset init_memset
#define fstrncpy reloc_call_fstrncpy #define strcpy init_strcpy
#define strcpy reloc_call_strcpy
#define strlen reloc_call_strlen
WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *); WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *);
VOID ASMCFUNC fmemcpy(REG VOID FAR * d, REG VOID FAR * s, REG COUNT n); void fmemcpy(void far *d, const void far *s, unsigned n);
void ASMCFUNC fmemset(REG VOID FAR * s, REG int ch, REG COUNT n); void fmemset(void far *s, int ch, unsigned n);
void ASMCFUNC memset(REG VOID * s, REG int ch, REG COUNT n); void memset(void *s, int ch, unsigned n);
VOID ASMCFUNC strcpy(REG BYTE * d, REG BYTE * s); void strcpy(char *dest, const char *src);
VOID ASMCFUNC fstrncpy(REG BYTE FAR * d, REG BYTE FAR * s, REG COUNT n);
COUNT ASMCFUNC fstrlen(REG BYTE FAR * s);
COUNT ASMCFUNC strlen(REG BYTE * s);
#undef LINESIZE #undef LINESIZE
#define LINESIZE KBD_MAXLENGTH #define LINESIZE KBD_MAXLENGTH
@ -56,7 +51,6 @@ int fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len);
#define setvec(n, isr) (void)(*(intvec FAR *)MK_FP(0,4 * (n)) = (isr)) #define setvec(n, isr) (void)(*(intvec FAR *)MK_FP(0,4 * (n)) = (isr))
#define fbcopy(s, d, n) fmemcpy(d,s,n)
#define GLOBAL extern #define GLOBAL extern
#define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */ #define NAMEMAX MAX_CDSPATH /* Maximum path for CDS */
#define PARSE_MAX MAX_CDSPATH /* maximum # of bytes in path */ #define PARSE_MAX MAX_CDSPATH /* maximum # of bytes in path */

View File

@ -460,42 +460,6 @@ void MoveKernel(unsigned NewKernelSegment)
} }
} }
{
struct initRelocationTable {
UBYTE callNear;
UWORD callOffset;
UBYTE jmpFar;
UWORD jmpOffset;
UWORD jmpSegment;
};
extern struct initRelocationTable
ASM _HMAinitRelocationTableStart[], ASM _HMAinitRelocationTableEnd[];
struct initRelocationTable *rp;
/* verify, that all entries are valid */
for (rp = _HMAinitRelocationTableStart;
rp < _HMAinitRelocationTableEnd; rp++)
{
if (rp->callNear != 0xe8 || /* call NEAR */
rp->jmpFar != 0xea || /* jmp FAR */
rp->jmpSegment != CurrentKernelSegment || /* will only relocate HMA_TEXT */
0)
{
printf("illegal init relocation entry # %d\n",
rp - _HMAinitRelocationTableStart);
goto errorReturn;
}
}
/* OK, all valid, go to relocate */
for (rp = _HMAinitRelocationTableStart;
rp < _HMAinitRelocationTableEnd; rp++)
{
rp->jmpSegment = NewKernelSegment;
}
}
CurrentKernelSegment = NewKernelSegment; CurrentKernelSegment = NewKernelSegment;
return; return;

View File

@ -1119,7 +1119,7 @@ dispatch:
break; break;
case 0x03: case 0x03:
if (uppermem_root) /* always error if not exists */ if (uppermem_root != 0xffff) /* always error if not exists */
{ {
DosUmbLink(r->BL); DosUmbLink(r->BL);
break; break;

View File

@ -343,7 +343,7 @@ _uppermem_link db 0 ; 0063 upper memory link flag
_min_pars dw 0 ; 0064 minimum paragraphs of memory _min_pars dw 0 ; 0064 minimum paragraphs of memory
; required by program being EXECed ; required by program being EXECed
global _uppermem_root global _uppermem_root
_uppermem_root dw 0 ; 0066 dmd_upper_root (usually 9fff) _uppermem_root dw 0ffffh ; 0066 dmd_upper_root (usually 9fff)
_last_para dw 0 ; 0068 para of last mem search _last_para dw 0 ; 0068 para of last mem search
SysVarEnd: SysVarEnd:
@ -623,8 +623,6 @@ segment IB_E
__ib_end: __ib_end:
;; do not clear the other init BSS variables + STACK: too late. ;; do not clear the other init BSS variables + STACK: too late.
retoff resw 1 ; return offset to jump to from HMA_TEXT
; kernel startup stack ; kernel startup stack
global init_tos global init_tos
resw 512 resw 512
@ -708,10 +706,6 @@ __U4D:
LDIVMODU LDIVMODU
%endif %endif
init_ret_np: push ds
push word [retoff]
retf ; return from init_calls.
;End of HMA segment ;End of HMA segment
segment HMA_TEXT_END segment HMA_TEXT_END
global __HMATextEnd global __HMATextEnd
@ -748,70 +742,6 @@ _DGROUP_:
dw DGROUP dw DGROUP
segment INIT_TEXT
call far initforceEnableA20 ; first enable A20 or not
manip_stack_A20:
pop dx ; get last ret address
pop word [retoff] ; get near ret address of init caller
mov ax, init_ret_np ; new init caller ret address
push ax
jmp dx ; and back to the relocation entry
global __HMAinitRelocationTableStart
__HMAinitRelocationTableStart:
extern _execrh
global _reloc_call_execrh
_reloc_call_execrh:
call manip_stack_A20
jmp far _execrh
extern _fmemcpy
global _reloc_call_fmemcpy
_reloc_call_fmemcpy:
call manip_stack_A20
jmp far _fmemcpy
extern _strcpy
global _reloc_call_strcpy
_reloc_call_strcpy:
call manip_stack_A20
jmp far _strcpy
extern _fstrncpy
global _reloc_call_fstrncpy
_reloc_call_fstrncpy:
call manip_stack_A20
jmp far _fstrncpy
extern _strlen
global _reloc_call_strlen
_reloc_call_strlen:
call manip_stack_A20
jmp far _strlen
extern _fstrlen
global _reloc_call_fstrlen
_reloc_call_fstrlen:
call manip_stack_A20
jmp far _fstrlen
extern _fmemset
global _reloc_call_fmemset
_reloc_call_fmemset:
call manip_stack_A20
jmp far _fmemset
extern _memset
global _reloc_call_memset
_reloc_call_memset:
call manip_stack_A20
jmp far _memset
global __HMAinitRelocationTableEnd
__HMAinitRelocationTableEnd:
segment _TEXT segment _TEXT
global _initforceEnableA20 global _initforceEnableA20

View File

@ -107,6 +107,33 @@ __segment DosTextSeg = 0;
#endif #endif
/* little functions - could be ASM but does not really matter in this context */
void memset(void *s, int c, unsigned n)
{
char *t = s;
while(n--) *t++ = c;
}
void fmemset(void far *s, int c, unsigned n)
{
char far *t = s;
while(n--) *t++ = c;
}
void strcpy(char *dest, const char *src)
{
while(*src)
*dest++ = *src++;
*dest = '\0';
}
void fmemcpy(void far *dest, const void far *src, unsigned n)
{
char far *d = dest;
const char far *s = src;
while(n--) *d++ = *s++;
}
VOID ASMCFUNC FreeDOSmain(void) VOID ASMCFUNC FreeDOSmain(void)
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
@ -408,16 +435,16 @@ STATIC void kernel()
/* process 0 */ /* process 0 */
/* Execute command.com /P from the drive we just booted from */ /* Execute command.com /P from the drive we just booted from */
fstrncpy(Cmd.ctBuffer, Config.cfgInitTail, memset(Cmd.ctBuffer, 0, sizeof(Cmd.ctBuffer));
sizeof(Config.cfgInitTail) - 1); fmemcpy(Cmd.ctBuffer, Config.cfgInitTail, sizeof(Config.cfgInitTail));
for (Cmd.ctCount = 0; Cmd.ctCount < 127; Cmd.ctCount++) for (Cmd.ctCount = 0; Cmd.ctCount < sizeof(Cmd.ctBuffer); Cmd.ctCount++)
if (Cmd.ctBuffer[Cmd.ctCount] == '\r') if (Cmd.ctBuffer[Cmd.ctCount] == '\r')
break; break;
/* if stepping CONFIG.SYS (F5/F8), tell COMMAND.COM about it */ /* if stepping CONFIG.SYS (F5/F8), tell COMMAND.COM about it */
if (Cmd.ctCount < 127 - 3) if (Cmd.ctCount < sizeof(Cmd.ctBuffer) - 3)
{ {
extern int singleStep; extern int singleStep;
extern int SkipAllConfig; extern int SkipAllConfig;
@ -433,14 +460,14 @@ STATIC void kernel()
{ {
/* insert /D, /Y as first argument */ /* insert /D, /Y as first argument */
int cmdEnd, i, slen = strlen(insertString); int cmdEnd, i, slen = 3; /* strlen(insertString); */
for (cmdEnd = 0; cmdEnd < 127; cmdEnd++) for (cmdEnd = 0; cmdEnd < sizeof(Cmd.ctBuffer); cmdEnd++)
{ {
if (Cmd.ctBuffer[cmdEnd] == ' ' || if (Cmd.ctBuffer[cmdEnd] == ' ' ||
Cmd.ctBuffer[cmdEnd] == '\t' || Cmd.ctBuffer[cmdEnd] == '\r') Cmd.ctBuffer[cmdEnd] == '\t' || Cmd.ctBuffer[cmdEnd] == '\r')
{ {
for (i = 127 - slen; i >= cmdEnd; i--) for (i = sizeof(Cmd.ctBuffer) - slen - 1; i >= cmdEnd; i--)
Cmd.ctBuffer[i + slen] = Cmd.ctBuffer[i]; Cmd.ctBuffer[i + slen] = Cmd.ctBuffer[i];
fmemcpy(&Cmd.ctBuffer[cmdEnd], insertString, slen); fmemcpy(&Cmd.ctBuffer[cmdEnd], insertString, slen);

View File

@ -152,7 +152,7 @@ searchAgain:
Hack to the Umb Region direct for now. Save time and program space. Hack to the Umb Region direct for now. Save time and program space.
*/ */
if ((mode != LARGEST) && (mode & (FIRST_FIT_UO | FIRST_FIT_U)) && if ((mode != LARGEST) && (mode & (FIRST_FIT_UO | FIRST_FIT_U)) &&
uppermem_link && uppermem_root) uppermem_link && uppermem_root != 0xffff)
p = para2far(uppermem_root); p = para2far(uppermem_root);
/* Search through memory blocks */ /* Search through memory blocks */
@ -217,7 +217,7 @@ searchAgain:
if (!foundSeg || !foundSeg->m_size) if (!foundSeg || !foundSeg->m_size)
{ /* no block to fullfill the request */ { /* no block to fullfill the request */
if ((mode != LARGEST) && (mode & FIRST_FIT_U) && if ((mode != LARGEST) && (mode & FIRST_FIT_U) &&
uppermem_link && uppermem_root) uppermem_link && uppermem_root != 0xffff)
{ {
mode &= ~FIRST_FIT_U; mode &= ~FIRST_FIT_U;
goto searchAgain; goto searchAgain;
@ -290,7 +290,7 @@ COUNT DosMemLargest(UWORD FAR * size)
/* Initialize */ /* Initialize */
p = ((mem_access_mode & (FIRST_FIT_UO | FIRST_FIT_U)) && uppermem_link p = ((mem_access_mode & (FIRST_FIT_UO | FIRST_FIT_U)) && uppermem_link
&& uppermem_root) ? para2far(uppermem_root) : para2far(first_mcb); && uppermem_root != 0xffff) ? para2far(uppermem_root) : para2far(first_mcb);
/* Cycle through the whole MCB chain to find the largest unused /* Cycle through the whole MCB chain to find the largest unused
area. Join all unused areas together. */ area. Join all unused areas together. */
@ -569,7 +569,7 @@ VOID DosUmbLink(BYTE n)
REG mcb FAR *p; REG mcb FAR *p;
REG mcb FAR *q; REG mcb FAR *q;
if (uppermem_root == 0) if (uppermem_root == 0xffff)
return; return;
q = p = para2far(first_mcb); q = p = para2far(first_mcb);

View File

@ -41,7 +41,7 @@ static char buff[MAX_BUFSIZE];
#endif #endif
#ifdef _INIT #ifdef _INIT
#define fstrlen reloc_call_fstrlen #define fstrlen init_fstrlen
#define handle_char init_handle_char #define handle_char init_handle_char
#define put_console init_put_console #define put_console init_put_console
#define ltob init_ltob #define ltob init_ltob
@ -53,8 +53,6 @@ static char buff[MAX_BUFSIZE];
#define hexDigits init_hexDigits #define hexDigits init_hexDigits
#endif #endif
COUNT ASMCFUNC fstrlen(BYTE FAR * s); /* don't want globals.h, sorry */
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *prfRcsId = static BYTE *prfRcsId =
"$Id$"; "$Id$";
@ -71,7 +69,7 @@ WORD CDECL printf(CONST BYTE * fmt, ...);
/* The following is user supplied and must match the following prototype */ /* The following is user supplied and must match the following prototype */
VOID cso(COUNT); VOID cso(COUNT);
#ifdef FORSYS #if defined(FORSYS) || defined(_INIT)
COUNT fstrlen(BYTE FAR * s) /* don't want globals.h, sorry */ COUNT fstrlen(BYTE FAR * s) /* don't want globals.h, sorry */
{ {
int i = 0; int i = 0;
@ -81,6 +79,8 @@ COUNT fstrlen(BYTE FAR * s) /* don't want globals.h, sorry */
return i; return i;
} }
#else
COUNT ASMCFUNC fstrlen(BYTE FAR * s); /* don't want globals.h, sorry */
#endif #endif
/* special console output routine */ /* special console output routine */

View File

@ -43,6 +43,7 @@ unsigned long lseek(int fildes, unsigned long offset, int whence);
#else #else
#include <io.h> #include <io.h>
#include <stdio.h>
#endif #endif
#define FAR far #define FAR far