For compatibily with AmigaOS we are handle this cases specially:
[AROS.git] / compiler / include / exec / memheaderext.h
blobdec5e8375649c28de34f9f0dcb2a6f40846aed07
1 #ifndef EXEC_MEMHEADEREXT_H
2 #define EXEC_MEMHEADEREXT_H
3 /*
4 Copyright � 1995-2012, The AROS Development Team. All rights reserved.
5 $Id$
7 Desc: Extended memory handling. New in AROS.
8 Lang: english
9 */
11 #ifndef EXEC_MEMORY_H
12 # include <exec/memory.h>
13 #endif
15 #ifndef AROS_MACROS_H
16 #include <aros/macros.h>
17 #endif
19 struct MemHeaderExt
21 struct MemHeader mhe_MemHeader;
23 ULONG mhe_Magic;
25 /* Let an external 'driver' manage this memory
26 region opaquely. */
28 APTR mhe_UserData;
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);
44 /* Query functions */
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))
61 #endif