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 (the "License").
   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 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * Hypervisor calls called by glvc driver.
  28 */
  29 
  30 #include <sys/asm_linkage.h>
  31 #include <sys/hypervisor_api.h>
  32 #include <sys/glvc.h>
  33 
  34         /*
  35          * hv_service_recv(uint64_t s_id, uint64_t buf_pa,
  36          *     uint64_t size, uint64_t *recv_bytes);
  37          */
  38         ENTRY(hv_service_recv)
  39         save    %sp, -SA(MINFRAME), %sp
  40         mov     %i0, %o0
  41         mov     %i1, %o1
  42         mov     %i2, %o2
  43         mov     %i3, %o3
  44         mov     SVC_RECV, %o5
  45         ta      FAST_TRAP
  46         brnz    %o0, 1f
  47         mov     %o0, %i0
  48         stx     %o1, [%i3]
  49 1:
  50         ret
  51         restore
  52         SET_SIZE(hv_service_recv)
  53 
  54         /*
  55          * hv_service_send(uint64_t s_id, uint64_t buf_pa,
  56          *     uint64_t size, uint64_t *recv_bytes);
  57          */
  58         ENTRY(hv_service_send)
  59         save    %sp, -SA(MINFRAME), %sp
  60         mov     %i0, %o0
  61         mov     %i1, %o1
  62         mov     %i2, %o2
  63         mov     %i3, %o3
  64         mov     SVC_SEND, %o5
  65         ta      FAST_TRAP
  66         brnz    %o0, 1f
  67         mov     %o0, %i0
  68         stx     %o1, [%i3]
  69 1:
  70         ret
  71         restore 
  72         SET_SIZE(hv_service_send)
  73         
  74         /*
  75          * hv_service_getstatus(uint64_t s_id, uint64_t *vreg);
  76          */
  77         ENTRY(hv_service_getstatus)
  78         mov     %o1, %o4                        ! save datap
  79         mov     SVC_GETSTATUS, %o5
  80         ta      FAST_TRAP
  81         brz,a   %o0, 1f
  82         stx     %o1, [%o4]
  83 1:
  84         retl
  85         nop
  86         SET_SIZE(hv_service_getstatus)
  87         
  88         /*
  89          * hv_service_setstatus(uint64_t s_id, uint64_t bits);
  90          */
  91         ENTRY(hv_service_setstatus)
  92         mov     SVC_SETSTATUS, %o5
  93         ta      FAST_TRAP
  94         retl
  95         nop
  96         SET_SIZE(hv_service_setstatus)
  97 
  98         /*
  99          * hv_service_clrstatus(uint64_t s_id, uint64_t bits);
 100          */
 101         ENTRY(hv_service_clrstatus)
 102         mov     SVC_CLRSTATUS, %o5
 103         ta      FAST_TRAP
 104         retl
 105         nop
 106         SET_SIZE(hv_service_clrstatus)
 107