ilbmtoicon: Refuse to generate icons with differently sized select and normal images
[AROS.git] / rom / exec / memory.h
blob662009b160d575d26de34c13979b3fbb69702764
1 /*
2 Copyright © 1995-2011, 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>
17 * EXPERIMENTAL: use semaphore protection instead of Forbid()/Permit() for
18 * system memory allocation routines.
19 * In case of problems use definitions below.
21 * Many m68k programs assume forbid state won't get broken.
23 #ifndef __mc68000
24 #define MEM_LOCK ObtainSemaphore(&PrivExecBase(SysBase)->MemListSem)
25 #define MEM_LOCK_SHARED ObtainSemaphoreShared(&PrivExecBase(SysBase)->MemListSem)
26 #define MEM_UNLOCK ReleaseSemaphore(&PrivExecBase(SysBase)->MemListSem)
27 #else
28 #define MEM_LOCK Forbid()
29 #define MEM_LOCK_SHARED Forbid()
30 #define MEM_UNLOCK Permit()
31 #endif
33 /* Private Pool structure */
34 struct Pool
36 struct MinList PuddleList;
37 ULONG Requirements;
38 ULONG PuddleSize;
41 struct ProtectedPool
43 struct Pool pool;
44 struct SignalSemaphore sem;
47 struct Block
49 struct MinNode Node;
50 ULONG Size;
53 struct checkMemHandlersState
55 struct Node *cmhs_CurNode;
56 struct MemHandlerData cmhs_Data;
59 struct TraceLocation;
61 struct MemHeader *FindMem(APTR address, struct ExecBase *SysBase);
62 APTR stdAlloc(struct MemHeader *mh, IPTR byteSize, ULONG requirements, struct TraceLocation *loc, struct ExecBase *SysBase);
63 void stdDealloc(struct MemHeader *freeList, APTR memoryBlock, IPTR byteSize, struct TraceLocation *loc, struct ExecBase *SysBase);
65 APTR InternalAllocAbs(APTR location, IPTR byteSize, struct ExecBase *SysBase);
66 void InternalFreeMem(APTR location, IPTR byteSize, struct TraceLocation *loc, struct ExecBase *SysBase);
67 APTR AllocMemHeader(IPTR size, ULONG flags, struct TraceLocation *loc, struct ExecBase *SysBase);
68 void FreeMemHeader(APTR addr, struct TraceLocation *loc, struct ExecBase *SysBase);
70 APTR InternalAllocPooled(APTR poolHeader, IPTR memSize, ULONG flags, struct TraceLocation *loc, struct ExecBase *SysBase);
71 void InternalFreePooled(APTR memory, IPTR memSize, struct TraceLocation *loc, struct ExecBase *SysBase);
73 ULONG checkMemHandlers(struct checkMemHandlersState *cmhs, struct ExecBase *SysBase);
75 APTR nommu_AllocMem(IPTR byteSize, ULONG flags, struct TraceLocation *loc, struct ExecBase *SysBase);
76 APTR nommu_AllocAbs(APTR location, IPTR byteSize, struct ExecBase *SysBase);
77 void nommu_FreeMem(APTR memoryBlock, IPTR byteSize, struct TraceLocation *loc, struct ExecBase *SysBase);
78 IPTR nommu_AvailMem(ULONG attributes, struct ExecBase *SysBase);
80 #define BLOCK_TOTAL \
81 ((sizeof(struct Block)+AROS_WORSTALIGN-1)&~(AROS_WORSTALIGN-1))
83 #endif