Print this page
5042 stop using deprecated atomic functions


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 #include <sys/cpuvar.h>
  29 #include <sys/kdi_impl.h>
  30 #include <sys/reboot.h>
  31 #include <sys/errno.h>
  32 #include <sys/atomic.h>
  33 #include <sys/kmem.h>
  34 
  35 kdi_debugvec_t  *kdi_dvec;
  36 struct modctl   *kdi_dmods;
  37 
  38 static kdi_dtrace_state_t kdi_dtrace_state = KDI_DTSTATE_IDLE;
  39 
  40 void
  41 kdi_dvec_vmready(void)
  42 {
  43         kdi_dvec->dv_kctl_vmready();
  44         kdi_dvec->dv_vmready();
  45 }
  46 
  47 void


 134                                 return (0);
 135                         new = KDI_DTSTATE_IDLE;
 136                         break;
 137                 case KDI_DTSET_KMDB_BPT_ACTIVATE:
 138                         if (cur == KDI_DTSTATE_DTRACE_ACTIVE)
 139                                 return (EBUSY);
 140                         if (cur == KDI_DTSTATE_KMDB_BPT_ACTIVE)
 141                                 return (0);
 142                         new = KDI_DTSTATE_KMDB_BPT_ACTIVE;
 143                         break;
 144                 case KDI_DTSET_KMDB_BPT_DEACTIVATE:
 145                         if (cur == KDI_DTSTATE_DTRACE_ACTIVE)
 146                                 return (EBUSY);
 147                         if (cur == KDI_DTSTATE_IDLE)
 148                                 return (0);
 149                         new = KDI_DTSTATE_IDLE;
 150                         break;
 151                 default:
 152                         return (EINVAL);
 153                 }
 154         } while (cas32((uint_t *)&kdi_dtrace_state, cur, new) != cur);
 155 
 156         return (0);
 157 }


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 


  26 #include <sys/cpuvar.h>
  27 #include <sys/kdi_impl.h>
  28 #include <sys/reboot.h>
  29 #include <sys/errno.h>
  30 #include <sys/atomic.h>
  31 #include <sys/kmem.h>
  32 
  33 kdi_debugvec_t  *kdi_dvec;
  34 struct modctl   *kdi_dmods;
  35 
  36 static kdi_dtrace_state_t kdi_dtrace_state = KDI_DTSTATE_IDLE;
  37 
  38 void
  39 kdi_dvec_vmready(void)
  40 {
  41         kdi_dvec->dv_kctl_vmready();
  42         kdi_dvec->dv_vmready();
  43 }
  44 
  45 void


 132                                 return (0);
 133                         new = KDI_DTSTATE_IDLE;
 134                         break;
 135                 case KDI_DTSET_KMDB_BPT_ACTIVATE:
 136                         if (cur == KDI_DTSTATE_DTRACE_ACTIVE)
 137                                 return (EBUSY);
 138                         if (cur == KDI_DTSTATE_KMDB_BPT_ACTIVE)
 139                                 return (0);
 140                         new = KDI_DTSTATE_KMDB_BPT_ACTIVE;
 141                         break;
 142                 case KDI_DTSET_KMDB_BPT_DEACTIVATE:
 143                         if (cur == KDI_DTSTATE_DTRACE_ACTIVE)
 144                                 return (EBUSY);
 145                         if (cur == KDI_DTSTATE_IDLE)
 146                                 return (0);
 147                         new = KDI_DTSTATE_IDLE;
 148                         break;
 149                 default:
 150                         return (EINVAL);
 151                 }
 152         } while (atomic_cas_32((uint_t *)&kdi_dtrace_state, cur, new) != cur);
 153 
 154         return (0);
 155 }