Virtualization of servers and desktops has been occupying a large layout. With the rise of cloud computing and storage, virtualization technology is even more popular, and another virtualization technology is developing rapidly-embedded virtualization. Embedded virtualization refers to the deployment of Virtual Machine Monitoring programs in embedded systems. Although embedded devices have been subject to strict resource restrictions, today's devices are widely used-from having server-level functions (such as hardware support for virtualization) powerful processor to a Power Consumption Optimization System with less capacity and resources. If you add a Virtual Machine monitor program to an embedded system, flexibility and advanced functions will be added to transform the embedded device into a new system.
The embedded field includes several useful virtualization application fields: mobile devices, security kernels, and concurrency embedded operating systems. This article introduces the application of virtualization technology in smart terminals.
(1) virtualization technology Overview
Virtualization means that computer software runs on a virtual platform rather than a real hardware platform. Virtualization Technology can expand the hardware capacity and simplify the software reconfiguration process. CPU Virtualization allows a single CPU to simulate Parallel Running of multiple CPUs, allowing a platform to run multiple operating systems at the same time, and applications can run in mutually independent spaces without affecting each other. Virtualization Technology can significantly improve the efficiency and security of the system while reducing hardware costs.
A Virtual Machine Monitoring Program is usually added between the operating system and the hardware, called hypervisor (1 ). Hypervisor is responsible for coordinating hardware resources among various operating systems. A Virtual Machine Monitoring Program is a special operating system that runs directly on bare metal (for full virtualization technology ). The Virtual Machine monitor creates an abstraction of the underlying hardware platform. One or more virtual machines (VMS) share the underlying hardware platform. In this environment, the VM is only the container of the Operating System and Its Applications. One VM is isolated from other VMS running on the VM monitoring program, this supports multiple operating systems or multiple similar operating systems with different configurations.
Figure 1 virtualization System Structure
The Smart terminal virtualization technology also uses hypervisor to share hardware resources of multiple operating systems. The existing virtualization technology solutions include virtuallogix vlx and open kernel labs okl4. Although these technical solutions implement different hypervisors, their overall structure is similar.
(2) Virtualization in the Smart terminal Field
Virtualization technology enables loose coupling between software and hardware through virtualization technology. system software can be transplanted to a new hardware platform with only a few changes. Smart terminals can run multiple isolated operating systems on virtual platforms to improve the security of mobile phone systems. For example, to isolate important data from applications with high security requirements, even if the application software on an operating system or even the entire intelligent operating system crashes due to viruses, virtualization Technology can isolate and protect important data. In addition, virtualization technology may reduce hardware costs. If one CPU has sufficient computing power, you can simulate the execution of multiple logical CPUs on one CPU, run the smart operating system and baseband RTOS on the same CPU to reduce the number of master chips and save a lot of costs. The multi-core platform can also Virtualize CPUs into a virtual CPU pool, and all software parts share these hardware resources through virtualization technology.
If virtualization technology is highly developed in the embedded field, it can achieve extremely loose coupling of hardware and software-all software (operating systems, WiFi, Bluetooth, and other micro-control programs) the hardware platform is shared and runs on the Virtual Hardware layer. A unified logical interface is formed between the logical hardware. The hardware platform supports convenient replacement and upgrade. At that time, smart terminals can be customized at will.
(3) okl4-based Android Virtualization in ARM architecture
Okl4 Is A virtualization product of open kernel labs. As a hypervisor for embedded systems, okl4 supports virtualized operating systems (including intelligent operating systems and RTOS ), some kernel components of the operating system are also virtualized and run independently in the lightweight execution environment of okl4. Okl4 supports both coarse-grained operating system virtual machines and fine-grained lightweight execution environments. Kernel components such as drivers or file systems can run directly in a lightweight execution environment. other subsystems can share the component, which improves the system security and code reuse rate. The cell phone virtualization structure 2 based on okl4 is shown in.
Figure 2 okl4 virtualization System Structure
Virtual Machine vmm (Virtual Machine monitor) runs at the highest privilege level of the physical CPU. It virtualizes three main tasks of physical resources: processor virtualization, memory virtualization, and I/O virtualization. This section describes the okl4-based virtualization android on the ARM architecture through CPU virtualization and memory virtualization.
1. Design of CPU Virtualization
The okl4 hypervisor runs on the privileged level (6 privileged modes) and manages CPU resources and schedules and switches virtual machines. The lightweight execution environment and virtual machines are both in user mode, use the IPC Mechanism provided by okl4 for communication.
In a virtualized Android system based on okl4, when Android attempts to access the CPU register, the request does not actually occur in the physical register. On the contrary, okl4 locates the access to the virtual register ". According to different processor architectures, okl4 defines a set of "virtual registers" stored in the memory. These virtual registers are located in the user thread control block of the thread as the local variable of the thread. With the "virtual register", Android will not access real physical resources, thus isolating the operating system and CPU resources.
2. Virtual Memory Management
In the okl4 virtualization system, the memory address space used by the Android operating system is actually the virtual address space established by okl4 and the virtual memory generated by some physical memory ing. When okl4 hypervisor is started, a global variable named _ okl4_environ will be initialized, And the _ okl4_environ member okl4_1_mem_item is a struct array, it represents the virtual memory address space of each virtualization subsystem (including the operating system and virtualization components. The subsystem can access the struct array through the okl4_env_get _ static () interface provided by okl4 to obtain the virtual memory address.