iPXE
hyperv.h
Go to the documentation of this file.
1#ifndef _BITS_HYPERV_H
2#define _BITS_HYPERV_H
3
4/** @file
5 *
6 * Hyper-V interface
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12#include <stddef.h>
13#include <stdint.h>
14#include <ipxe/io.h>
15
16/**
17 * Issue hypercall
18 *
19 * @v hv Hyper-V hypervisor
20 * @v code Call code
21 * @v in Input parameters
22 * @v out Output parameters
23 * @ret status Status code
24 */
25static inline __attribute__ (( always_inline )) int
26hv_call ( struct hv_hypervisor *hv, unsigned int code, const void *in,
27 void *out ) {
28 void *hypercall = hv->hypercall;
34
35 in_phys = ( ( __builtin_constant_p ( in ) && ( in == NULL ) )
36 ? 0 : virt_to_phys ( in ) );
37 out_phys = ( ( __builtin_constant_p ( out ) && ( out == NULL ) )
38 ? 0 : virt_to_phys ( out ) );
39 __asm__ __volatile__ ( "call *%9"
40 : "=a" ( result ), "=c" ( discard_ecx ),
41 "=d" ( discard_edx )
42 : "d" ( 0 ), "a" ( code ),
43 "b" ( 0 ), "c" ( in_phys ),
44 "D" ( 0 ), "S" ( out_phys ),
45 "m" ( hypercall ) );
46 return result;
47}
48
49#endif /* _BITS_HYPERV_H */
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
__be32 in[4]
Definition CIB_PRM.h:7
__be32 out[4]
Definition CIB_PRM.h:8
uint32_t discard_edx
Definition hyperv.h:32
uint32_t out_phys
Definition hyperv.h:30
static unsigned int code
Response code.
Definition hyperv.h:26
uint32_t discard_ecx
Definition hyperv.h:31
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
uint32_t in_phys
Definition hyperv.h:29
uint16_t result
Definition hyperv.h:33
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
static unsigned int hypercall
Definition xen.h:43
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define __attribute__(x)
Definition compiler.h:10
iPXE I/O API
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
A Hyper-V hypervisor.
Definition hyperv.h:203
void * hypercall
Hypercall page.
Definition hyperv.h:205