MUIM_List_InsertSingle: if there's no active entry,
[AROS.git] / arch / ppc-chrp / dos / internalunloadseg.c
blob79c1f384dbef0d0e549a74930901d4f23f3f1277
1 /*
2 Copyright � 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
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>
13 #include <proto/kernel.h>
15 /*****************************************************************************
17 NAME */
18 #include <proto/dos.h>
20 AROS_LH2(BOOL, InternalUnLoadSeg,
22 /* SYNOPSIS */
23 AROS_LHA(BPTR , seglist , D1),
24 AROS_LHA(VOID_FUNC, freefunc, A1),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 127, Dos)
29 /* FUNCTION
30 Unloads a seglist loaded with InternalLoadSeg().
32 INPUTS
33 seglist - Seglist
34 freefunc - Function to be called to free memory
36 RESULT
37 DOSTRUE if everything wents O.K.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 BPTR next;
55 if (seglist)
57 APTR KernelBase = OpenResource("kernel.resource");
59 while (seglist)
61 next = *(BPTR *)BADDR(seglist);
63 char *seg = (ULONG)seglist;
64 seg += (*(LONG *)((LONG)BADDR(seglist) - sizeof(ULONG))) / 2;
65 if (KernelBase)
66 KrnUnregisterModule(seg);
68 AROS_CALL2NR(void, freefunc,
69 AROS_LCA(APTR , (BPTR *)((LONG)BADDR(seglist) - sizeof(ULONG)), A1),
70 AROS_LCA(ULONG, *(LONG *)((LONG)BADDR(seglist) - sizeof(ULONG)), D0),
71 struct Library *, (struct Library *)SysBase
74 seglist = next;
76 return TRUE;
78 else
79 return FALSE;
81 AROS_LIBFUNC_EXIT
82 } /* InternalUnLoadSeg */