4 * Ethernet Packet Interface to NDIS drivers.
6 * Copyright 1998 Equivalence Pty. Ltd.
8 * Original code by William Ingle (address unknown)
11 * Revision 1.1 1998/09/28 08:08:38 robertj
20 #include <vxdwraps.h> // must come last
25 #pragma VxD_LOCKED_CODE_SEG
26 #pragma VxD_LOCKED_DATA_SEG
29 DWORD _stdcall
PacketPageLock(DWORD lpMem
, DWORD cbSize
)
33 DWORD LinOffset
= lpMem
& 0xfff; // page offset of memory to map
34 DWORD LinPageNum
= lpMem
>> 12; // generate page number
35 DWORD nPages
= ((lpMem
+ cbSize
) >> 12) - LinPageNum
+ 1; // Calculate # of pages to map globally
37 // Return global mapping of passed in pointer, as this new pointer
38 // is how the memory must be accessed out of context.
39 return _LinPageLock(LinPageNum
, nPages
, PAGEMAPGLOBAL
) + LinOffset
;
43 void _stdcall
PacketPageUnlock(void * lpMem
, DWORD cbSize
)
47 DWORD LinPageNum
= (DWORD
)lpMem
>> 12;
48 DWORD nPages
= (((DWORD
)lpMem
+ cbSize
) >> 12) - LinPageNum
+ 1;
50 // Free globally mapped memory
51 _LinPageUnlock(LinPageNum
, nPages
, PAGEMAPGLOBAL
);
55 // End of File ////////////////////////////////////////////////////////////////