2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <aros/libcall.h>
10 #include <aros/asmcall.h>
11 #include <exec/libraries.h>
12 #include <proto/debug.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
16 #include "loadseg_intern.h"
18 /*****************************************************************************
21 #include <loadseg/loadseg.h>
28 struct DosLibrary
*DOSBase
)
35 Unloads a seglist loaded with LoadSegment().
39 freefunc - Function to be called to free memory
40 DOSBase - Required for AOS HUNK overlays only, otherwise NULL
43 DOSTRUE if everything wents O.K.
55 *****************************************************************************/
58 SIPTR funcarray
[] = { (SIPTR
)NULL
, (SIPTR
)NULL
, (SIPTR
)freefunc
};
64 if ((DebugBase
= OpenLibrary("debug.library", 0))) {
65 UnregisterModule(seglist
);
66 CloseLibrary(DebugBase
);
69 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
70 if (DOSBase
!= NULL
) {
71 /* free overlay structures */
72 ULONG
*seg
= BADDR(seglist
);
73 if (seg
[2] == 0x0000abcd && seg
[6] == (ULONG
)DOSBase
->dl_GV
) {
74 Close((BPTR
)seg
[3]); /* file handle */
75 ilsFreeVec((void*)seg
[4]); /* overlay table, APTR */
76 ilsFreeVec(BADDR(seg
[5])); /* hunk table, BPTR */
83 next
= *(BPTR
*)BADDR(seglist
);
84 ilsFreeVec(BADDR(seglist
));