Removed autodocs of arch specific variants of ROM modules.
[AROS.git] / arch / all-unix / exec / freemem.c
bloba6a422229f823f8ca498d61ac46e67f02bb58bc1
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Free memory allocated by AllocMem()
6 Lang: english
7 */
8 #include <exec/alerts.h>
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <aros/config.h>
12 #include <aros/macros.h>
13 #include <aros/rt.h>
14 #include <exec/memory.h>
15 #include <exec/memheaderext.h>
16 #include <proto/exec.h>
18 #include "exec_debug.h"
20 #ifndef DEBUG_FreeMem
21 # define DEBUG_FreeMem 0
22 #endif
23 #undef DEBUG
24 #if DEBUG_FreeMem
25 # define DEBUG 1
26 #endif
27 #define MDEBUG 1
29 #include <aros/debug.h>
31 #include <stdlib.h>
33 #include "exec_intern.h"
34 #include "memory.h"
36 #undef FreeMem /* If we're debugging, AROS Clib will try to remap this */
38 /* See rom/exec/freemem.c for documentation */
40 AROS_LH2(void, FreeMem,
41 AROS_LHA(APTR, memoryBlock, A1),
42 AROS_LHA(IPTR, byteSize, D0),
43 struct ExecBase *, SysBase, 35, Exec)
45 AROS_LIBFUNC_INIT
47 ULONG origsize = byteSize;
49 D(bug("Call FreeMem (%08lx, %ld)\n", memoryBlock, byteSize));
51 /* If there is no memory free nothing */
52 if(!byteSize || !memoryBlock)
53 ReturnVoid ("FreeMem");
55 #if ENABLE_RT
56 RT_Free(RTT_MEMORY, memoryBlock, byteSize);
57 #endif
59 /* In early boot mode we can't free any memory */
60 if (!PrivExecBase(SysBase)->defaultPool)
61 return;
63 FreePooled(PrivExecBase(SysBase)->defaultPool, memoryBlock, byteSize);
65 ReturnVoid ("FreeMem");
67 AROS_LIBFUNC_EXIT
68 } /* FreeMem */