Annotation of researchv10no/cmd/sml/src/runtime/VAX.dep.c, revision 1.1

1.1     ! root        1: /* Copyright 1989 by AT&T Bell Laboratories */
        !             2: /* VAX.dep.c
        !             3:  *
        !             4:  *    VAX dependent code for the SML/NJ runtime kernel.
        !             5:  */
        !             6: 
        !             7: #include <signal.h>
        !             8: #include "tags.h"
        !             9: 
        !            10: extern int cause, fault_code;
        !            11: extern int saved_pc;
        !            12: extern int saveregs[];
        !            13: 
        !            14: 
        !            15: int ghandle(sig,code,scp,addr) int sig, code, addr; struct sigcontext *scp;
        !            16: {
        !            17: #ifdef V9
        !            18: #define FPE_INTOVF_TRAP K_INTOVF
        !            19:     saved_pc = addr;  addr = (int)saveregs; 
        !            20: #else
        !            21:     saved_pc = scp->sc_pc; scp->sc_pc = (int)saveregs; 
        !            22: #endif
        !            23: 
        !            24:  if (*(int*)(saved_pc-4) == 0x59585cc1 && code==FPE_INTOVF_TRAP)
        !            25:        {cause=CAUSE_GC;
        !            26:         saved_pc -= 4;    
        !            27:        }
        !            28:  else if ((*(int*)saved_pc & 0xffffff) == 0x5958c0 && code==FPE_INTOVF_TRAP)
        !            29:    {cause=CAUSE_GC;
        !            30: /* the next line is temporary */
        !            31: if ( (*(int*)(saved_pc-8) & 0xffff) == 0x5cc1 && code==FPE_INTOVF_TRAP) saved_pc-=8; else
        !            32:     saved_pc -= 12;
        !            33:    }
        !            34:  else {fault_code=exnCode(sig,code); cause=CAUSE_FAULT;}
        !            35: }
        !            36: 
        !            37: /* This next define is needed by ultrix systems */
        !            38: #ifndef sigmask
        !            39: #define sigmask(X) (1<<((X)-1))
        !            40: #endif
        !            41: 
        !            42: extern int handleprof();
        !            43: 
        !            44: setupsignals()
        !            45: {
        !            46: #ifdef BSD
        !            47:   struct sigvec a;
        !            48:   int (**handlerp)() = (int (**)()) &a.sv_handler;
        !            49:   *handlerp = ghandle;
        !            50:   a.sv_onstack = 0;
        !            51:   a.sv_mask    = 0;
        !            52:   sigvec(SIGINT,&a,0);
        !            53:   sigvec(SIGFPE,&a,0);
        !            54:   a.sv_handler = SIG_IGN;
        !            55:   sigvec(SIGPIPE,&a,0);
        !            56:   a.sv_handler = (int (*)()) handleprof;
        !            57:   sigvec(SIGVTALRM,&a,0);
        !            58: #endif
        !            59: #ifdef V9
        !            60:   signal(SIGINT,ghandle);
        !            61:   signal(SIGFPE,ghandle);
        !            62:   signal(SIGPIPE,SIG_IGN);
        !            63: #endif
        !            64: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.