inthndlr: align hma size to para

Based on a patch https://github.com/dosemu2/fdpp/commit/e7fe81d458
for FDDP by @stsp

[fixes #101]
This commit is contained in:
Andrew Bird 2023-04-13 19:22:09 +01:00 committed by Kenneth J Davis
parent 4973031b00
commit afe7fbe068
1 changed files with 4 additions and 2 deletions

View File

@ -1925,6 +1925,7 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr)
{ {
COUNT rc; COUNT rc;
long lrc; long lrc;
UDWORD tsize;
#define r (*pr) #define r (*pr)
@ -1939,8 +1940,9 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr)
size = ~offs; /* BX for query HMA */ size = ~offs; /* BX for query HMA */
if (r.AL == 0x02) /* allocate HMA space */ if (r.AL == 0x02) /* allocate HMA space */
{ {
if (r.BX < size) tsize = (r.BX + 0xf) & 0xfffffff0; /* align to paragraph */
size = r.BX; if (tsize < size)
size = (UWORD)tsize;
AllocateHMASpace(offs, offs+size); AllocateHMASpace(offs, offs+size);
firstAvailableBuf += size; firstAvailableBuf += size;
} }