[NTVDM]
[reactos.git] / reactos / subsystems / mvdm / ntvdm / dos / dos32krnl / memory.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: dos/dos32krnl/memory.h
5 * PURPOSE: DOS32 Memory Manager
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _MEMORY_H_
10 #define _MEMORY_H_
11
12 /* TYPEDEFS *******************************************************************/
13
14 #define SEGMENT_TO_MCB(seg) ((PDOS_MCB)((ULONG_PTR)BaseAddress + TO_LINEAR((seg), 0)))
15
16 enum DOS_ALLOC_STRATEGY
17 {
18 DOS_ALLOC_FIRST_FIT,
19 DOS_ALLOC_BEST_FIT,
20 DOS_ALLOC_LAST_FIT
21 };
22
23 #pragma pack(push, 1)
24 typedef struct _DOS_MCB
25 {
26 CHAR BlockType;
27 WORD OwnerPsp;
28 WORD Size;
29 BYTE Unused[3];
30 CHAR Name[8];
31 } DOS_MCB, *PDOS_MCB;
32 #pragma pack(pop)
33
34 /* VARIABLES ******************************************************************/
35
36 extern BYTE DosAllocStrategy;
37 extern BOOLEAN DosUmbLinked;
38
39 /* FUNCTIONS ******************************************************************/
40
41 WORD DosAllocateMemory(WORD Size, WORD *MaxAvailable);
42 BOOLEAN DosResizeMemory(WORD BlockData, WORD NewSize, WORD *MaxAvailable);
43 BOOLEAN DosFreeMemory(WORD BlockData);
44 BOOLEAN DosLinkUmb(VOID);
45 BOOLEAN DosUnlinkUmb(VOID);
46 VOID DosChangeMemoryOwner(WORD Segment, WORD NewOwner);
47
48 #endif // _MEMORY_H_
49
50 /* EOF */