Annotation of 43BSDTahoe/lib/libc/gen/gen.vax/setjmp.s, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that this notice is preserved and that due credit is given
        !             7:  * to the University of California at Berkeley. The name of the University
        !             8:  * may not be used to endorse or promote products derived from this
        !             9:  * software without specific written prior permission. This software
        !            10:  * is provided ``as is'' without express or implied warranty.
        !            11:  */
        !            12: 
        !            13: #if defined(SYSLIBC_SCCS) && !defined(lint)
        !            14: _sccsid:.asciz "@(#)setjmp.s   5.7 (Berkeley) 5/25/88"
        !            15: #endif /* SYSLIBC_SCCS and not lint */
        !            16: 
        !            17: /*
        !            18:  * C library -- setjmp, longjmp
        !            19:  *
        !            20:  *     longjmp(a,v)
        !            21:  * will generate a "return(v)" from
        !            22:  * the last call to
        !            23:  *     setjmp(a)
        !            24:  * by restoring registers from the stack,
        !            25:  * and a struct sigcontext, see <signal.h>
        !            26:  */
        !            27: 
        !            28: #include "DEFS.h"
        !            29: 
        !            30: ENTRY(setjmp, R6)
        !            31:        movl    4(ap),r6                # construct sigcontext
        !            32:        subl2   $8,sp                   # space for current struct sigstack
        !            33:        pushl   sp                      # get current values
        !            34:        pushl   $0                      # no new values
        !            35:        calls   $3,_sigstack            # pop args plus signal stack value
        !            36:        movl    (sp)+,(r6)+             # save onsigstack status of caller
        !            37:        pushl   $0
        !            38:        calls   $1,_sigblock            # get signal mask
        !            39:        movl    r0,(r6)+                # save signal mask of caller
        !            40:        movl    (ap),r0
        !            41:        moval   4(ap)[r0],(r6)+         # save sp of caller
        !            42:        movl    12(fp),(r6)+            # save frame pointer of caller
        !            43:        movl    8(fp),(r6)+             # save argument pointer of caller
        !            44:        movl    16(fp),(r6)+            # save pc of caller
        !            45:        movpsl  (r6)                    # save psl of caller
        !            46:        movw    4(fp),(r6)
        !            47:        clrl    r0
        !            48:        ret
        !            49: 
        !            50: ENTRY(longjmp, 0)
        !            51:        movl    8(ap),r0                # return(v)
        !            52:        movl    4(ap),r1                # fetch buffer
        !            53:        tstl    12(r1)
        !            54:        beql    botch
        !            55: loop:
        !            56:        cmpl    12(r1),fp               # are we there yet?
        !            57:        beql    done
        !            58:        blssu   botch
        !            59:        moval   20(fp),r2
        !            60:        blbc    6(fp),1f                # was r0 saved?
        !            61:        movl    r0,(r2)+
        !            62: 1:
        !            63:        bbc     $1,6(fp),2f             # was r1 saved?
        !            64:        movl    r1,(r2)
        !            65: 2:
        !            66:        movl    $loop,16(fp)
        !            67:        ret                             # pop another frame
        !            68: 
        !            69: done:
        !            70:        pushl   r1                      # pointer to sigcontext
        !            71:        calls   $1,_sigreturn           # restore previous context
        !            72:                                        # we should never return
        !            73: botch:
        !            74:        calls   $0,_longjmperror
        !            75:        halt

unix.superglobalmegacorp.com

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