move VMWare SVGA driver to generic location
[AROS.git] / rom / exec / memory.h
blob99fc317dc571787411e47d436308b03d4de12b3f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang:
7 */
8 #ifndef _MEMORY_H_
9 #define _MEMORY_H_
11 # include <aros/debug.h>
12 #include <exec/lists.h>
13 #include <exec/semaphores.h>
14 #include <exec/memory.h>
15 #include <stddef.h>
17 #define RTPOTx4(a) ((a)>2?4:(a)>1?2:1)
19 #define RTPOTx10(a) ((a)>=4?RTPOTx4(((a)+3)/4)*4:RTPOTx4(a))
21 #define RTPOTx100(a) \
22 ((a)>=0x10?RTPOTx10(((a)+0xf)/0x10)*0x10:RTPOTx10(a))
24 #define RTPOTx10000(a) \
25 ((a)>=0x100?RTPOTx100(((a)+0xff)/0x100)*0x100:RTPOTx100(a))
27 #define RTPOTx100000000(a) \
28 ((a)>=0x10000?RTPOTx10000(((a)+0xffff)/0x10000)*0x10000:RTPOTx10000(a))
30 #define ROUNDUP_TO_POWER_OF_TWO(a) RTPOTx100(a)
32 /* Some defines for the memory handling functions. */
34 /* This is for the alignment of memchunk structures. */
35 #define MEMCHUNK_TOTAL \
36 ROUNDUP_TO_POWER_OF_TWO(AROS_WORSTALIGN>sizeof(struct MemChunk)? \
37 AROS_WORSTALIGN:sizeof(struct MemChunk))
39 /* This allows to take the end of the MemHeader as the first MemChunk. */
40 #define MEMHEADER_TOTAL \
41 ((sizeof(struct MemHeader)+MEMCHUNK_TOTAL-1)&~(MEMCHUNK_TOTAL-1))
43 /* Private Pool structure */
44 struct Pool
46 struct MinList PuddleList;
47 struct MinList BlockList;
48 ULONG Requirements;
49 ULONG PuddleSize;
50 ULONG ThreshSize;
53 struct ProtectedPool
55 struct Pool pool;
56 struct SignalSemaphore sem;
59 struct Block
61 struct MinNode Node;
62 ULONG Size;
65 #if AROS_MUNGWALL_DEBUG
67 #define MUNGWALL_HEADER_ID 0x1ADEBCA1
69 /* This struct must not be bigger than MUNGWALLHEADER_SIZE!! */
71 struct MungwallHeader
73 union
75 struct
77 struct MinNode node;
78 ULONG magicid;
79 ULONG allocsize;
80 } s;
81 struct
83 UBYTE blub[MUNGWALLHEADER_SIZE];
84 } b;
85 } u;
88 #define mwh_node u.s.node
89 #define mwh_magicid u.s.magicid
90 #define mwh_allocsize u.s.allocsize
92 #endif
95 #define BLOCK_TOTAL \
96 ((sizeof(struct Block)+AROS_WORSTALIGN-1)&~(AROS_WORSTALIGN-1))
98 #endif