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

1.1     ! root        1: /* Copyright 1989 by AT&T Bell Laboratories */
        !             2: /* M68.dep.c
        !             3:  *
        !             4:  *    M68 dependent code for the SML/NJ runtime kernel.
        !             5:  */
        !             6: 
        !             7: #include <signal.h>
        !             8: #include "tags.h"
        !             9: 
        !            10: #if defined(NeXT) && (! defined(FPE_TRAPV_TRAP))
        !            11: /* This is required because NeXT 1.0 nuked this definition */
        !            12: #define     FPE_TRAPV_TRAP      0x1c    /* TRAPV [cpTRAPcc TRAPcc] instr */
        !            13: #endif
        !            14: 
        !            15: extern int cause, fault_code;
        !            16: extern int saved_pc;
        !            17: extern int saveregs[];
        !            18: 
        !            19: 
        !            20: /* ghandle:
        !            21:  */
        !            22: ghandle (sig, code, scp, addr)
        !            23:     int                        sig, code, addr;
        !            24:     struct sigcontext  *scp;
        !            25: {
        !            26:     saved_pc = scp->sc_pc;
        !            27:     scp->sc_pc = (int)saveregs; 
        !            28: 
        !            29: /* Note: versions of sony_news before Sept 1989 had pc pointer BEFORE
        !            30:    trap instruction, not after. */
        !            31:     if (sig==SIGFPE && code==FPE_TRAPV_TRAP && ((short*)saved_pc)[-1] == 23548)
        !            32:     {   saved_pc-=4;
        !            33:        cause=CAUSE_GC;
        !            34:     }
        !            35:     else {
        !            36:        fault_code=exnCode(sig,code);
        !            37:        cause=CAUSE_FAULT;
        !            38:     }
        !            39: }
        !            40: 
        !            41: 
        !            42: extern int handleprof();
        !            43: 
        !            44: void setupsignals()
        !            45: {
        !            46:   struct sigvec a;
        !            47:   extern fpenable();
        !            48: 
        !            49:   a.sv_handler = (void (*)()) ghandle;
        !            50:   a.sv_onstack = 0;
        !            51:   a.sv_mask    = 0;
        !            52:   sigvec(SIGINT,&a,0);
        !            53:   sigvec(SIGFPE,&a,0);
        !            54:   sigvec(SIGEMT,&a,0);  /* in case 68881 is not present */
        !            55:   a.sv_handler = SIG_IGN;
        !            56:   sigvec(SIGPIPE,&a,0);
        !            57:   a.sv_handler = (void (*)()) handleprof;
        !            58:   sigvec(SIGVTALRM,&a,0);
        !            59:   fpenable();
        !            60: }

unix.superglobalmegacorp.com

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