revert between 56095 -> 55830 in arch
[AROS.git] / compiler / include / exec / memory.h
blobd1a30bbaa39551ce47cd084b9ec9f3f5d76d01c2
1 #ifndef EXEC_MEMORY_H
2 #define EXEC_MEMORY_H
4 /*
5 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Memory handling
9 Lang: english
12 #ifndef EXEC_NODES_H
13 # include <exec/nodes.h>
14 #endif
16 struct MemHeader
18 struct Node mh_Node;
19 UWORD mh_Attributes;
20 struct MemChunk * mh_First;
21 APTR mh_Lower;
22 APTR mh_Upper;
23 IPTR mh_Free;
26 struct MemChunk
28 struct MemChunk *mc_Next;
29 IPTR mc_Bytes;
32 /* Total size of struct MemChunk, including padding */
33 #define MEMCHUNK_TOTAL (AROS_WORSTALIGN > sizeof(struct MemChunk) ? AROS_WORSTALIGN : sizeof(struct MemChunk))
34 /* Total size of struct MemHeader, including padding */
35 #define MEMHEADER_TOTAL (AROS_ROUNDUP2(sizeof(struct MemHeader), MEMCHUNK_TOTAL))
37 struct MemEntry
39 union
41 ULONG meu_Reqs;
42 APTR meu_Addr;
43 } me_Un;
44 IPTR me_Length;
46 #define me_Reqs me_Un.meu_Reqs
47 #define me_Addr me_Un.meu_Addr
49 struct MemList
51 struct Node ml_Node;
52 UWORD ml_NumEntries;
53 struct MemEntry ml_ME[1];
56 #define MEM_BLOCKSIZE 8L
57 #define MEM_BLOCKMASK (MEM_BLOCKSIZE - 1)
59 /* Memory allocation flags */
60 #define MEMF_ANY 0L
61 #define MEMB_PUBLIC 0
62 #define MEMF_PUBLIC (1L << MEMB_PUBLIC)
63 #define MEMB_CHIP 1
64 #define MEMF_CHIP (1L << MEMB_CHIP)
65 #define MEMB_FAST 2
66 #define MEMF_FAST (1L << MEMB_FAST)
67 #define MEMB_VIRTUAL 3 /* AmigaOS v4 compatible */
68 #define MEMF_VIRTUAL (1L << MEMB_VIRTUAL)
69 #define MEMB_EXECUTABLE 4 /* AmigaOS v4 compatible */
70 #define MEMF_EXECUTABLE (1L << MEMB_EXECUTABLE)
71 #define MEMB_LOCAL 8
72 #define MEMF_LOCAL (1L << MEMB_LOCAL)
73 #define MEMB_24BITDMA 9
74 #define MEMF_24BITDMA (1L << MEMB_24BITDMA)
75 #define MEMB_KICK 10
76 #define MEMF_KICK (1L << MEMB_KICK)
77 #define MEMB_PRIVATE 11
78 #define MEMF_PRIVATE (1L << MEMB_PRIVATE)
79 #define MEMB_31BIT 12 /* Low address space (<2GB). Effective only on 64 bit machines. */
80 #define MEMF_31BIT (1L << MEMB_31BIT)
82 #define MEMB_CLEAR 16 /* Explicitly clear memory after allocation */
83 #define MEMF_CLEAR (1L << MEMB_CLEAR)
84 #define MEMB_LARGEST 17
85 #define MEMF_LARGEST (1L << MEMB_LARGEST)
86 #define MEMB_REVERSE 18
87 #define MEMF_REVERSE (1L << MEMB_REVERSE)
88 #define MEMB_TOTAL 19
89 #define MEMF_TOTAL (1L << MEMB_TOTAL)
90 #define MEMB_HWALIGNED 20 /* For AllocMem() - align address and size to physical page boundary */
91 #define MEMF_HWALIGNED (1L << MEMB_HWALIGNED)
92 #define MEMB_SEM_PROTECTED 20 /* For CreatePool() - add semaphore protection to the pool */
93 #define MEMF_SEM_PROTECTED (1L << MEMB_SEM_PROTECTED)
94 #define MEMB_NO_EXPUNGE 31
95 #define MEMF_NO_EXPUNGE (1L << MEMB_NO_EXPUNGE)
98 * Mask for flags that describe physical properties of the memory.
99 * MEMF_31BIT is effective only on 64-bit machines.
100 * This is actually AROS internal definition, it may change. Do not rely on it.
102 #if (__WORDSIZE == 64)
103 #define MEMF_PHYSICAL_MASK (MEMF_PUBLIC|MEMF_CHIP|MEMF_FAST|MEMF_LOCAL|MEMF_24BITDMA|MEMF_KICK|MEMF_31BIT)
104 #else
105 #define MEMF_PHYSICAL_MASK (MEMF_PUBLIC|MEMF_CHIP|MEMF_FAST|MEMF_LOCAL|MEMF_24BITDMA|MEMF_KICK)
106 #endif
108 struct MemHandlerData
110 IPTR memh_RequestSize;
111 ULONG memh_RequestFlags;
112 ULONG memh_Flags;
115 #define MEMHF_RECYCLE (1L<<0)
117 #define MEM_ALL_DONE (-1)
118 #define MEM_DID_NOTHING 0
119 #define MEM_TRY_AGAIN 1
121 #endif /* EXEC_MEMORY_H */