home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************
- **+
- ** Module Name: vmm.h
- **
- ** Description: vmm defines
- **
- ** Written by: John Tal
- **
- **
- ** Modification history:
- **
- ** Date Engineer Mod # Modification Description
- **
- ** 12-FEB-1992 Tal v 1.0-000 Initial release
- **
- ***********************************************************************/
-
-
- #ifdef VMM_H
- #else
- #define VMM_H
-
- /*
- ** Virtual Memory Manager
- **
- ** Blocks of memory from pvMosMemory are mapped into a link-list
- ** of VMM_BLOCK_S which is ordered in descending order of size of sub-block
- */
-
- #define VMM_MEMORY 0x01
- #define VMM_DISK 0x02
-
- #define VMM_OWNER_NONE -1
-
- #define VMM_STATE_MEMORY 0x01
- #define VMM_STATE_DISK 0x02
- #define VMM_STATE_EXTINCT 0x04
-
- #define VMM_ERR_MEM_EXCEEDED 0x30
- #define VMM_ERR_INIT 0x31
- #define VMM_ERR_SWAP_FILE 0x32
-
- /*
- ** VMM_BLOCK_S
- **
- ** Used for in-memory blocks AND free-blocks in swap file
- */
-
- struct VMM_BLOCK_S
- {
- LONG lDescriptor;
- SHORT sBytes;
- SHORT sOwner;
- SHORT sState;
- LONG lOffset; /* offset into swap file */
- PVOID pvBlock;
- LONG lTimeLastAccess;
- struct VMM_BLOCK_S * pstMate;
- };
-
- typedef struct VMM_BLOCK_S VMM_BLOCK_T;
- typedef VMM_BLOCK_T * VMM_BLOCK_P;
-
-
- #define VMM_FILE_NAME_LEN 64
-
- struct VMM_MGR_S
- {
- PVOID pvBlock; /* main memory block */
- LONG lTotalBytes; /* size of main memory block */
- LLIST_P pstMemList; /* list of sub-allocated memory blocks */
- LLIST_P pstFreeDiskBlocks; /* list of disk swap blocks */
- LONG lSwapBytes; /* largest offset of swap block */
- LONG lDescriptor; /* descriptor seed, incremented */
- CHAR szSwapFile[VMM_FILE_NAME_LEN + 1];
- FILE *fpSwapFile;
- VMM_BLOCK_P pstReloadBlock; /* to id swap from disk to memory block */
- };
-
- typedef struct VMM_MGR_S VMM_MGR_T;
- typedef VMM_MGR_T * VMM_MGR_P;
-
-
-
- #ifdef C_ANSI
- SHORT VmmInit(SHORT,PCHAR);
- SHORT VmmAlloc(SHORT,SHORT,PLONG);
- SHORT VmmPrep(LONG,PPVOID);
- SHORT VmmFree(LONG);
- SHORT VmmTerm(VOID);
- SHORT VmmLoadFromDisk(VMM_BLOCK_P,SHORT);
- SHORT VmmAssignBlock(SHORT,SHORT,SHORT,VMM_BLOCK_P *);
- SHORT VmmSizeSwapToDisk(SHORT,SHORT,VMM_BLOCK_P *);
- SHORT VmmSwapToDisk(VMM_BLOCK_P,SHORT);
- SHORT VmmCreateDiskBlock(SHORT,VMM_BLOCK_P *);
- SHORT VmmSplitBlock(SHORT,VMM_BLOCK_P,SHORT,SHORT,VMM_BLOCK_P *);
- SHORT VmmCreateBlock(SHORT,SHORT,SHORT,PVOID,LONG,VMM_BLOCK_P *);
- SHORT VmmCompareBlockSize(PVOID, PVOID);
- SHORT VmmCompareHandle(PVOID, PVOID);
- SHORT VmmCompress(VOID);
- SHORT VmmVanishBlock(SHORT sType,VMM_BLOCK_P pstVanishBlock);
- LONG VmmCurTime(VOID);
- #else
- SHORT VmmInit();
- SHORT VmmAlloc();
- SHORT VmmPrep();
- SHORT VmmFree();
- SHORT VmmTerm();
- SHORT VmmLoadFromDisk();
- SHORT VmmAssignBlock();
- SHORT VmmSizeSwapToDisk();
- SHORT VmmSwapToDisk();
- SHORT VmmCreateDiskBlock();
- SHORT VmmSplitBlock();
- SHORT VmmCompress();
- SHORT VmmCreateBlock();
- SHORT VmmCompareBlockSize();
- SHORT VmmCompareHandle();
- SHORT VmmVanishBlock();
- LONG VmmCurTime();
- #endif
-
-
- #endif
-
-
-
-