Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/runtime/mach-dep/signal-sysdep.h
ViewVC logotype

Diff of /sml/trunk/src/runtime/mach-dep/signal-sysdep.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 12, Sun Jan 18 01:01:29 1998 UTC revision 13, Sun Jan 18 21:36:02 1998 UTC
# Line 11  Line 11 
11   *   typedef SigMask_t          the representation of a set of signals   *   typedef SigMask_t          the representation of a set of signals
12   *   *
13   *   SIG_GetCode(info, scp)     extract the signal generation information   *   SIG_GetCode(info, scp)     extract the signal generation information
14     *   SIG_GetPC(scp)             get the PC from the context
15   *   SIG_SetPC(scp, addr)       set the PC in the context to the address   *   SIG_SetPC(scp, addr)       set the PC in the context to the address
16   *   SIG_SetHandler(sig, h)     set the signal handler   *   SIG_SetHandler(sig, h)     set the signal handler
17   *   SIG_GetHandler(sig, h)     get the current handler into h   *   SIG_GetHandler(sig, h)     get the current handler into h
# Line 157  Line 158 
158  #    define INT_DIVZERO(s, c)   (((s) == SIGFPE) && ((c) == FPE_INTDIV_TRAP))  #    define INT_DIVZERO(s, c)   (((s) == SIGFPE) && ((c) == FPE_INTDIV_TRAP))
159  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_INTOVF_TRAP))  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_INTOVF_TRAP))
160  #    define SIG_GetCode(info, scp)      (info)  #    define SIG_GetCode(info, scp)      (info)
161    #    define SIG_GetPC(scp)      ((scp)->sc_pc)
162  #    define SIG_SetPC(scp, addr)        {                       \  #    define SIG_SetPC(scp, addr)        {                       \
163          (scp)->sc_pc = (long)(addr);                            \          (scp)->sc_pc = (long)(addr);                            \
164          (scp)->sc_npc = (scp)->sc_pc + 4;                       \          (scp)->sc_npc = (scp)->sc_pc + 4;                       \
# Line 174  Line 176 
176    
177  #  elif defined(OPSYS_SOLARIS)  #  elif defined(OPSYS_SOLARIS)
178      /** SPARC, SOLARIS **/      /** SPARC, SOLARIS **/
179    #    define SIG_GetPC(scp)              ((scp)->uc_mcontext.gregs[REG_PC])
180  #    define SIG_SetPC(scp, addr)        {                       \  #    define SIG_SetPC(scp, addr)        {                       \
181          (scp)->uc_mcontext.gregs[REG_PC] = (long)(addr);        \          (scp)->uc_mcontext.gregs[REG_PC] = (long)(addr);        \
182          (scp)->uc_mcontext.gregs[REG_nPC] = (long)(addr) + 4;   \          (scp)->uc_mcontext.gregs[REG_nPC] = (long)(addr) + 4;   \
# Line 181  Line 184 
184  #    define SIG_ZeroLimitPtr(scp)       \  #    define SIG_ZeroLimitPtr(scp)       \
185          { (scp)->uc_mcontext.gregs[REG_G4] = 0; }          { (scp)->uc_mcontext.gregs[REG_G4] = 0; }
186    
 #  elif defined(OPSYS_SUNOS)  
     /** M68, SUNOS **/  
 #    define SIG_FAULT1          SIGFPE  
 #    define INT_DIVZERO(s, c)   (((s) == SIGFPE) && ((c) == FPE_INTDIV_TRAP))  
 #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_TRAPV_TRAP))  
 #    define SIG_GetCode(info, scp)      (info)  
 #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }  
 #    define SIG_SavePC(msp, scp)        {               \  
         SigContext_t    *__scp = (scp);                 \  
         extern Addr_t   SavedPC;                        \  
         SavedPC = __scp->sc_pc;                         \  
     }  
      typedef void SigReturn_t;  
   
187  #  endif  #  endif
188    
189  #elif defined(HOST_MIPS)  #elif defined(HOST_MIPS)
# Line 210  Line 199 
199  #    define INT_DIVZERO(s, c)   (((s) == SIGTRAP) && ((c) == BRK_DIVZERO))  #    define INT_DIVZERO(s, c)   (((s) == SIGTRAP) && ((c) == BRK_DIVZERO))
200  #    define INT_OVFLW(s, c)     (((s) == SIGTRAP) && ((c) == BRK_OVERFLOW))  #    define INT_OVFLW(s, c)     (((s) == SIGTRAP) && ((c) == BRK_OVERFLOW))
201  #    define SIG_GetCode(info, scp)      ((info) ? (info) : (scp)->sc_fpc_csr)  #    define SIG_GetCode(info, scp)      ((info) ? (info) : (scp)->sc_fpc_csr)
202    #    define SIG_GetPC(scp)              ((scp)->sc_pc)
203  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }
204  #    define SIG_ZeroLimitPtr(scp)       { (scp)->sc_regs[19] = 0; }  #    define SIG_ZeroLimitPtr(scp)       { (scp)->sc_regs[19] = 0; }
205       typedef void SigReturn_t;       typedef void SigReturn_t;
# Line 224  Line 214 
214  #    define INT_DIVZERO(s, c)   \  #    define INT_DIVZERO(s, c)   \
215          (((s) == SIGTRAP) || (((s) == SIGFPE) && ((c) == FPE_INTDIV)))          (((s) == SIGTRAP) || (((s) == SIGFPE) && ((c) == FPE_INTDIV)))
216    
217    #    define SIG_GetPC(scp)              ((scp)->uc_mcontext.gregs[CTX_EPC])
218  #    define SIG_SetPC(scp, addr)        \  #    define SIG_SetPC(scp, addr)        \
219          { (scp)->uc_mcontext.gregs[CTX_EPC] = (long)(addr); }          { (scp)->uc_mcontext.gregs[CTX_EPC] = (long)(addr); }
220  #    define SIG_ZeroLimitPtr(scp)       \  #    define SIG_ZeroLimitPtr(scp)       \
# Line 239  Line 230 
230  #    define INT_DIVZERO(s, c)   (((s) == SIGTRAP) && ((c) & FP_DIV_BY_ZERO))  #    define INT_DIVZERO(s, c)   (((s) == SIGTRAP) && ((c) & FP_DIV_BY_ZERO))
231  #    define INT_OVFLW(s, c)     (((s) == SIGTRAP) && ((c) == 0))  #    define INT_OVFLW(s, c)     (((s) == SIGTRAP) && ((c) == 0))
232       PVT int SIG_GetCode (SigInfo_t info, SigContext_t *scp);       PVT int SIG_GetCode (SigInfo_t info, SigContext_t *scp);
233    #    define SIG_GetPC(scp)      ((scp)->sc_jmpbuf.jmp_context.iar)
234  #    define SIG_SetPC(scp, addr)        \  #    define SIG_SetPC(scp, addr)        \
235          { (scp)->sc_jmpbuf.jmp_context.iar = (long)(addr); }          { (scp)->sc_jmpbuf.jmp_context.iar = (long)(addr); }
236  #    define SIG_ZeroLimitPtr(scp)       \  #    define SIG_ZeroLimitPtr(scp)       \
# Line 263  Line 255 
255    
256  #    define INT_DIVZERO(s, c)           (((s) == SIGILL) && ((c) == 0x84000000))  #    define INT_DIVZERO(s, c)           (((s) == SIGILL) && ((c) == 0x84000000))
257  #    define INT_OVFLW(s, c)             (((s) == SIGILL) && ((c) == 0x0))  #    define INT_OVFLW(s, c)             (((s) == SIGILL) && ((c) == 0x0))
258    #    define SIG_GetPC(scp)              ((scp)->nip)
259  #    define SIG_SetPC(scp, addr)        { (scp)->nip = (long)(addr); }  #    define SIG_SetPC(scp, addr)        { (scp)->nip = (long)(addr); }
260  #    define SIG_ZeroLimitPtr(scp)       { ((scp)->gpr[15] = 0); }  #    define SIG_ZeroLimitPtr(scp)       { ((scp)->gpr[15] = 0); }
261  #    define SIG_GetCode(info,scp)       ((scp)->fpscr)  #    define SIG_GetCode(info,scp)       ((scp)->fpscr)
# Line 279  Line 272 
272      /** HPPA, HPUX 9.x **/      /** HPPA, HPUX 9.x **/
273       typedef void SigReturn_t;       typedef void SigReturn_t;
274  #    define SIG_FAULT1 SIGFPE  #    define SIG_FAULT1 SIGFPE
275        /* Since exceptions can be raised both in data space and code space,
276         * implementing this on HPPA/HPUX is going to be complicated.
277         */
278    #    define SIG_GetPC(scp)      0
279      /* pcoq and pcsq are equivalent to the instruction address      /* pcoq and pcsq are equivalent to the instruction address
280       * offset queue (iaoq) and the IA space queue (iasq)       * offset queue (iaoq) and the IA space queue (iasq)
281       */       */
# Line 313  Line 310 
310  #    define sc_gr3 sc_sl.sl_ss.ss_narrow.ss_gr3  #    define sc_gr3 sc_sl.sl_ss.ss_narrow.ss_gr3
311  #    define sc_gr4 sc_sl.sl_ss.ss_narrow.ss_gr4  #    define sc_gr4 sc_sl.sl_ss.ss_narrow.ss_gr4
312    
313        /* Since exceptions can be raised both in data space and code space,
314         * implementing this on HPPA/HPUX is going to be complicated.
315         */
316    #    define SIG_GetPC(scp)      0
317      /*  pcoq and pcsq are equivalent to the instruction address      /*  pcoq and pcsq are equivalent to the instruction address
318       * offset queue (iaoq) and the IA space queue (iasq)       * offset queue (iaoq) and the IA space queue (iasq)
319       */       */
# Line 347  Line 348 
348    
349  #  if defined(OPSYS_LINUX)  #  if defined(OPSYS_LINUX)
350      /** X86, LINUX **/      /** X86, LINUX **/
351  #    ifndef sigcontext_struct  #    ifndef _SIGCONTEXT_H
352  #      define sigcontext_struct sigcontext        /* older versions of Linux don't define this in <signal.h> */
353  #    endif          struct sigcontext {
354  #    include <asm/sigcontext.h>              unsigned short gs, __gsh;
355                unsigned short fs, __fsh;
356                unsigned short es, __esh;
357                unsigned short ds, __dsh;
358                unsigned long edi;
359                unsigned long esi;
360                unsigned long ebp;
361                unsigned long esp;
362                unsigned long ebx;
363                unsigned long edx;
364                unsigned long ecx;
365                unsigned long eax;
366                unsigned long trapno;
367                unsigned long err;
368                unsigned long eip;
369                unsigned short cs, __csh;
370                unsigned long eflags;
371                unsigned long esp_at_signal;
372                unsigned short ss, __ssh;
373                unsigned long i387;
374                unsigned long oldmask;
375                unsigned long cr2;
376            };
377    #    endif /* !_SIGCONTEXT_H */
378    
379  #define INTO_OPCODE             0xce    /* the 'into' instruction is a single */  #define INTO_OPCODE             0xce    /* the 'into' instruction is a single */
380                                          /* instruction that signals Overflow */                                          /* instruction that signals Overflow */
# Line 364  Line 388 
388    
389  #    define SIG_GetCode(info,scp)  ((scp)->eip)  #    define SIG_GetCode(info,scp)  ((scp)->eip)
390  /* for linux, SIG_GetCode simply returns the address of the fault */  /* for linux, SIG_GetCode simply returns the address of the fault */
391    #    define SIG_GetPC(scp)              ((scp)->eip)
392  #    define SIG_SetPC(scp,addr)    { (scp)->eip = (long)(addr); }  #    define SIG_SetPC(scp,addr)    { (scp)->eip = (long)(addr); }
393  #    define SIG_ZeroLimitPtr(scp) { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }  #    define SIG_ZeroLimitPtr(scp) { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }
394       typedef void SigReturn_t;       typedef void SigReturn_t;
# Line 375  Line 400 
400  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_INTOVF_TRAP))  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_INTOVF_TRAP))
401    
402  #    define SIG_GetCode(info, scp)      (info)  #    define SIG_GetCode(info, scp)      (info)
403    #    define SIG_GetPC(scp)              ((scp)->sc_pc)
404  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }
405  #    define SIG_ZeroLimitPtr(scp)       { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }  #    define SIG_ZeroLimitPtr(scp)       { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }
406    
# Line 405  Line 431 
431  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) || ((s) == SIGBUS))  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) || ((s) == SIGBUS))
432    
433  #    define SIG_GetCode(info, scp)      (info)  #    define SIG_GetCode(info, scp)      (info)
434    #    define SIG_GetPC(scp)              ((scp)->sc_pc)
435  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }
436  #    define SIG_ZeroLimitPtr(scp)       { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }  #    define SIG_ZeroLimitPtr(scp)       { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }
437    
# Line 413  Line 440 
440  #  elif defined(OPSYS_SOLARIS)  #  elif defined(OPSYS_SOLARIS)
441       /** x86, Solaris */       /** x86, Solaris */
442    
443    #    define SIG_GetPC(scp)              ((scp)->uc_mcontext.gregs[EIP])
444  #    define SIG_SetPC(scp, addr)        { (scp)->uc_mcontext.gregs[EIP] = (int)(addr); }  #    define SIG_SetPC(scp, addr)        { (scp)->uc_mcontext.gregs[EIP] = (int)(addr); }
445  #    define SIG_ZeroLimitPtr(scp)       { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }  #    define SIG_ZeroLimitPtr(scp)       { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }
446    
# Line 431  Line 459 
459  #    define SIG_FAULT1          SIGFPE  #    define SIG_FAULT1          SIGFPE
460  #    define INT_DIVZERO(s, c)   (((s) == SIGFPE) && ((c) == -2))  #    define INT_DIVZERO(s, c)   (((s) == SIGFPE) && ((c) == -2))
461  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_INTOVF_FAULT))  #    define INT_OVFLW(s, c)     (((s) == SIGFPE) && ((c) == FPE_INTOVF_FAULT))
462    #    define SIG_GetPC(scp)              ((scp)->sc_pc)
463  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }  #    define SIG_SetPC(scp, addr)        { (scp)->sc_pc = (long)(addr); }
464  #    define SIG_GetCode(info, scp)      info  #    define SIG_GetCode(info, scp)      info
465  #    define SIG_ZeroLimitPtr(scp)       { (scp)->sc_regs[9] = 0; }  #    define SIG_ZeroLimitPtr(scp)       { (scp)->sc_regs[9] = 0; }

Legend:
Removed from v.12  
changed lines
  Added in v.13

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0