ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/sigsegv.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/sigsegv.cpp (file contents):
Revision 1.32 by gbeauche, 2003-10-21T21:59:41Z vs.
Revision 1.33 by gbeauche, 2003-10-21T23:10:19Z

# Line 228 | Line 228 | static void powerpc_decode_instruction(i
228   #define SIGSEGV_FAULT_INSTRUCTION               SIGSEGV_CONTEXT_REGS[REG_PC]
229   #endif
230   #endif
231 < #if defined(__NetBSD__) || defined(__FreeBSD__)
231 > #if defined(__FreeBSD__)
232   #if (defined(i386) || defined(__i386__))
233   #define SIGSEGV_FAULT_INSTRUCTION               (((struct sigcontext *)scp)->sc_eip)
234   #define SIGSEGV_REGISTER_FILE                   ((unsigned int *)&(((struct sigcontext *)scp)->sc_edi)) /* EDI is the first GPR (even below EIP) in sigcontext */
# Line 297 | Line 297 | static void powerpc_decode_instruction(i
297   #define SIGSEGV_FAULT_HANDLER_ARGS              sig, code, scp
298   #define SIGSEGV_FAULT_ADDRESS                   get_fault_address(scp)
299   #define SIGSEGV_FAULT_INSTRUCTION               scp->sc_pc
300
301 // From Boehm's GC 6.0alpha8
302 static sigsegv_address_t get_fault_address(struct sigcontext *scp)
303 {
304        unsigned int instruction = *((unsigned int *)(scp->sc_pc));
305        unsigned long fault_address = scp->sc_regs[(instruction >> 16) & 0x1f];
306        fault_address += (signed long)(signed short)(instruction & 0xffff);
307        return (sigsegv_address_t)fault_address;
308 }
300   #endif
301   #endif
302  
# Line 343 | Line 334 | static sigsegv_address_t get_fault_addre
334   #define SIGSEGV_ALL_SIGNALS                             FAULT_HANDLER(SIGSEGV)
335   #endif
336  
337 < // NetBSD or FreeBSD
338 < #if defined(__NetBSD__) || defined(__FreeBSD__)
337 > // NetBSD
338 > #if defined(__NetBSD__)
339   #if (defined(m68k) || defined(__m68k__))
340   #include <m68k/frame.h>
341   #define SIGSEGV_FAULT_HANDLER_ARGLIST   int sig, int code, struct sigcontext *scp
# Line 372 | Line 363 | static sigsegv_address_t get_fault_addre
363          }
364          return (sigsegv_address_t)fault_addr;
365   }
366 < #else
367 < #define SIGSEGV_FAULT_HANDLER_ARGLIST   int sig, int code, void *scp, char *addr
366 > #endif
367 > #if (defined(alpha) || defined(__alpha__))
368 > #define SIGSEGV_FAULT_HANDLER_ARGLIST   int sig, int code, struct sigcontext *scp
369 > #define SIGSEGV_FAULT_HANDLER_ARGS              sig, code, scp
370 > #define SIGSEGV_FAULT_ADDRESS                   get_fault_address(scp)
371 > #define SIGSEGV_ALL_SIGNALS                             FAULT_HANDLER(SIGBUS)
372 > #endif
373 > #if (defined(i386) || defined(__i386__))
374 > #error "FIXME: need to decode instruction and compute EA"
375 > #define SIGSEGV_FAULT_HANDLER_ARGLIST   int sig, int code, struct sigcontext *scp
376 > #define SIGSEGV_FAULT_HANDLER_ARGS              sig, code, scp
377 > #define SIGSEGV_ALL_SIGNALS                             FAULT_HANDLER(SIGSEGV)
378 > #endif
379 > #endif
380 > #if defined(__FreeBSD__)
381 > #define SIGSEGV_ALL_SIGNALS                             FAULT_HANDLER(SIGBUS)
382 > #if (defined(i386) || defined(__i386__))
383 > #define SIGSEGV_FAULT_HANDLER_ARGLIST   int sig, int code, struct sigcontext *scp, char *addr
384   #define SIGSEGV_FAULT_HANDLER_ARGS              sig, code, scp, addr
385   #define SIGSEGV_FAULT_ADDRESS                   addr
386 < #define SIGSEGV_ALL_SIGNALS                             FAULT_HANDLER(SIGBUS)
386 > #define SIGSEGV_FAULT_INSTRUCTION               scp->sc_eip
387 > #define SIGSEGV_REGISTER_FILE                   ((unsigned int *)&scp->sc_edi)
388 > #define SIGSEGV_SKIP_INSTRUCTION                ix86_skip_instruction
389   #endif
390   #endif
391  
392 + // Extract fault address out of a sigcontext
393 + #if (defined(alpha) || defined(__alpha__))
394 + // From Boehm's GC 6.0alpha8
395 + static sigsegv_address_t get_fault_address(struct sigcontext *scp)
396 + {
397 +        unsigned int instruction = *((unsigned int *)(scp->sc_pc));
398 +        unsigned long fault_address = scp->sc_regs[(instruction >> 16) & 0x1f];
399 +        fault_address += (signed long)(signed short)(instruction & 0xffff);
400 +        return (sigsegv_address_t)fault_address;
401 + }
402 + #endif
403 +
404 +
405   // MacOS X, not sure which version this works in. Under 10.1
406   // vm_protect does not appear to work from a signal handler. Under
407   // 10.2 signal handlers get siginfo type arguments but the si_addr

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines