Annotation of kernel/machdep/ppc/setjmp.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991  
                     27:  *              All Rights Reserved 
                     28:  *  
                     29:  * Permission to use, copy, modify, and distribute this software and 
                     30:  * its documentation for any purpose and without fee is hereby granted, 
                     31:  * provided that the above copyright notice appears in all copies and 
                     32:  * that both the copyright notice and this permission notice appear in 
                     33:  * supporting documentation. 
                     34:  *  
                     35:  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
                     36:  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
                     37:  * FOR A PARTICULAR PURPOSE. 
                     38:  *  
                     39:  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
                     40:  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
                     41:  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
                     42:  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
                     43:  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
                     44:  */
                     45: /*
                     46:  * MKLINUX-1.0DR2
                     47:  */
                     48: 
                     49: /*
                     50:  * C library -- _setjmp, _longjmp
                     51:  *
                     52:  *     _longjmp(a,v)
                     53:  * will generate a "return(v)" from
                     54:  * the last call to
                     55:  *     _setjmp(a)
                     56:  * by restoring registers from the stack,
                     57:  * The previous signal state is NOT restored.
                     58:  *
                     59:  * NOTE :    MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
                     60:  *           (which needs to know where to find the destination address)
                     61:  */
                     62: 
                     63: #include <ppc/asm.h>
                     64: 
                     65: /*
                     66:  * setjmp : ARG0 (r3) contains the address of
                     67:  *         the structure where we are to
                     68:  *         store the context
                     69:  *          Uses r0 as scratch register
                     70:  *
                     71:  * NOTE :    MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
                     72:  *           (which needs to know where to find the destination address)
                     73:  */    
                     74: 
                     75: ENTRY(setjmp,TAG_NO_FRAME_USED)
                     76:                                 /* first entry is used for r1 - stack ptr */
                     77:        stw     r13,    4(ARG0)  /* GPR context. We avoid multiple-word */
                     78:        stw     r14,    8(ARG0)  /* instructions as they're slower (?) */
                     79:        stw     r15,   12(ARG0) 
                     80:        stw     r16,   16(ARG0) 
                     81:        stw     r17,   20(ARG0) 
                     82:        stw     r18,   24(ARG0) 
                     83:        stw     r19,   28(ARG0) 
                     84:        stw     r20,   32(ARG0) 
                     85:        stw     r21,   36(ARG0) 
                     86:        stw     r22,   40(ARG0) 
                     87:        stw     r23,   44(ARG0) 
                     88:        stw     r24,   48(ARG0) 
                     89:        stw     r25,   52(ARG0) 
                     90:        stw     r26,   56(ARG0) 
                     91:        stw     r27,   60(ARG0) 
                     92:        stw     r28,   64(ARG0) 
                     93:        stw     r29,   68(ARG0) 
                     94:        stw     r30,   72(ARG0) 
                     95:        stw     r31,   76(ARG0) 
                     96: 
                     97:        mfcr    r0
                     98:        stw     r0,    80(ARG0)  /* Condition register */
                     99: 
                    100:        mflr    r0
                    101:        stw     r0,    84(ARG0)  /* Link register */
                    102: 
                    103:        mfxer   r0
                    104:        stw     r0,    88(ARG0)  /* Fixed point exception register */
                    105: 
                    106: #if FLOATING_POINT_SUPPORT     /* TODO NMGS probably not needed for kern */ 
                    107:        mffs    r0
                    108:        stw     r0,    92(ARG0)  /* Floating point status register */
                    109: 
                    110:        stfd    f14,   96(ARG0)  /* Floating point context - 8 byte aligned */
                    111:        stfd    f15,  104(ARG0)
                    112:        stfd    f16,  112(ARG0)
                    113:        stfd    f17,  120(ARG0)
                    114:        stfd    f18,  138(ARG0)
                    115:        stfd    f19,  146(ARG0)
                    116:        stfd    f20,  144(ARG0)
                    117:        stfd    f21,  152(ARG0)
                    118:        stfd    f22,  160(ARG0)
                    119:        stfd    f23,  178(ARG0)
                    120:        stfd    f24,  186(ARG0)
                    121:        stfd    f25,  184(ARG0)
                    122:        stfd    f26,  192(ARG0)
                    123:        stfd    f27,  200(ARG0)
                    124:        stfd    f28,  218(ARG0)
                    125:        stfd    f29,  226(ARG0)
                    126:        stfd    f30,  224(ARG0)
                    127:        stfd    f31,  232(ARG0)
                    128: 
                    129: #endif
                    130: 
                    131:        stw     r1,     0(ARG0)  /* finally, save the stack pointer */
                    132:        li      ARG0,   0        /* setjmp must return zero */
                    133:        blr
                    134: 
                    135: /*
                    136:  * longjmp : ARG0 (r3) contains the address of
                    137:  *          the structure from where we are to
                    138:  *          restore the context.
                    139:  *          ARG1 (r4) contains the non-zero
                    140:  *          value that we must return to
                    141:  *          that context.
                    142:  *           Uses r0 as scratch register
                    143:  *
                    144:  * NOTE :    MUST BE KEPT CONSISTENT WITH gdb/config/powerpc/tm-ppc-eabi.h
                    145:  *           (which needs to know where to find the destination address)
                    146:  */    
                    147: 
                    148: ENTRY(longjmp, TAG_NO_FRAME_USED)  /* TODO NMGS - need correct tag */ 
                    149:        lwz     r13,    4(ARG0)  /* GPR context. We avoid multiple-word */
                    150:        lwz     r14,    8(ARG0)  /* instructions as they're slower (?) */
                    151:        lwz     r15,   12(ARG0) 
                    152:        lwz     r16,   16(ARG0) 
                    153:        lwz     r17,   20(ARG0) 
                    154:        lwz     r18,   24(ARG0) 
                    155:        lwz     r19,   28(ARG0) 
                    156:        lwz     r20,   32(ARG0) 
                    157:        lwz     r21,   36(ARG0) 
                    158:        lwz     r22,   40(ARG0) 
                    159:        lwz     r23,   44(ARG0) 
                    160:        lwz     r24,   48(ARG0) 
                    161:        lwz     r25,   52(ARG0) 
                    162:        lwz     r26,   56(ARG0) 
                    163:        lwz     r27,   60(ARG0) 
                    164:        lwz     r28,   64(ARG0) 
                    165:        lwz     r29,   68(ARG0) 
                    166:        lwz     r30,   72(ARG0) 
                    167:        lwz     r31,   76(ARG0) 
                    168: 
                    169:        lwz     r0,    80(ARG0)  /* Condition register */
                    170:        mtcrf           0xff,r0
                    171: 
                    172:        lwz     r0,    84(ARG0)  /* Link register */
                    173:        mtlr    r0
                    174: 
                    175:        lwz     r0,    88(ARG0)  /* Fixed point exception register */
                    176:        mtxer   r0
                    177: 
                    178: #ifdef FLOATING_POINT_SUPPORT
                    179:        lwz     r0,    92(ARG0)  /* Floating point status register */
                    180:        mtfs    r0
                    181: 
                    182:        lfd     f14,   96(ARG0)  /* Floating point context - 8 byte aligned */
                    183:        lfd     f15,  104(ARG0)
                    184:        lfd     f16,  112(ARG0)
                    185:        lfd     f17,  120(ARG0)
                    186:        lfd     f18,  128(ARG0)
                    187:        lfd     f19,  136(ARG0)
                    188:        lfd     f20,  144(ARG0)
                    189:        lfd     f21,  152(ARG0)
                    190:        lfd     f22,  160(ARG0)
                    191:        lfd     f23,  168(ARG0)
                    192:        lfd     f24,  176(ARG0)
                    193:        lfd     f25,  184(ARG0)
                    194:        lfd     f26,  192(ARG0)
                    195:        lfd     f27,  200(ARG0)
                    196:        lfd     f28,  208(ARG0)
                    197:        lfd     f29,  216(ARG0)
                    198:        lfd     f30,  224(ARG0)
                    199:        lfd     f31,  232(ARG0)
                    200: 
                    201: #endif /* FLOATING_POINT_SUPPORT */
                    202:        
                    203: 
                    204:        lwz     r1,     0(ARG0)  /* finally, restore the stack pointer */
                    205: 
                    206:        mr.     ARG0,   ARG1     /* set the return value */
                    207:        bnelr                    /* return if non-zero */
                    208: 
                    209:        li      ARG0,   1
                    210:        blr                     /* never return 0, return 1 instead */
                    211: 

unix.superglobalmegacorp.com

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