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