1301483Ssephe/*- 2301483Ssephe * Copyright (c) 2016 Microsoft Corp. 3301483Ssephe * All rights reserved. 4301483Ssephe * 5301483Ssephe * Redistribution and use in source and binary forms, with or without 6301483Ssephe * modification, are permitted provided that the following conditions 7301483Ssephe * are met: 8301483Ssephe * 1. Redistributions of source code must retain the above copyright 9301483Ssephe * notice unmodified, this list of conditions, and the following 10301483Ssephe * disclaimer. 11301483Ssephe * 2. Redistributions in binary form must reproduce the above copyright 12301483Ssephe * notice, this list of conditions and the following disclaimer in the 13301483Ssephe * documentation and/or other materials provided with the distribution. 14301483Ssephe * 15301483Ssephe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16301483Ssephe * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17301483Ssephe * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18301483Ssephe * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19301483Ssephe * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20301483Ssephe * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21301483Ssephe * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22301483Ssephe * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23301483Ssephe * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24301483Ssephe * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25301483Ssephe */ 26301483Ssephe 27301483Ssephe#include <sys/cdefs.h> 28301483Ssephe__FBSDID("$FreeBSD: releng/11.0/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c 301483 2016-06-06 05:55:37Z sephe $"); 29301483Ssephe 30301483Ssephe#include <sys/param.h> 31301483Ssephe#include <dev/hyperv/vmbus/hyperv_machdep.h> 32301483Ssephe 33301483Ssepheuint64_t 34301483Ssephehypercall_md(volatile void *hc_addr, uint64_t in_val, 35301483Ssephe uint64_t in_paddr, uint64_t out_paddr) 36301483Ssephe{ 37301483Ssephe uint64_t status; 38301483Ssephe 39301483Ssephe __asm__ __volatile__ ("mov %0, %%r8" : : "r" (out_paddr): "r8"); 40301483Ssephe __asm__ __volatile__ ("call *%3" : "=a" (status) : 41301483Ssephe "c" (in_val), "d" (in_paddr), "m" (hc_addr)); 42301483Ssephe return (status); 43301483Ssephe} 44