Make UMB_get_largest "pascal". Let it use the xms driver address from

the HMA code. Misc small config.c cleanups.
The uncompressed 386/fat32 kernel is now below 70000 bytes (69896).


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@854 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-09 15:43:01 +00:00
parent 4af102b61f
commit 6e6e34024b
4 changed files with 29 additions and 37 deletions

View File

@ -170,7 +170,6 @@ STATIC seg base_seg = 0;
STATIC seg umb_base_seg = 0;
BYTE FAR *lpTop = 0;
STATIC unsigned nCfgLine = 0;
STATIC COUNT nPass = 0;
COUNT UmbState = 0;
STATIC BYTE szLine[256] = { 0 };
STATIC BYTE szBuf[256] = { 0 };
@ -545,8 +544,12 @@ STATIC void umb_init(void)
{
UCOUNT umb_seg, umb_size;
seg umb_max;
void far *xms_addr;
if (UMB_get_largest(&umb_seg, &umb_size))
if ((xms_addr = DetectXMSDriver()) == NULL)
return;
if (UMB_get_largest(xms_addr, &umb_seg, &umb_size))
{
UmbState = 1;
@ -571,7 +574,7 @@ STATIC void umb_init(void)
the first UMB.
*/
while (UMB_get_largest(&umb_seg, &umb_size))
while (UMB_get_largest(xms_addr, &umb_seg, &umb_size))
{
seg umb_prev, umb_next;
@ -621,16 +624,13 @@ STATIC void umb_init(void)
}
}
VOID DoConfig(int pass)
VOID DoConfig(int nPass)
{
COUNT nFileDesc;
BYTE *pLine;
BOOL bEof;
/* Set pass number */
nPass = pass;
/* Check to see if we have a config.sys file. If not, just */
/* exit since we don't force the user to have one. */
if ((nFileDesc = open("fdconfig.sys", 0)) >= 0)

View File

@ -111,8 +111,6 @@ VOID configDone(VOID);
VOID FAR * KernelAlloc(size_t nBytes, char type, int mode);
void FAR * KernelAllocPara(size_t nPara, char type, char *name, int mode);
char *strcat(char * d, const char * s);
COUNT ASMCFUNC Umb_Test(void);
COUNT ASMCFUNC UMB_get_largest(UCOUNT * seg, UCOUNT * size);
BYTE * GetStringArg(BYTE * pLine, BYTE * pszString);
void DoInstall(void);
UWORD GetBiosKey(int timeout);
@ -121,7 +119,12 @@ UWORD GetBiosKey(int timeout);
COUNT dsk_init(VOID);
/* int2f.asm */
COUNT ASMCFUNC Umb_Test(void);
COUNT ASMPASCAL Umb_Test(void);
COUNT ASMPASCAL UMB_get_largest(void FAR * driverAddress,
UCOUNT * seg, UCOUNT * size);
#ifdef __WATCOMC__
#pragma aux (pascal) UMB_get_largest modify exact [ax bx cx dx]
#endif
/* inithma.c */
int MoveKernelToHMA(void);

View File

@ -163,14 +163,18 @@ int EnableHMA(VOID)
int MoveKernelToHMA()
{
void far *xms_addr;
if (DosLoadedInHMA)
{
return TRUE;
}
if ((XMSDriverAddress = DetectXMSDriver()) == NULL)
if ((xms_addr = DetectXMSDriver()) == NULL)
return FALSE;
XMSDriverAddress = xms_addr;
#ifdef DEBUG
/* A) for debugging purpose, suppress this,
if any shift key is pressed
@ -196,7 +200,7 @@ int MoveKernelToHMA()
if (HMAclaimed == 0 &&
(HMAclaimed =
init_call_XMScall(XMSDriverAddress, 0x0100, 0xffff)) == 0)
init_call_XMScall(xms_addr, 0x0100, 0xffff)) == 0)
{
printf("Can't reserve HMA area ??\n");

View File

@ -677,34 +677,20 @@ skip5f02:
; B1h no UMB's are available
; B2h UMB segment number is invalid
;
;
segment INIT_TEXT
; int UMB_get_largest(UCOUNT *seg, UCOUNT *size);
global _UMB_get_largest
; int ASMPASCAL UMB_get_largest(void FAR * driverAddress,
; UCOUNT * seg, UCOUNT * size);
global UMB_GET_LARGEST
_UMB_get_largest:
UMB_GET_LARGEST:
push bp
mov bp,sp
sub sp,4 ; for the far call
mov ax,4300h ; is there a xms driver installed?
int 2fh
cmp al,80h
jne umbt_error
mov ax,4310h
int 2fh
mov [bp-2],es ; save driver entry point
mov [bp-4],bx
mov dx,0xffff ; go for broke!
mov ax,1000h ; get the umb's
call far [bp-4] ; Call the driver
call far [bp+8] ; Call the driver
;
; bl = 0xB0 and ax = 0 so do it again.
;
@ -715,7 +701,7 @@ _UMB_get_largest:
je umbt_error
mov ax,1000h ; dx set with largest size
call far [bp-4] ; Call the driver
call far [bp+8] ; Call the driver
cmp ax,1
jne umbt_error
@ -723,16 +709,15 @@ _UMB_get_largest:
; and the size
mov cx,bx ; *seg = segment
mov bx, [bp+4]
mov bx, [bp+6]
mov [bx],cx
mov bx, [bp+6] ; *size = size
mov bx, [bp+4] ; *size = size
mov [bx],dx
umbt_ret:
mov sp,bp
pop bp
ret ; this was called NEAR!!
ret 8 ; this was called NEAR!!
umbt_error: xor ax,ax
jmp short umbt_ret