1
0
Fork 0

Added MEM_AllocatedPages. Get amount of allocated pages of handle

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1148
This commit is contained in:
Ulf Wohlers 2003-07-24 19:13:58 +00:00
parent 54ef7a5825
commit 2daf8b32c7
2 changed files with 10 additions and 1 deletions

View file

@ -38,6 +38,7 @@ HostPt MEM_GetBlockPage(void);
Bitu MEM_FreeTotal(void); //Free 4 kb pages
Bitu MEM_FreeLargest(void); //Largest free 4 kb pages block
Bitu MEM_TotalPages(void); //Total amount of 4 kb pages
Bitu MEM_AllocatedPages(MemHandle handle); // amount of allocated pages of handle
MemHandle MEM_AllocatePages(Bitu pages,bool sequence);
PhysPt MEM_AllocatePage(void);
void MEM_ReleasePages(MemHandle handle);

View file

@ -468,7 +468,6 @@ Bitu MEM_FreeLargest(void) {
return largest;
}
Bitu MEM_FreeTotal(void) {
Bitu free=0;
Bitu index=XMS_START;
@ -479,6 +478,15 @@ Bitu MEM_FreeTotal(void) {
return free;
}
Bitu MEM_AllocatedPages(MemHandle handle)
{
Bitu pages = 0;
while (handle>0) {
pages++;
handle=memory.entries[handle].next_handle;
}
return pages;
}
//TODO Maybe some protection for this whole allocation scheme