Skip to content

WrathCoree/SimpleHyper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleHyper - Educational Windows Hypervisor

A simple, educational Windows kernel-level hypervisor designed for learning and experimentation. This project demonstrates basic hypervisor concepts while providing a foundation for further development.

Features

Core Hypervisor

  • VMX Initialization: Basic VMX setup and management
  • Multi-Processor Support: Handles all system processors
  • VM-exit Handling: Comprehensive exit reason routing
  • Assembly Integration: Low-level assembly handlers
  • Memory Management: EPT structure setup and management

Instruction Handling

  • CPUID Filtering: Intercepts and handles CPUID instructions
  • MSR Handling: Manages Model Specific Register access
  • EPT Violations: Handles Extended Page Table violations
  • Register Preservation: Maintains guest state integrity

Advanced Systems

  • Debug & Logging: Comprehensive debugging system with file output
  • Performance Monitoring: Cycle counting and statistics
  • Configuration Management: Registry-based configuration
  • Health Checks: System validation and diagnostics

Educational Components

  • Modular Design: Easy to extend and modify
  • Clear Documentation: Step-by-step learning path
  • Safety Features: Built-in protection mechanisms
  • Debugging Tools: Extensive logging and validation

Architecture

SimpleHyper/
├── core/                 # Core hypervisor logic
│   ├── simplehyper.h     # Main header and structures
│   ├── simplehyper.c     # Main hypervisor logic
│   └── vmx_setup.c       # VMX initialization
├── handlers/             # VM-exit handlers
│   ├── cpuid_handler.c   # CPUID instruction handling
│   └── msr_handler.c     # MSR read/write handling
├── memory/               # Memory management
│   └── ept_manager.c     # EPT setup and management
├── asm/                  # Assembly code
│   └── vmx_handler.asm   # VM-exit handler assembly
├── utils/                # Utility systems
│   ├── debug.c           # Debug and logging system
│   ├── performance.c     # Performance monitoring
│   └── config.c          # Configuration management
└── docs/                 # Documentation
 

Technical Details

VMX Support

  • Intel VMX (Virtual Machine Extensions) support
  • Multi-processor virtualization
  • Guest/host state management
  • VMCS (Virtual Machine Control Structure) configuration

EPT Implementation

  • Extended Page Tables for memory virtualization
  • Identity mapping for physical memory
  • Page table entry management
  • Memory protection framework

Performance Features

  • Cycle-level performance monitoring
  • VM-exit statistics tracking
  • CPU utilization calculation
  • Memory region validation

Debug System

  • Multi-level debug logging (ERROR, WARN, INFO, DEBUG, TRACE)
  • File-based logging support
  • Processor state dumping
  • Health check validation

Configuration System

  • Registry-based configuration
  • Feature enable/disable flags
  • Runtime configuration validation
  • Default safety settings

Building

Prerequisites

  • Visual Studio 2019 or later
  • Windows Driver Kit (WDK) 10.0.19041.1 or later
  • Windows 10/11 x64 system with VMX support

Installation

# Load the driver (requires administrator privileges)
sc create SimpleHyper type= kernel binPath= "C:\path\to\SimpleHyper.sys"
sc start SimpleHyper

# Unload the driver
sc stop SimpleHyper
sc delete SimpleHyper

Usage

Basic Operation

The hypervisor automatically:

  • Initializes VMX on all processors
  • Sets up EPT identity mapping
  • Begins monitoring VM-exits
  • Logs debug information

Configuration

Configuration can be modified through registry:

HKEY_LOCAL_MACHINE\SOFTWARE\SimpleHyper

Debug Output

Debug information is output to:

  • Kernel debugger (if attached)
  • Log file: C:\SimpleHyper.log (if enabled)

Performance Monitoring

Performance statistics are available through:

  • Debug output during operation
  • Health check functions
  • Performance dump functions

Safety Considerations

Important Warnings

  • System Instability: This is experimental software that can cause blue screen errors
  • Test Environment: Only use in virtual machines or dedicated test systems
  • Administrator Required: Driver installation requires administrator privileges
  • VMX Support: Requires Intel processor with VMX support enabled in BIOS

Safety Features

  • Default configuration disables dangerous features
  • Comprehensive error checking
  • Graceful failure handling
  • Memory validation

Code Structure

  • Modular Design: Each feature in separate modules
  • Clear APIs: Well-documented function interfaces
  • Error Handling: Comprehensive error checking
  • Debug Support: Extensive logging and validation

Extension Points

  • Add new VM-exit handlers in handlers/
  • Extend EPT functionality in memory/
  • Add utility functions in utils/
  • Implement security features in new modules

Troubleshooting

Common Issues

  • Build Errors: Ensure WDK is properly installed
  • Load Failures: Check VMX support and administrator privileges
  • Blue Screens: Use in test environment only
  • Performance Issues: Monitor VM-exit rates and adjust configuration

Debug Information

  • Enable debug logging: Set DebugLevel in configuration
  • Check log file: C:\SimpleHyper.log
  • Use kernel debugger for detailed analysis
  • Monitor performance statistics

License

This project is provided for educational purposes only. Use at your own risk.

Disclaimer

This software is experimental and may cause system instability. Use only in controlled test environments. The authors are not responsible for any damage or data loss.

Contributing

This is an educational project. Contributions should focus on:

  • Improving documentation
  • Adding educational features
  • Enhancing safety mechanisms
  • Providing learning examples

Resources

About

Educational Windows kernel-level hypervisor for learning virtualization concepts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published