some fixes to accented characters
[tangerine.git] / rom / exec / memory.h
blob0df0722470f1955af5fd03f60734be3d07dd2dda
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang:
7 */
8 #ifndef _MEMORY_H_
9 #define _MEMORY_H_
11 #include <exec/lists.h>
12 #include <exec/semaphores.h>
13 #include <exec/memory.h>
14 #include <stddef.h>
16 #define RTPOTx4(a) ((a)>2?4:(a)>1?2:1)
18 #define RTPOTx10(a) ((a)>=4?RTPOTx4(((a)+3)/4)*4:RTPOTx4(a))
20 #define RTPOTx100(a) \
21 ((a)>=0x10?RTPOTx10(((a)+0xf)/0x10)*0x10:RTPOTx10(a))
23 #define RTPOTx10000(a) \
24 ((a)>=0x100?RTPOTx100(((a)+0xff)/0x100)*0x100:RTPOTx100(a))
26 #define RTPOTx100000000(a) \
27 ((a)>=0x10000?RTPOTx10000(((a)+0xffff)/0x10000)*0x10000:RTPOTx10000(a))
29 #define ROUNDUP_TO_POWER_OF_TWO(a) RTPOTx100(a)
31 /* Some defines for the memory handling functions. */
33 /* This is for the alignment of memchunk structures. */
34 #define MEMCHUNK_TOTAL \
35 ROUNDUP_TO_POWER_OF_TWO(AROS_WORSTALIGN>sizeof(struct MemChunk)? \
36 AROS_WORSTALIGN:sizeof(struct MemChunk))
38 /* This allows to take the end of the MemHeader as the first MemChunk. */
39 #define MEMHEADER_TOTAL \
40 ((sizeof(struct MemHeader)+MEMCHUNK_TOTAL-1)&~(MEMCHUNK_TOTAL-1))
42 /* Private Pool structure */
43 struct Pool
45 struct MinList PuddleList;
46 struct MinList BlockList;
47 ULONG Requirements;
48 ULONG PuddleSize;
49 ULONG ThreshSize;
52 struct ProtectedPool
54 struct Pool pool;
55 struct SignalSemaphore sem;
58 struct Block
60 struct MinNode Node;
61 ULONG Size;
64 #if AROS_MUNGWALL_DEBUG
65 #include <aros/debug.h> /* for MUNGWALLHEADER_SIZE */
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