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>
13 #include <proto/kernel.h>
15 /*****************************************************************************
18 #include <proto/dos.h>
20 AROS_LH2(BOOL
, InternalUnLoadSeg
,
23 AROS_LHA(BPTR
, seglist
, D1
),
24 AROS_LHA(VOID_FUNC
, freefunc
, A1
),
27 struct DosLibrary
*, DOSBase
, 127, Dos
)
30 Unloads a seglist loaded with InternalLoadSeg().
34 freefunc - Function to be called to free memory
37 DOSTRUE if everything wents O.K.
49 *****************************************************************************/
57 APTR KernelBase
= OpenResource("kernel.resource");
61 next
= *(BPTR
*)BADDR(seglist
);
63 char *seg
= (ULONG
)seglist
;
64 seg
+= (*(LONG
*)((LONG
)BADDR(seglist
) - sizeof(ULONG
))) / 2;
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
82 } /* InternalUnLoadSeg */