From afe7fbe068bf7f3cc99dc01bf8e402311095757b Mon Sep 17 00:00:00 2001 From: Andrew Bird Date: Thu, 13 Apr 2023 19:22:09 +0100 Subject: [PATCH] inthndlr: align hma size to para Based on a patch https://github.com/dosemu2/fdpp/commit/e7fe81d458 for FDDP by @stsp [fixes #101] --- kernel/inthndlr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index b690e9a..eaf41af 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1925,6 +1925,7 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr) { COUNT rc; long lrc; + UDWORD tsize; #define r (*pr) @@ -1939,8 +1940,9 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr) size = ~offs; /* BX for query HMA */ if (r.AL == 0x02) /* allocate HMA space */ { - if (r.BX < size) - size = r.BX; + tsize = (r.BX + 0xf) & 0xfffffff0; /* align to paragraph */ + if (tsize < size) + size = (UWORD)tsize; AllocateHMASpace(offs, offs+size); firstAvailableBuf += size; }