1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #include "assym.h"
  28 
  29 #include <sys/param.h>
  30 #include <sys/asm_linkage.h>
  31 #include <sys/errno.h>
  32 #include <sys/intreg.h>
  33 #include <sys/intr.h>
  34 #include <sys/x_call.h>
  35 #include <sys/privregs.h>
  36 #include <sys/machthread.h>
  37 #include <sys/machtrap.h>
  38 #include <sys/xc_impl.h>
  39 #include <sys/bitmap.h>
  40 
  41 #ifdef TRAPTRACE
  42 #include <sys/traptrace.h>
  43 #endif /* TRAPTRACE */
  44 
  45 
  46 /*
  47  * For a x-trap request to the same processor, just send a fast trap.
  48  * Does not accept inums.
  49  */
  50         ENTRY_NP(send_self_xcall)
  51         ta       ST_SELFXCALL
  52         retl
  53         nop
  54         SET_SIZE(send_self_xcall)
  55 
  56 /*
  57  * idle or stop xcall handler.
  58  *
  59  * Called in response to an xt_some initiated by idle_other_cpus
  60  * and stop_other_cpus.
  61  *
  62  *      Entry:
  63  *              %g1 - handler at TL==0
  64  *
  65  *      Register Usage:
  66  *              %g1 - preserved
  67  *              %g4 - pil
  68  *
  69  * %g1 will either be cpu_idle_self or cpu_stop_self and is
  70  * passed to sys_trap, to run at TL=0. No need to worry about
  71  * the regp passed to cpu_idle_self/cpu_stop_self, since
  72  * neither require arguments.
  73  */
  74         ENTRY_NP(idle_stop_xcall)
  75         rdpr    %pil, %g4
  76         cmp     %g4, XCALL_PIL
  77         ba,pt   %xcc, sys_trap
  78           movl  %xcc, XCALL_PIL, %g4
  79         SET_SIZE(idle_stop_xcall)
  80