Use asmsupt string and mem functions for the init code too.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@787 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-02-24 00:25:56 +00:00
parent 47ae1ab1d3
commit 5214472bf7
7 changed files with 67 additions and 66 deletions

View File

@ -36,7 +36,33 @@
%include "segs.inc"
segment HMA_TEXT
%ifdef _INIT
segment INIT_TEXT
%define FMEMCPYBACK INIT_FMEMCPYBACK
%define MEMCPY INIT_MEMCPY
%define FMEMCPY INIT_FMEMCPY
%define MEMSET INIT_MEMSET
%define FMEMSET INIT_FMEMSET
%define STRCPY INIT_STRCPY
%define FSTRCPY INIT_FSTRCPY
%define STRLEN INIT_STRLEN
%define FSTRLEN INIT_FSTRLEN
%define FMEMCHR INIT_FMEMCHR
%define FSTRCHR INIT_FSTRCHR
%define STRCHR INIT_STRCHR
%define FSTRCMP INIT_FSTRCMP
%define STRCMP INIT_STRCMP
%define FSTRNCMP INIT_FSTRNCMP
%define STRNCMP INIT_STRNCMP
%define FMEMCMP INIT_FMEMCMP
%define MEMCMP INIT_MEMCMP
%else
segment HMA_TEXT
%endif
;*********************************************************************
; this implements some of the common string handling functions
@ -225,7 +251,7 @@ pascal_return:
; fstrcpy (void FAR*dest, void FAR *src);
%ifndef _INIT
global FSTRCPY
FSTRCPY:
call pascal_setup
@ -239,6 +265,7 @@ FSTRCPY:
mov bl,8
jmp short dostrcpy
%endif
;******
global STRCPY
@ -294,6 +321,8 @@ dostrlen:
jmp short pascal_return
%ifndef _INIT
;************************************************************
; strchr (BYTE *src , int ch);
@ -366,6 +395,8 @@ FMEMCHR:
mov ax, di
jmp short strchr_found1
%endif
;**********************************************************************
%if 0
nix pascal - still untested

View File

@ -1047,17 +1047,17 @@ STATIC VOID Dosmem(BYTE * pLine)
for (pTmp = szBuf;;)
{
if (fmemcmp(pTmp, "UMB", 3) == 0)
if (memcmp(pTmp, "UMB", 3) == 0)
{
UMBwanted = TRUE;
pTmp += 3;
}
if (fmemcmp(pTmp, "HIGH", 4) == 0)
if (memcmp(pTmp, "HIGH", 4) == 0)
{
HMAState = HMA_REQ;
pTmp += 4;
}
/* if (fmemcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
/* if (memcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }*/
pTmp = skipwh(pTmp);
if (*pTmp != ',')
@ -1083,7 +1083,7 @@ STATIC VOID DosData(BYTE * pLine)
pLine = GetStringArg(pLine, szBuf);
strupr(szBuf);
if (fmemcmp(szBuf, "UMB", 3) == 0)
if (memcmp(szBuf, "UMB", 3) == 0)
Config.cfgDosDataUmb = TRUE;
}
@ -1705,14 +1705,6 @@ STATIC VOID mumcb_init(UCOUNT seg, UWORD size)
}
#endif
static size_t strlen(const char *s)
{
size_t n = 0;
while (*s++)
n++;
return n;
}
char *strcat(register char * d, register const char * s)
{
strcpy(d + strlen(d), s);
@ -1894,7 +1886,7 @@ STATIC VOID CfgMenu(BYTE * pLine)
(change struct at top of file if you want more...) */
if (nLen > MENULINEMAX-1)
nLen = MENULINEMAX-1;
fmemcpy(MenuStruct[nIndex].Text, pLine, nLen);
memcpy(MenuStruct[nIndex].Text, pLine, nLen);
MenuStruct[nIndex].Text[nLen] = 0; /* nullTerminate */
}
nMenuLine++;
@ -2576,7 +2568,7 @@ STATIC VOID _CmdInstall(BYTE * pLine,int mode)
CfgFailure(pLine);
return;
}
fmemcpy(InstallCommands[numInstallCmds].buffer,pLine,127);
memcpy(InstallCommands[numInstallCmds].buffer,pLine,127);
InstallCommands[numInstallCmds].buffer[127] = 0;
InstallCommands[numInstallCmds].mode = mode;
numInstallCmds++;

View File

@ -35,23 +35,35 @@ extern struct _KernelConfig InitKernelConfig;
#define printf init_printf
#define sprintf init_sprintf
#define execrh init_execrh
#define memcpy init_memcpy
#define fmemcpy init_fmemcpy
#define fmemset init_fmemset
#define fmemcmp init_fmemcmp
#define memset init_memset
#define strcpy init_strcpy
WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *);
void fmemcpy(void far *d, const void far *s, unsigned n);
void fmemset(void far *s, int ch, unsigned n);
void memset(void *s, int ch, unsigned n);
void strcpy(char *dest, const char *src);
#define memcmp init_memcmp
#define memset init_memset
#define strcpy init_strcpy
#define strlen init_strlen
#define fstrlen init_fstrlen
/* execrh.asm */
WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *);
/* asmsupt.asm */
VOID ASMPASCAL memset( void *s, int ch, size_t n);
VOID ASMPASCAL fmemset( void FAR *s, int ch, size_t n);
int ASMPASCAL memcmp(const void *m1, const void *m2, size_t n);
int ASMPASCAL fmemcmp(const void FAR *m1, const void FAR *m2, size_t n);
VOID ASMPASCAL memcpy( void *d, const void *s, size_t n);
VOID ASMPASCAL fmemcpy( void FAR *d, const void FAR *s, size_t n);
VOID ASMPASCAL strcpy(char *d, const char *s);
size_t ASMPASCAL strlen(const char *s);
size_t ASMPASCAL fstrlen(const char FAR *s);
#undef LINESIZE
#define LINESIZE KBD_MAXLENGTH
/*inithma.c*/
extern BYTE DosLoadedInHMA;
int fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len);
void MoveKernel(unsigned NewKernelSegment);
#define setvec(n, isr) (void)(*(intvec FAR *)MK_FP(0,4 * (n)) = (isr))

View File

@ -113,17 +113,6 @@ VOID hdump(BYTE FAR * p)
#define KeyboardShiftState() (*(BYTE FAR *)(MK_FP(0x40,0x17)))
/* of course, this should go to ASMSUPT */
int fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len)
{
for (; len; s1++, s2++, --len)
{
if (*s1 - *s2)
return *s1 - *s2;
}
return 0;
}
/*
this tests, if the HMA area can be enabled.
if so, it simply leaves it on

View File

@ -70,33 +70,6 @@ struct lol FAR *LoL;
struct lol FAR *LoL = &DATASTART;
#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)
{
unsigned char drv;
@ -375,7 +348,7 @@ STATIC void kernel()
/* process 0 */
/* Execute command.com /P from the drive we just booted from */
memset(Cmd.ctBuffer, 0, sizeof(Cmd.ctBuffer));
fmemcpy(Cmd.ctBuffer, Config.cfgInitTail, sizeof(Config.cfgInitTail));
memcpy(Cmd.ctBuffer, Config.cfgInitTail, sizeof(Config.cfgInitTail));
for (Cmd.ctCount = 0; Cmd.ctCount < sizeof(Cmd.ctBuffer); Cmd.ctCount++)
if (Cmd.ctBuffer[Cmd.ctCount] == '\r')
@ -406,7 +379,7 @@ STATIC void kernel()
for (q = &Cmd.ctBuffer[Cmd.ctCount - 1]; q >= p; q--)
q[3] = q[0];
fmemcpy(p, insertString, 3);
memcpy(p, insertString, 3);
Cmd.ctCount += 3;
break;

View File

@ -40,7 +40,7 @@ error.obj
OBJS4=break.obj dosfns.obj fatdir.obj fatfs.obj fattab.obj fcbfns.obj \
inthndlr.obj
OBJS5=ioctl.obj dosnames.obj memmgr.obj task.obj newstuff.obj nls.obj network.obj
OBJS6=prf.obj misc.obj strings.obj syspack.obj lfnapi.obj
OBJS6=prf.obj misc.obj strings.obj syspack.obj lfnapi.obj iasmsupt.obj
OBJS7=main.obj config.obj initoem.obj inithma.obj dyninit.obj iprf.obj \
initdisk.obj initclk.obj
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7)
@ -220,6 +220,10 @@ initclk.obj: initclk.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
$(CC) $(INITCFLAGS) $*.c
$(INITPATCH) $*.obj
#the string functions for INIT_TEXT
iasmsupt.obj: asmsupt.asm $(CONFIGURATION)
$(NASM) -D$(COMPILER) -D_INIT $(NASMFLAGS) -f obj -o iasmsupt.obj asmsupt.asm
#the printf for INIT_TEXT - yet another special case, this file includes prf.c
iprf.obj: iprf.c prf.c $(HDR)portab.h $(CONFIGURATION)
$(CC) $(INITCFLAGS) $*.c

View File

@ -136,7 +136,7 @@ int CDECL printf(CONST BYTE * fmt, ...);
/* The following is user supplied and must match the following prototype */
VOID cso(COUNT);
#if defined(FORSYS) || defined(_INIT)
#if defined(FORSYS)
COUNT fstrlen(BYTE FAR * s) /* don't want globals.h, sorry */
{
int i = 0;