The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/osfmk/ppc/_setjmp.s

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 7bbc4e8e78984e40da522f34a8f0aedf


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.