DragonOS虚拟化 (#389)

* try some ioctl flow & kvm device

* add sys ioctl

* 删掉一些debug信息

* 修改run-qemu.sh脚本,在QEMU中enable vmx

* 修改cr0,cr4,msr寄存器enable VMX operations

* enable vmx operation

* allocate memory for vmcs with bug

* allocate memory for vmcs

* cpu virt-50%

* single vcpu virt

* add vmcs fields

* CPU virt overall flow with bug

* run vmlaunch success

* run CPU virt with bug

* 成功运行non-root模式的guest

* 成功运行vmexit,进入vmx_return函数

* 成功运行vmlaunch, vmexit, vmresume

* vmexit handler with bug

* 完成vmexit cpuid handler

* fix vmresume guest状态恢复的bug

* 增加vm ioctl

* refactor kvm 50%

* refactor kvm 80%

* FIXME: kvm vmlaunch failed

* vmlaunch success

* FIXME: output error

* update guest_rsp

* cpu virt refactor

* add mmu related struct

* add usermemory region workflow

* add mem-virt workflow

* add mem-virt

* refactor code

* add vcpu ioctl set_regs

* rename hypervisor to vm & solve some deadlock bugs

* workout mem pipeline

* fix vmcs control setting bugs

* refactor segment regs initialization

* resovle conficts

* resovle conficts

* format code
This commit is contained in:
Xiaoye Zheng
2023-10-24 14:31:56 +08:00
committed by GitHub
parent 485e248761
commit 40314b30ab
45 changed files with 3652 additions and 12 deletions

View File

@ -12,4 +12,17 @@
int open(const char *path, int options, ...)
{
return syscall_invoke(SYS_OPEN, (uint64_t)path, options, 0, 0, 0, 0, 0, 0);
}
/**
* @brief ioctl的接口
*
* @param fd 文件句柄
* @param cmd 设备相关的请求类型
* @param ...
* @return int 成功返回0
*/
int ioctl(int fd, int cmd, uint64_t data, ...)
{
return syscall_invoke(SYS_IOCTL, fd, cmd, data, 0, 0, 0, 0, 0);
}

View File

@ -14,6 +14,8 @@
extern "C" {
#endif
#include <stdint.h>
#define O_RDONLY 00000000 // Open Read-only
#define O_WRONLY 00000001 // Open Write-only
#define O_RDWR 00000002 // Open read/write
@ -72,6 +74,16 @@ extern "C" {
*/
int open(const char * path, int options, ...);
/**
* @brief ioctl的接口
*
* @param fd 文件句柄
* @param cmd 设备相关的请求类型
* @param ...
* @return int 成功返回0
*/
int ioctl(int fd, int cmd, uint64_t data, ...);
#if defined(__cplusplus)
} /* extern "C" */
#endif