1 #ifndef EXEC_MEMHEADEREXT_H
2 #define EXEC_MEMHEADEREXT_H
4 Copyright � 1995-2012, The AROS Development Team. All rights reserved.
7 Desc: Extended memory handling. New in AROS.
12 # include <exec/memory.h>
16 #include <aros/macros.h>
21 struct MemHeader mhe_MemHeader
;
25 /* Let an external 'driver' manage this memory
30 /* Pool initialization and destruction */
31 APTR (* mhe_InitPool
)(struct MemHeaderExt
*, IPTR puddleSize
, IPTR initialSize
);
32 VOID (* mhe_DestroyPool
)(struct MemHeaderExt
*);
34 /* Memory allocation functions */
35 APTR (* mhe_Alloc
) (struct MemHeaderExt
*, IPTR size
, ULONG
*flags
);
36 APTR (* mhe_AllocAligned
) (struct MemHeaderExt
*, IPTR size
, IPTR align
, ULONG
*flags
);
37 VOID (* mhe_Free
) (struct MemHeaderExt
*, APTR mem
, IPTR size
);
38 APTR (* mhe_AllocVec
)(struct MemHeaderExt
*, IPTR size
, ULONG
*flags
);
39 APTR (* mhe_AllocVecAligned
) (struct MemHeaderExt
*, IPTR size
, IPTR align
, ULONG
*flags
);
40 VOID (* mhe_FreeVec
) (struct MemHeaderExt
*, APTR mem
);
41 APTR (* mhe_AllocAbs
)(struct MemHeaderExt
*, IPTR size
, APTR addr
);
42 APTR (* mhe_ReAlloc
) (struct MemHeaderExt
*, APTR old
, IPTR size
);
45 IPTR (* mhe_Avail
) (struct MemHeaderExt
*, ULONG flags
);
46 BOOL (* mhe_InBounds
)(struct MemHeaderExt
*, APTR begin
, APTR end
);
49 /* Magic value indicating the MemHeaderExt */
50 #define MEMHEADER_EXT_MAGIC AROS_MAKE_ID('M','n','G','d')
52 /* Indicates that the memory region is to be
53 treated as an opaque object managed only through the
54 functions whose pointers are in the extended mem header. */
55 #define MEMF_MANAGED (1L << 15)
57 #define IsManagedMem(mh) \
58 ((((struct MemHeader *)mh)->mh_Attributes & MEMF_MANAGED) && \
59 (((struct MemHeaderExt *)mh)->mhe_Magic == MEMHEADER_EXT_MAGIC))