X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fexmm%2Fmemory.c;h=21b213f854d2ee7858c286094ef867dbd1f78de6;hb=b6dd51c3b756f09551ea2c731b7aaf370676617a;hp=75b8664629107d2579ea0ba872430eb746553cb5;hpb=de4d33a05ca28e5332570749f3a1c1648db896a3;p=16.git diff --git a/src/lib/exmm/memory.c b/src/lib/exmm/memory.c old mode 100644 new mode 100755 index 75b86646..21b213f8 --- a/src/lib/exmm/memory.c +++ b/src/lib/exmm/memory.c @@ -28,13 +28,13 @@ //static globals -------------------------------- static int ActiveEMList[MAXEMHANDLES]; -static unsigned int EMMSeg; +static unsigned long EMMSeg; //forward declarations --------------------------------- static int EMPresent(void); static int EMReady(void); -static unsigned int GetEMMSeg(void); +static unsigned long GetEMMSeg(void); static int GetEMHandle(int NumPages); static int EMMap(int Handle, int LogPg, int PhyPg); static int FreeEMHandle(int Handle); @@ -42,6 +42,21 @@ static int GetNumPages(int Handle); static int EMStateSave(int Handle); static void EMStateRestore(int Handle); +/********************************************************************/ +//beta +unsigned long +EMInfo(void) +{ + int EMSinfo; + _asm + { + mov ah,0x58 + int 0x67 + mov EMSinfo,ax + } + return((unsigned long)EMSinfo); +} + /********************************************************************/ int @@ -57,7 +72,8 @@ EMVer(void) return(EMSver); } -/********************************************************************/ +/********************************************************************/ + int OpenEMM(void) { @@ -112,7 +128,7 @@ EMMCoreLeft(void) End: } if(!interr) - RtnVal = ((unsigned long)Pages << 14); /* Pages * 16K rtns bytes*/ + RtnVal = ((unsigned long)Pages); /* Pages * 16K rtns bytes*/ //<< 14); return(RtnVal); } /* End of EMMCoreLeft() */ @@ -129,7 +145,7 @@ EMMalloc(int *Handle, int Pages) *Handle = NOTREADY; return(NULL); } - if ((Pages < 1) || (Pages > 1020)) { + if ((Pages < 1) || (Pages > EMMCoreLeft(/*1020*/))) { *Handle = VALUE_OUTF_RANGE; return (NULL); } @@ -152,7 +168,7 @@ EMMRealloc(int Handle, int Pages) { int RtnCode = FALSE; - if (!EMMSeg || (Pages < 0) || (Pages > 1020)) { + if (!EMMSeg || (Pages < 0) || (Pages > EMMCoreLeft(/*1020*/))) { return (FALSE); } _asm { @@ -292,7 +308,7 @@ EMReady(void) /********************************************************************/ -static unsigned int +static unsigned long GetEMMSeg(void) { unsigned int EMSegment; @@ -312,7 +328,31 @@ GetEMMSeg(void) //NotReady: // return(NOTREADY); -} /* End of GetEMMSeg() */ +} /* End of GetEMMSeg() */ + +/********************************************************************/ + +unsigned long +GetEMMSeg0(void) +{ + unsigned int EMSegment; + + _asm { + mov ah,0x41 /* get EMM page frame segment */ + int 0x67 + or ah,ah + js NotReady /* returns 80, 81, or 84 hex on error */ + mov EMSegment,bx + jmp End + NotReady: + mov EMSegment,NOTREADY + End: + } + return(EMSegment); /*lint !e530 */ + +//NotReady: +// return(NOTREADY); +} /* End of GetEMMSeg0() */ /********************************************************************/