2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
8 #include "dos_intern.h"
9 #include <proto/exec.h>
10 #include <aros/libcall.h>
11 #include <aros/asmcall.h>
12 #include <exec/libraries.h>
14 /*****************************************************************************
17 #include <proto/dos.h>
19 AROS_LH2(BOOL
, InternalUnLoadSeg
,
22 AROS_LHA(BPTR
, seglist
, D1
),
23 AROS_LHA(VOID_FUNC
, freefunc
, A1
),
26 struct DosLibrary
*, DOSBase
, 127, Dos
)
29 Unloads a seglist loaded with InternalLoadSeg().
33 freefunc - Function to be called to free memory
36 DOSTRUE if everything wents O.K.
48 *****************************************************************************/
56 #if AROS_MODULES_DEBUG
57 extern struct MinList debug_seglist
;
58 extern struct MinList free_debug_segnodes
;
59 struct debug_segnode
*segnode
;
62 ForeachNode(&debug_seglist
, segnode
)
64 if (segnode
->seglist
== seglist
)
66 /* use the same free function as loadseg ! */
68 while ((si
= (struct seginfo
*)REMHEAD(&segnode
->seginfos
)))
70 AROS_CALL2NR(void, freefunc
,
71 AROS_LCA(APTR
, (APTR
)si
, A1
),
72 AROS_LCA(ULONG
, (ULONG
)sizeof(struct seginfo
), D0
),
73 struct Library
*, (struct Library
*)SysBase
78 ADDHEAD(&free_debug_segnodes
, segnode
);
87 next
= *(BPTR
*)BADDR(seglist
);
89 AROS_CALL2NR(void, freefunc
,
90 AROS_LCA(APTR
, (BPTR
*)((LONG
)BADDR(seglist
) - sizeof(ULONG
)), A1
),
91 AROS_LCA(ULONG
, *(LONG
*)((LONG
)BADDR(seglist
) - sizeof(ULONG
)), D0
),
92 struct Library
*, (struct Library
*)SysBase
103 } /* InternalUnLoadSeg */