2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Add memory to the public list of memory.
8 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <exec/memory.h>
12 #include <proto/exec.h>
14 /*****************************************************************************
18 AROS_LH5(void, AddMemList
,
21 AROS_LHA(ULONG
, size
, D0
),
22 AROS_LHA(ULONG
, attributes
, D1
),
23 AROS_LHA(LONG
, pri
, D2
),
24 AROS_LHA(APTR
, base
, A0
),
25 AROS_LHA(STRPTR
, name
, A1
),
28 struct ExecBase
*, SysBase
, 103, Exec
)
31 Add a new block of memory to the system memory lists.
34 size - Size of the block
35 attributes - The attributes the memory will have
36 pri - Priority in the list of MemHeaders
38 name - A name associated with the memory
43 No argument checking done.
53 ******************************************************************************/
59 /* Do I have to look here if it matches some other MemHeader? */
60 mh
=(struct MemHeader
*)base
;
61 mh
->mh_Node
.ln_Type
=NT_MEMORY
;
62 mh
->mh_Node
.ln_Pri
=pri
;
63 mh
->mh_Node
.ln_Name
=name
;
64 mh
->mh_Attributes
=attributes
;
65 mh
->mh_First
=(struct MemChunk
*)((UBYTE
*)mh
+MEMHEADER_TOTAL
);
66 mh
->mh_First
->mc_Next
=NULL
;
67 mh
->mh_First
->mc_Bytes
=size
-MEMHEADER_TOTAL
;
68 mh
->mh_Lower
=mh
->mh_First
;
69 mh
->mh_Upper
=(APTR
)((UBYTE
*)base
+size
);
70 mh
->mh_Free
=mh
->mh_First
->mc_Bytes
;
72 /* Protect the memory list. */
75 Enqueue(&SysBase
->MemList
,&mh
->mh_Node
);