platform.h
Go to the documentation of this file.
1 /*
2  * Bareflank Hypervisor
3  *
4  * Copyright (C) 2015 Assured Information Security, Inc.
5  * Author: Rian Quinn <quinnr@ainfosec.com>
6  * Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef PLATFORM_H
24 #define PLATFORM_H
25 
26 #include <types.h>
27 #include <vmcall_interface.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
41 void *platform_alloc_rw(uint64_t len);
42 
51 void *platform_alloc_rwe(uint64_t len);
52 
62 void platform_free_rw(void *addr, uint64_t len);
63 
73 void platform_free_rwe(void *addr, uint64_t len);
74 
86 void *platform_virt_to_phys(void *virt);
87 
95 void platform_memset(void *ptr, char value, uint64_t num);
96 
104 void platform_memcpy(void *dst, const void *src, uint64_t num);
105 
111 void platform_start(void);
112 
118 void platform_stop(void);
119 
125 int64_t
126 platform_num_cpus(void);
127 
136 int64_t
137 platform_set_affinity(int64_t affinity);
138 
149 void
150 platform_restore_affinity(int64_t affinity);
151 
157 void
158 platform_vmcall(struct vmcall_registers_t *regs);
159 
165 void
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif
void platform_vmcall_event(struct vmcall_registers_t *regs)
Definition: platform.c:168
int64_t platform_set_affinity(int64_t affinity)
Definition: platform.c:163
void * platform_alloc_rwe(uint64_t len)
Definition: platform.c:62
void platform_restore_affinity(int64_t affinity)
Definition: platform.c:182
void platform_start(void)
Definition: platform.c:136
void platform_memcpy(void *dst, const void *src, uint64_t num)
Definition: platform.c:127
void * platform_alloc_rw(uint64_t len)
Definition: platform.c:43
void platform_free_rwe(void *addr, uint64_t len)
Definition: platform.c:95
void platform_vmcall(struct vmcall_registers_t *regs)
Definition: platform.c:162
void platform_memset(void *ptr, char value, uint64_t num)
Definition: platform.c:118
void * platform_virt_to_phys(void *virt)
Definition: platform.c:109
void platform_stop(void)
Definition: platform.c:144
constexpr const auto addr
Definition: cpuid_x64.h:80
constexpr page_table_x64::integer_pointer virt
void platform_free_rw(void *addr, uint64_t len)
Definition: platform.c:81
int64_t platform_num_cpus(void)
Definition: platform.c:152