From 81a149ea36971b0954ed6d6d2f6bcd38707ea353 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sat, 14 Jun 2003 11:44:02 +0000 Subject: [PATCH] Better limit checking on memory allocated to XMS Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1057 --- src/ints/xms.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ints/xms.cpp b/src/ints/xms.cpp index 6db3f299..3701b563 100644 --- a/src/ints/xms.cpp +++ b/src/ints/xms.cpp @@ -363,7 +363,7 @@ static bool multiplex_xms(void) { }; Bitu XMS_Handler(void) { - LOG(LOG_MISC,LOG_ERROR)("XMS: CALL %02X",reg_ah); +// LOG(LOG_MISC,LOG_ERROR)("XMS: CALL %02X",reg_ah); switch (reg_ah) { case XMS_GET_VERSION: /* 00 */ @@ -443,7 +443,7 @@ Bitu XMS_Handler(void) { break; } - LOG(LOG_MISC,LOG_ERROR)("XMS: CALL Result: %02X",reg_bl); +// LOG(LOG_MISC,LOG_ERROR)("XMS: CALL Result: %02X",reg_bl); return CBRET_NONE; } @@ -451,7 +451,9 @@ void XMS_Init(Section* sec) { Section_prop * section=static_cast(sec); Bitu size=section->Get_int("xmssize"); if (!size) return; - if (size>C_MEM_MAX_SIZE-1) size=C_MEM_MAX_SIZE-1; + Bitu memavail=(MEM_TotalSize()-1088)/1024; + + if (size>memavail) size=memavail; xms_size = size; DOS_AddMultiplexHandler(multiplex_xms); call_xms=CALLBACK_Allocate();