6 #include "diskBack.unix.c"
7 #include "mmap-protect.c"
12 void GC_displayMem (void) {
13 static char buffer
[256];
15 snprintf (buffer
, cardof(buffer
), "/usr/bin/vmmap -w -interleaved %d\n", (int)getpid ());
16 (void)system (buffer
);
19 static void catcher (__attribute__ ((unused
)) int signo
,
20 __attribute__ ((unused
)) siginfo_t
* info
,
22 ucontext_t
* ucp
= (ucontext_t
*)context
;
23 #if (defined(__powerpc__) || defined(__ppc__))
25 GC_handleSigProf ((code_pointer
) ucp
->uc_mcontext
->__ss
.__srr0
);
27 GC_handleSigProf ((code_pointer
) ucp
->uc_mcontext
->ss
.srr0
);
29 #elif (defined(__i386__))
31 GC_handleSigProf ((code_pointer
) ucp
->uc_mcontext
->__ss
.__eip
);
33 GC_handleSigProf ((code_pointer
) ucp
->uc_mcontext
->ss
.eip
);
35 #elif (defined(__x86_64__))
37 GC_handleSigProf ((code_pointer
) ucp
->uc_mcontext
->__ss
.__rip
);
39 GC_handleSigProf ((code_pointer
) ucp
->uc_mcontext
->ss
.rip
);
42 #error Unsupported darwin CPU architecture
46 void GC_setSigProfHandler (struct sigaction
*sa
) {
47 sa
->sa_flags
= SA_ONSTACK
| SA_RESTART
| SA_SIGINFO
;
48 sa
->sa_sigaction
= (void (*)(int, siginfo_t
*, void*))catcher
;