# ott3r07/arm_antivm architecture

> Architecture diagram of the GitHub repository ott3r07/arm_antivm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ott3r07/arm_antivm
- Repository: https://github.com/ott3r07/arm_antivm

## Overview

##### Main Components Organization

a) Core Detection Modules (Central Components):
- CNTFRQ (Counter Frequency) Module
- CurrentEL (Current Exception Level) Module
- HCR_EL2 (Hypervisor Configuration Register) Module
- ID Register Module
- MIDR_EL1 (Main ID Register) Module
- SCTLR (System Control Register) Module

b) Support Components:
- Build System (Makefile-based compilation)
- Timing Analysis Component
- Test Framework

##### Relationships and Interactions

- Use a layered approach with three main layers:
1. Kernel Space (top layer)
2. Module Interface Layer (middle)
3. Hardware Register Access Layer (bottom)

##### Component Details

a) For each module, indicate:
- Input: Register access requests
- Output: Detection results
- Interaction with kernel space
- Hardware register dependencies

##### Specific Elements

a) Module Components:
- .ko (Kernel Object) file as the runtime component
- Relationship between source (.c) and compiled (.ko) files

b) Hardware Interface:
- ARM system registers (CNTFRQ, EL2, MIDR_EL1, etc.)
- Access paths from modules to registers

c) Detection Flow:
- Data collection paths
- Analysis paths

##### Technical Details to Highlight

- Kernel Module Interface
- ARM Architecture-specific components
- VM Detection mechanisms
- System register access patterns

##### The detection flow sequence

Keep the abstraction level focused on the system architecture while maintaining details about the ARM-specific components and detection mechanisms. This will help other engineers understand both the high-level structure and the low-level technical implementation.

Remember to indicate that this is a kernel-level project with direct hardware access requirements, which is crucial for understanding the security and privilege implications of the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Kernel_Space
        KMI[Kernel Module Interface]
        VM_Detection[VM Detection System]
    end

    subgraph Module_Interface_Layer
        CNTFRQ[CNTFRQ Module]:::module
        CurrentEL[CurrentEL Module]:::module
        HCR_EL2[HCR_EL2 Module]:::module
        IDReg[ID Register Module]:::module
        MIDR[MIDR_EL1 Module]:::module
        SCTLR[SCTLR Module]:::module
        TimingAnalysis[Timing Analysis]:::support
        TestFramework[Test Framework]:::support
    end

    subgraph Hardware_Register_Layer
        CNTFRQReg[CNTFRQ Register]:::register
        ELReg[Exception Level Register]:::register
        HCRReg[HCR_EL2 Register]:::register
        IDRegs[ID Registers]:::register
        MIDRReg[MIDR_EL1 Register]:::register
        SCTLRReg[SCTLR Register]:::register
    end

    subgraph Build_System
        Makefiles[Build System]:::support
    end

    %% Connections
    KMI --> VM_Detection
    VM_Detection --> CNTFRQ & CurrentEL & HCR_EL2 & IDReg & MIDR & SCTLR
    
    CNTFRQ --> CNTFRQReg
    CurrentEL --> ELReg
    HCR_EL2 --> HCRReg
    IDReg --> IDRegs
    MIDR --> MIDRReg
    SCTLR --> SCTLRReg

    TimingAnalysis --> VM_Detection
    TestFramework --> VM_Detection
    Makefiles --> CNTFRQ & CurrentEL & HCR_EL2 & IDReg & MIDR & SCTLR

    %% Click events
    click CNTFRQ "https://github.com/ott3r07/ARM_AntiVM/blob/master/cntfrq/cntfrq_module.c"
    click CurrentEL "https://github.com/ott3r07/ARM_AntiVM/blob/master/currentEL/currentEL_module.c"
    click HCR_EL2 "https://github.com/ott3r07/ARM_AntiVM/blob/master/hcr_el2/hyp_mode_module.c"
    click IDReg "https://github.com/ott3r07/ARM_AntiVM/blob/master/id_register/id_register_module.c"
    click MIDR "https://github.com/ott3r07/ARM_AntiVM/blob/master/midr_el1/midr_el1_module.c"
    click SCTLR "https://github.com/ott3r07/ARM_AntiVM/blob/master/sctlr/sctlr_module.c"
    click TimingAnalysis "https://github.com/ott3r07/ARM_AntiVM/blob/master/timming/timming_check.cpp"
    click TestFramework "https://github.com/ott3r07/ARM_AntiVM/blob/master/test.cpp"
    click Makefiles "https://github.com/ott3r07/ARM_AntiVM/tree/master/cntfrq/Makefile"

    %% Styles
    classDef module fill:#3498db,stroke:#2980b9,color:white
    classDef register fill:#2ecc71,stroke:#27ae60,color:white
    classDef support fill:#f1c40f,stroke:#f39c12,color:black
    
    %% Legend
    subgraph Legend
        L1[Module]:::module
        L2[Register]:::register
        L3[Support Component]:::support
    end
```
