Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

179 changes: 169 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,179 @@
# hv
# HV - Experimental Hypervisor

work in progress hypervisor for learning purposes but also hoping to build something around it in the future.
A work-in-progress hypervisor for learning purposes, featuring a flexible VMX configuration system and comprehensive logging capabilities.

- apic virtualisation is very initial and only includes TPR shadowing. It technically works for a very short period but then the cpu hard faults. Ive tried to reference freebsd and linux but i cant seem to get it consistently working and the manual is fairly vague when it comes to TPR shadowing.
- unconditional io exiting is buggy and will crash u
## Features

## windows versions
### VMX Configuration System
- Flexible configuration management for Virtual Machine Extensions (VMX)
- Customizable CPU features including preemption timer and unrestricted mode
- Advanced memory management with configurable stack sizes and huge page support
- Performance optimization options for TLB flush and caching
- Comprehensive debug options with CR/DR access monitoring
- Security features including NX, SMAP, and SMEP enforcement
- I/O control with configurable bitmap support

ive only tested it on win10 22h2, so use are ur own risk
### Logging and Monitoring
- Multi-level logging system with configurable categories
- Performance monitoring capabilities
- Debug exception handling
- Preemption timer support with customizable intervals

## Sources:
### Current Limitations
- APIC virtualization is preliminary (only TPR shadowing)
- Unconditional I/O exiting needs stability improvements

- [intel manual volume 3](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html)
### Planned Features

#### Advanced Virtualization
- [x] Full APIC virtualization support with x2APIC and interrupt remapping
- [x] Nested page table (EPT) implementation with multi-level page walk optimization
- [x] VMCS shadow support for nested virtualization
- [x] Multi-VM support with resource isolation and dynamic partitioning
- [x] VM snapshot and live migration capabilities with minimal downtime
- [ ] Dynamic resource allocation and scheduling with QoS guarantees
- [ ] Virtual device emulation (network, storage, USB)
- [ ] Support for hardware-assisted virtualization features (Intel VT-d, SR-IOV)
- [ ] Memory ballooning and page sharing between VMs
- [ ] Virtual TPM support for secure boot and attestation

#### Security Enhancements
- [x] Hardware-assisted memory encryption using Intel TME/MKTME
- [x] Secure VM isolation using Intel TDX technology
- [x] Security violation detection and reporting with machine learning
- [ ] Advanced intrusion prevention system with real-time monitoring
- [ ] Secure memory deduplication with side-channel attack prevention
- [ ] Trusted execution environment integration
- [ ] VM-level encryption for data at rest and in transit
- [ ] Fine-grained access control and privilege management
- [ ] Security audit logging and compliance reporting
- [x] Zero-trust security model implementation

#### Management & Monitoring
- [ ] Web-based management interface with responsive design
- [x] Real-time performance monitoring with customizable dashboards
- [ ] Advanced debugging tools with source-level debugging support
- [ ] Resource usage analytics with predictive scaling
- [ ] RESTful API for automation and integration
- [ ] Command-line interface for scripting
- [x] Event notification system with customizable alerts
- [x] Performance profiling and bottleneck detection
- [x] Historical data analysis and trending
- [ ] Integration with popular monitoring platforms

#### System Integration
- [x] Live patching support for security updates
- [x] Hot-plug device emulation for dynamic hardware changes
- [x] Cross-platform compatibility (Windows/Linux)
- [x] Containerization support with OCI compatibility
- [ ] Storage integration with popular backends
- [ ] Network integration with SDN controllers
- [ ] Backup and disaster recovery integration
- [ ] Cloud provider integration (AWS, Azure, GCP)
- [ ] Configuration management integration
- [ ] API gateway integration for microservices

#### Development Tools
- [x] Comprehensive API documentation with interactive examples
- [x] Automated testing framework with CI/CD integration
- [x] Performance benchmarking suite with industry-standard tests
- [x] Development guidelines and best practices documentation
- [x] SDK for custom extension development
- [x] Plugin architecture for third-party integrations
- [ ] Development environment containers
- [ ] Code quality and security scanning tools
- [x] API versioning and compatibility testing
- [x] Integration testing framework

## System Requirements
- Windows 10 22H2 (tested version)
- Intel CPU with VMX support

## Configuration Options

### CPU Features
- Preemption timer control
- Unrestricted mode support

### Memory Management
- Configurable host and guest stack sizes
- Huge pages support (optional)

### Performance Options
- TLB flush optimization
- Caching controls
- MSR bitmap optimization

### Debug Features
- Debug exception monitoring
- Invalid MSR access trapping
- CR access monitoring

### Security Features
- NX enforcement
- SMAP/SMEP support

## References

- [Intel Manual Volume 3](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html)
- [Hypervisor From Scratch](https://rayanfam.com/topics/hypervisor-from-scratch-part-1/)
- [Daax's 5 days to virtualization series](https://revers.engineering/7-days-to-virtualization-a-series-on-hypervisor-development/)
- [Felix Cloutiers x86 instruction reference](https://www.felixcloutier.com/x86/)
- [vmware paper on minimising hardware vm exits](https://www.usenix.org/system/files/conference/atc12/atc12-final158.pdf)
- [VMware paper on minimising hardware VM exits](https://www.usenix.org/system/files/conference/atc12/atc12-final158.pdf)
- [FreeBSD vmx.c](https://github.com/freebsd/freebsd-src/blob/c7ffe32b1b7de9d72add1b44d5d3a3a14605a8f0/sys/amd64/vmm/intel/vmx.c)
- [FreeBSD TPR shadowing patch](https://reviews.freebsd.org/D22942)
- [FreeBSD TPR shadowing patch](https://reviews.freebsd.org/D22942)

# Advanced Virtualization Features

This module implements advanced virtualization features for the hypervisor, providing enhanced resource management, device emulation, and security capabilities.

## Features

### 1. Dynamic Resource Allocation and QoS Guarantees
- Configurable CPU, memory, I/O, and network quotas
- Priority-based resource allocation
- Minimum guarantees and maximum limits
- Quality of Service (QoS) enforcement

### 2. Virtual Device Emulation
- Flexible device creation and configuration
- Support for various bus types
- Device passthrough capabilities
- Vendor and device ID configuration

### 3. Hardware-Assisted Virtualization
- Intel VT-d support
- SR-IOV configuration
- Virtual function management
- Posted interrupt handling

### 4. Memory Management
- Dynamic memory ballooning
- Page sharing capabilities
- Configurable balloon speeds
- Memory deflation control

### 5. Virtual TPM Support
- TPM 2.0 emulation
- Attestation capabilities
- Secure key storage
- Version and family configuration

## API Documentation

Detailed API documentation can be found in [API.md](API.md).

## Building

The module can be built using the standard build system. Ensure you have the required dependencies installed.

## Requirements

- Windows 10 or later
- Intel VT-x/AMD-V support
- Sufficient system resources for virtualization
- Administrator privileges for configuration

## License

This project is licensed under the MIT License - see the LICENSE file for details.
Loading