2 Copyright © 1995-2018, The AROS Development Team. All rights reserved.
5 Desc: m68k SegTracker emulation.
8 #include <aros/config.h>
9 #include <aros/debug.h>
10 #include <libraries/debug.h>
11 #include <proto/exec.h>
12 #include <proto/debug.h>
14 #include "debug_intern.h"
18 struct SignalSemaphore seg_Semaphore
;
20 /* Dummy list for programs that directly
21 * read SegTracker segment list.
23 struct MinList seg_List
;
25 #define SEG_SEM "SegTracker"
27 static AROS_UFH3(UBYTE
*, SegTrack
,
28 AROS_UFHA(ULONG
, Address
, A0
),
29 AROS_UFHA(ULONG
*, SegNum
, A1
),
30 AROS_UFHA(ULONG
*, Offset
, A2
))
34 /* Bad code again but SegTrack() may be called in Supervisor context.. */
35 struct DebugBase
*DebugBase
= (struct DebugBase
*)FindName(&SysBase
->LibList
, "debug.library");
38 BPTR segPtr
, firstSeg
;
40 if (DecodeLocation((APTR
)Address
, DL_SegmentNumber
, &segNum2
, DL_SegmentPointer
, &segPtr
,
41 DL_FirstSegment
, &firstSeg
, DL_ModuleName
, &modName
, TAG_DONE
)) {
42 if (SegNum
== Offset
) {
46 *Offset
= Address
- (ULONG
)BADDR(segPtr
);
57 static int SegTracker_Init(struct DebugBase
*DebugBase
)
61 ss
= AllocMem(sizeof(struct SegSem
), MEMF_CLEAR
| MEMF_PUBLIC
);
63 ss
->seg_Semaphore
.ss_Link
.ln_Name
= SEG_SEM
;
64 ss
->seg_Semaphore
.ss_Link
.ln_Pri
= -127;
65 ss
->seg_Find
= SegTrack
;
66 NEWLIST((struct List
*)&ss
->seg_List
);
67 AddSemaphore(&ss
->seg_Semaphore
);
72 ADD2INITLIB(SegTracker_Init
, -100)