2 Copyright © 1995-2013, 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>
15 #include "dos_intern.h"
16 #include "internalloadseg.h"
18 /*****************************************************************************
21 #include <proto/dos.h>
23 AROS_LH2(BOOL
, InternalUnLoadSeg
,
26 AROS_LHA(BPTR
, seglist
, D1
),
27 AROS_LHA(VOID_FUNC
, freefunc
, A1
),
30 struct DosLibrary
*, DOSBase
, 127, Dos
)
33 Unloads a seglist loaded with InternalLoadSeg().
37 freefunc - Function to be called to free memory
40 DOSTRUE if everything went OK.
52 *****************************************************************************/
57 SIPTR funcarray
[] = { (SIPTR
)NULL
, (SIPTR
)NULL
, (SIPTR
)freefunc
};
62 UnregisterModule(seglist
);
66 /* free overlay structures */
67 ULONG
*seg
= BADDR(seglist
);
68 if (seg
[2] == 0x0000abcd && seg
[6] == (ULONG
)DOSBase
->dl_GV
) {
69 Close((BPTR
)seg
[3]); /* file handle */
70 ilsFreeVec((void*)seg
[4]); /* overlay table, APTR */
71 ilsFreeVec(BADDR(seg
[5])); /* hunk table, BPTR */
78 next
= *(BPTR
*)BADDR(seglist
);
79 ilsFreeVec(BADDR(seglist
));
89 } /* InternalUnLoadSeg */