Category : C++ Source Code
Archive   : VMVCPP.ZIP
Filename : VMLOCK.C

 
Output of file : VMLOCK.C contained in archive : VMVCPP.ZIP
/***
* vmlock.c -
*
* Copyright (c) 1989-1992, Microsoft Corporation. All rights reserved.
*
*Purpose:
*
* PUBLIC Functions:
*
* PVmLockVp:
* This function locks the page containing the specified virtual
* address using PVmLockVpCb.
*
* VmUnlockVp:
* This function unlocks the page containing the specified virtual
* address using VmUnlockVpCb.
*
*******************************************************************************/

#pragma title("Virtual Memory Manager")
#pragma subtitle("Locking functions")

#include
#include
#include
#include
#include
#include

#include
#include

unsigned _near _timeCur; /* Current timestamp value */

#pragma page()

PVOID PUBLIC __PVmLockVp(VPVOID vp)
{
PVOID pv;
HPGD hpgd;

VmTracePrintf(("PVmLockVp: vp = %08lX.\n", vp));

pv = __PVmLoadVp(vp, FALSE);
if (pv == NULL)
return(NULL);

hpgd = __HpgdSearchCache(vp);
Assert(hpgd != hpgdNil);

PpgdOfHpgd(hpgd)->cLock++;

return(pv);
}


#pragma page()

void PUBLIC __VmUnlockVp(VPVOID vp, int fDirty)
{
HPGD hpgd;

VmTracePrintf(("VmUnlockVp: vp = %08lX, fDirty = %u.\n", vp, fDirty));

hpgd = __HpgdSearchCache(vp);
Assert(hpgd != hpgdNil);

Assert(PpgdOfHpgd(hpgd)->cLock != 0);
PpgdOfHpgd(hpgd)->cLock--;

if (++_timeCur == UINT_MAX)
__VmUpdateTimestamps();

PpgdOfHpgd(hpgd)->timeRef = _timeCur;

if (fDirty) /* Mark page as dirty if requested */
PpgdOfHpgd(hpgd)->Flags |= fDirtyPgd;
}


  3 Responses to “Category : C++ Source Code
Archive   : VMVCPP.ZIP
Filename : VMLOCK.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/