Annotation of 43BSDReno/lib/libc/vax/gen/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: (1) source distributions retain this entire copyright
        !             7:  * notice and comment, and (2) distributions including binaries display
        !             8:  * the following acknowledgement:  ``This product includes software
        !             9:  * developed by the University of California, Berkeley and its contributors''
        !            10:  * in the documentation or other materials provided with the distribution
        !            11:  * and in all advertising materials mentioning features or use of this
        !            12:  * software. Neither the name of the University nor the names of its
        !            13:  * contributors may be used to endorse or promote products derived
        !            14:  * from this software without specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #if defined(LIBC_SCCS) && !defined(lint)
        !            21:        .asciz "@(#)setjmp.s    5.9 (Berkeley) 6/1/90"
        !            22: #endif /* LIBC_SCCS and not lint */
        !            23: 
        !            24: /*
        !            25:  * C library -- setjmp, longjmp
        !            26:  *
        !            27:  *     longjmp(a,v)
        !            28:  * will generate a "return(v)" from
        !            29:  * the last call to
        !            30:  *     setjmp(a)
        !            31:  * by restoring registers from the stack,
        !            32:  * and a struct sigcontext, see <signal.h>
        !            33:  */
        !            34: 
        !            35: #include "DEFS.h"
        !            36: 
        !            37: ENTRY(setjmp, R6)
        !            38:        movl    4(ap),r6                # construct sigcontext
        !            39:        subl2   $8,sp                   # space for current struct sigstack
        !            40:        pushl   sp                      # get current values
        !            41:        pushl   $0                      # no new values
        !            42:        calls   $3,_sigstack            # pop args plus signal stack value
        !            43:        movl    (sp)+,(r6)+             # save onsigstack status of caller
        !            44:        pushl   $0
        !            45:        calls   $1,_sigblock            # get signal mask
        !            46:        movl    r0,(r6)+                # save signal mask of caller
        !            47:        movl    (ap),r0
        !            48:        moval   4(ap)[r0],(r6)+         # save sp of caller
        !            49:        movl    12(fp),(r6)+            # save frame pointer of caller
        !            50:        movl    8(fp),(r6)+             # save argument pointer of caller
        !            51:        movl    16(fp),(r6)+            # save pc of caller
        !            52:        movpsl  (r6)                    # save psl of caller
        !            53:        movw    4(fp),(r6)
        !            54:        clrl    r0
        !            55:        ret
        !            56: 
        !            57: ENTRY(longjmp, 0)
        !            58:        movl    8(ap),r0                # return(v)
        !            59:        movl    4(ap),r1                # fetch buffer
        !            60:        tstl    12(r1)
        !            61:        beql    botch
        !            62: loop:
        !            63:        cmpl    12(r1),fp               # are we there yet?
        !            64:        beql    done
        !            65:        blssu   botch
        !            66:        moval   20(fp),r2
        !            67:        blbc    6(fp),1f                # was r0 saved?
        !            68:        movl    r0,(r2)+
        !            69: 1:
        !            70:        bbc     $1,6(fp),2f             # was r1 saved?
        !            71:        movl    r1,(r2)
        !            72: 2:
        !            73:        movl    $loop,16(fp)
        !            74:        ret                             # pop another frame
        !            75: 
        !            76: done:
        !            77:        pushl   r1                      # pointer to sigcontext
        !            78:        calls   $1,_sigreturn           # restore previous context
        !            79:                                        # we should never return
        !            80: botch:
        !            81:        calls   $0,_longjmperror
        !            82:        halt

unix.superglobalmegacorp.com

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