use the locations specified in the bcm2708_boot header
[AROS.git] / rom / exec / allocvec.c
blobdc799bf8b292100c2dd8fcc7cdc220c0086faac6
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Allocate some memory.
6 Lang: english
7 */
8 #include "exec_intern.h"
9 #include <aros/libcall.h>
10 #include "memory.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
17 AROS_LH2(APTR, AllocVec,
19 /* SYNOPSIS */
20 AROS_LHA(IPTR, byteSize, D0),
21 AROS_LHA(ULONG, requirements, D1),
23 /* LOCATION */
24 struct ExecBase *, SysBase, 114, Exec)
26 /* FUNCTION
27 Allocate some memory from the sytem memory pool with the given
28 requirements and without the need to memorize the actual size
29 of the block.
31 INPUTS
32 byteSize - Number of bytes you want to get
33 requirements - Type of memory
35 RESULT
36 A pointer to the number of bytes you wanted or NULL if the memory
37 couldn't be allocated
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 FreeVec()
48 INTERNALS
50 ******************************************************************************/
52 AROS_LIBFUNC_INIT
54 UBYTE *ret;
56 /* 0-sized allocation results in returning NULL (API guarantee) */
57 if(!byteSize)
58 return NULL;
60 /* Add room for stored size. */
61 byteSize+=AROS_ALIGN(sizeof(IPTR));
63 /* Get the memory. */
64 ret=(UBYTE *)AllocMem(byteSize,requirements);
66 /* If there's not enough memory left return immediately. */
67 if(ret==NULL)
68 return NULL;
70 /* Store size */
71 *(IPTR *)ret=byteSize;
73 /* return free space */
74 return ret+AROS_ALIGN(sizeof(IPTR));
75 AROS_LIBFUNC_EXIT
76 } /* AllocVec */