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 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 #if defined(lint)
  30 #include <sys/types.h>
  31 #include <sys/cpuvar.h>
  32 #else   /*lint */
  33 #include "assym.h"
  34 #endif  /* lint */
  35 
  36 #include <sys/param.h>
  37 #include <sys/asm_linkage.h>
  38 #include <sys/errno.h>
  39 #include <sys/intreg.h>
  40 #include <sys/intr.h>
  41 #include <sys/x_call.h>
  42 #include <sys/privregs.h>
  43 #include <sys/machthread.h>
  44 #include <sys/machtrap.h>
  45 #include <sys/xc_impl.h>
  46 #include <sys/bitmap.h>
  47 
  48 #ifdef TRAPTRACE
  49 #include <sys/traptrace.h>
  50 #endif /* TRAPTRACE */
  51 
  52 
  53 #if defined(lint)
  54 
  55 /* ARGSUSED */
  56 void
  57 send_self_xcall(struct cpu *cpu, uint64_t arg1, uint64_t arg2, xcfunc_t *func)
  58 {}
  59 
  60 #else
  61 /*
  62  * For a x-trap request to the same processor, just send a fast trap.
  63  * Does not accept inums.
  64  */
  65         ENTRY_NP(send_self_xcall)
  66         ta       ST_SELFXCALL
  67         retl
  68         nop
  69         SET_SIZE(send_self_xcall)
  70 #endif  /* lint */
  71 
  72 #if defined(lint)
  73 void
  74 idle_stop_xcall(void)
  75 {}
  76 #else
  77 /*
  78  * idle or stop xcall handler.
  79  *
  80  * Called in response to an xt_some initiated by idle_other_cpus
  81  * and stop_other_cpus.
  82  *
  83  *      Entry:
  84  *              %g1 - handler at TL==0
  85  *
  86  *      Register Usage:
  87  *              %g1 - preserved
  88  *              %g4 - pil
  89  *
  90  * %g1 will either be cpu_idle_self or cpu_stop_self and is
  91  * passed to sys_trap, to run at TL=0. No need to worry about
  92  * the regp passed to cpu_idle_self/cpu_stop_self, since
  93  * neither require arguments.
  94  */
  95         ENTRY_NP(idle_stop_xcall)
  96         rdpr    %pil, %g4
  97         cmp     %g4, XCALL_PIL
  98         ba,pt   %xcc, sys_trap
  99           movl  %xcc, XCALL_PIL, %g4
 100         SET_SIZE(idle_stop_xcall)
 101 
 102 #endif  /* lint */
 103