Applied Arkady's corrections to int2f/ax=4a01/2.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@862 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-10 21:07:06 +00:00
parent dd6ace383a
commit 6ad8b415dd
2 changed files with 15 additions and 26 deletions

View File

@ -1774,42 +1774,30 @@ struct int2f12regs {
UWORD callerARG1; /* used if called from INT2F/12 */ UWORD callerARG1; /* used if called from INT2F/12 */
}; };
extern short AllocateHMASpace (size_t lowbuffer, size_t highbuffer);
/* WARNING: modifications in `r' are used outside of int2F_12_handler() /* WARNING: modifications in `r' are used outside of int2F_12_handler()
* On input r.AX==0x12xx, 0x4A01 or 0x4A02 * On input r.AX==0x12xx, 0x4A01 or 0x4A02
*/ */
VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
{ {
/* dont use
QueryFreeHMASpace(&p);
here; DS !=SS
*/
if (r.AH == 0x4a) if (r.AH == 0x4a)
{ {
size_t wantedBytes, offs; size_t size = 0, offs = 0xffff;
if (r.AL != 1 && r.AL != 2) r.ES = offs;
return; if (FP_SEG(firstAvailableBuf) == offs) /* HMA present? */
wantedBytes = r.BX;
r.ES = r.DI = 0xffff;
r.BX = 0;
if (FP_SEG(firstAvailableBuf) != 0xffff)
return;
offs = FP_OFF(firstAvailableBuf);
r.di = offs;
if (r.AL == 0x02)
{ {
if (wantedBytes > ~offs) offs = FP_OFF(firstAvailableBuf);
return; size = ~offs; /* BX for query HMA */
AllocateHMASpace(FP_OFF(firstAvailableBuf), if (r.AL == 0x02) /* allocate HMA space */
FP_OFF(firstAvailableBuf)+wantedBytes); {
firstAvailableBuf += wantedBytes; if (r.BX < size)
r.BX = wantedBytes; size = r.BX;
AllocateHMASpace(offs, offs+size);
firstAvailableBuf += size;
}
} }
r.DI = offs;
r.BX = size;
return; return;
} }

View File

@ -46,6 +46,7 @@ BOOL DeleteBlockInBufferCache(ULONG blknolow, ULONG blknohigh, COUNT dsk, int mo
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks,
COUNT mode); COUNT mode);
/* *** End of change */ /* *** End of change */
void AllocateHMASpace (size_t lowbuffer, size_t highbuffer);
/* break.c */ /* break.c */
#ifdef __WATCOMC__ #ifdef __WATCOMC__