Research and Implementation of Virtual Machines in X86-64 (1)

xiaoxiao2021-03-06  75

Summary The virtual machine can simulate different computer hardware environments, complex network environments, and users operate in virtual environments, use a machine as multiple sets to achieve a half-power. The x86-64 virtual machine is an intent set of AMD64 processors in a 32/64-bit environment to achieve a fully emulated and efficient virtual 64-bit environment.

Introduction We are now at the alternating period of 32-bit and 64-bit systems, a simulator that can efficiently simulate 64-bit instruction sets on 32/64-bit systems is practical, my study is based on AMD64 processors Analog objects implements a 64-bit virtual machine that can run on a 32/64 bit system. Currently VMware, Virtual PC's products are not supported in the X86-32 / 64 environment in the X86-32 / 64 instruction set, only Virtutech's SIMICS instruction set simulator can realize the environment in X86-32 The next simulation X86-64, but the speed is extremely slow. OpenSource's virtual machine project Bochs supports the support of the X86-64 instruction set is being developed. AMD64 (x86-64) The characteristics of the processor X86 Introduction Intel will increase the X86 industry standard from 4, 8 digits, 16 bits have always been increased to 32, and have experienced a quite long time. The X86 industry standard is launched in 1978. The 8086 processor has 4 16-bit GPR and 4 16-bit registers. With the introduction of 80386, Intel increases X86 to 32 bits and increases the processor's register to 8 (32 bits). For those extension registers, the programmer uses a set of different register storage modes in assembly language. In the X86-64 of AMD, AMD's approach and Intel is similar. They double the number of bits of 8 GPRs and new ways to do with multiple registers. Intel and AMD competition in the X86-64 architecture have been divided out, Intel has decided to use AMD's X86-64 structure as an epigeval, and push the previously launched IA64 (Anteng) processor to high-end servers. At the same time, Intel's dual kernel processor is postponed until 2006, and AMD's X86-based double-nest AMD OpteronTM processor has been launched in September 2004, Intel Hyper-threaded processor will experience new challenge. AMD64 Technical Introduction ---- AMD64 technology further develops 32-bit X86 structures of industry standards to support the requirements of strict 64-bit environments, so that future generations of computer functionality and productivity are achieved. AMD design AMD64 platform allows end users to enjoy reliable first-class performance while running today's 32-bit software, while also preparing for smooth transition to future high-performance 64-bit applications. The AMD64 architecture can also achieve a more secure computing environment by EVP (enhanced virus protection technology) based on the advanced anti-virus function in Windows® XP Service Pack 2 and the upcoming Windows Server 2003 Service Pack 1. AMD64 Architecture Since 2003, AMD OpteronTM processors for servers and workstations have won more than its superior innovation and performance. 55 awards and support for more than 2,000 hardware and software developers, system integrators and distributors. The architecture of AMD64 AMD uses the X86 structure and expands to 64 bits to obtain X86-64 structures. 1. The processor uses 32-bit x86 traditional mode to execute the current 32-bit operating system and application. 2. The processor runs a 64-bit operating system in long mode and runs 32-bit and 64-bit applications at the same time. 3. Only 64-bit address space and 64-bit registers can only be processed in 64bit mode. 4. When needed, users can discard 32-bit compatibility and transfer to 64-bit addresses and data types. Figure 1, in the X86-64 architecture of the AMD, the number of GPRs and SIMD registers is doubled.

When the processor works in 64-bit mode, the processor has 16 GPRs, and 8 new SIMD registers (support SSE / SSE2). The maximum advantage of x86-64 is completely compatible with existing X86 code. Its pattern is as follows: Figure 3 Legacy mode: in this mode works like a standard X86 processor, including real mode, 8086 mode and protection mode this 3 Submount. You can run a 32-bit operating system and 32-bit code, and there is no new features in X86-64. LONG mode: running programs in this mode, you need to use a 64-bit operating system. The long mode offers two sub-patterns, 64-bit modes, and compatible modes. AMD64 Memory Management LONG Mode Memory Management: Figure 464-bit Mode (64-bit mode) supports 64-bit virtual address space and 52-bit physical address space. In this mode, the X86-64 processor gives the segment structure, directly uses a page unit to manage memory: linear addresses -> Paging unit -> Physical address compatibility mode can run on 64-bit operating systems 16-bit, 32-bit applications. In this mode, the previous X86 segment page structure: logical address -> segmentation unit -> Linear address -> Page Unit -> Physical Address is because of compatibility mode retains this addressing Methods, the software developed in the 16/32 platform can not be modified without re-compiling it. Figure 5 Protected Mode The current 32-bit operating system runs in this mode, supports 16/32-bit applications, is also a segment page structure: logical address -> segmentation unit -> Linear address - -> Page Unit -> Physical Address Virtual-8086 MODE inherits the previous 16-bit mode. Real Mode inherits the previous 16-bit mode (same as 8086). AMD64 register 1, the following table is the 64bit mode and the comparison of the Legacy / Compatibility mode register: Figure 6 1, 8 universal registers. 2, 16 universal registers are 64 bits. 3, add 8 128-bit XMM registers. 4. All universal registers are addressing the unified byte register. 5, the new register is prefixed with a new instruction (REX).

Legacy mode and General register of Compatbility mode: a) eight 8-bit registers (AH, Al, BH, BL, CH, CL, DH, DL) B) eight 16-bit registers (AX, BX, CX, DX, DI , Si, BP, SP) C) Eight 32-bit registers (EAX, EBX, ECX, ESP, EDI, ESI, EBP, ESP) 64-bit mode universal register: a) 16 8-bit registers (Al, BL, CL, DL, SIL, DIL, BPL, SPL, R8B, R9B, R10B, R11B, R12B, R13b, R14B, R15B) b) 16 16-bit registers (AX, BX, CX, DX, DI, Si, BP, SP, R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W) c) 16 32-bit registers (EAX, EBX, ECX, ESP, EDI, ESI, EBP, ESP, R8D, R9D, R10D, R11D, R12D, R13D, R14D, 15D) D) 16 64-bit registers (RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, R8, R9, R10, R11, R12, R13, R14, R15), Segment register Figure 7 ignores DS, ES, and SS segment registers in 64-bit mode. AMD discards segmented memory model (segmented memory model). The programmer will use a unified 64-bit virtual address space in X86-64 mode, and the existing X86 application must use the protection mode in the LONG MODE compatibility mode. The real model and virtual 8086 model cannot be used under long mode, but can only be in Legacy mode. This is easy to understand, after all, except for some old procedures, other X86 applications use protection mode. So you should pay full attention to the new features of AMD64 when the environment of the virtual machine is simulated X86-64. The principle of virtual machine virtual machine design is to simulate a variety of different models on the same machine, such as Intel's X86 series, IBM / Motorola's PowerPC, etc. Each model has its specific central processing machine (CPU) chip, and each chip is different. Some operating systems can only be run on a specific processor, such as MacOS, Sun Solaris, etc., there are many 64-bit operating systems that cannot be installed on the 32-bit processor that is now popular, gives program developers, programming enthusiasts have a lot. Trouble, in order to overcome this difficulty, the virtual machine came into being. The program is highly required by the development of the developer's quality. Developers must not only use the high-performance programming languages ​​of C / C , but also understand the underlying technology, principles, and principles of the operating system. All instruction sets of the AMD64 processor increases the difficulty of development. Developers are mainly me and my current project group, and our group has been developing a Linux kernel related transformation and OpenSource project development, a certain understanding of the underlying knowledge of the system, but due to time, this project will open source Based on Bochs, it was developed secondary.

References [1] Advanced Micro Devices, Inc. x86-64TM Technology White Paper [2] AMD64 Architecture Programmer's Manual Volume 1: Application Programming [3] AMD64 Architecture Programmer's Manual Volume 2: System Programming [4] AMD64 Architecture Programmer's Manual Volume 3 : General-Purpose and System Instructions [5] AMD64 Architecture Programmer's Manual Volume 4: 128-Bit Media Instruction [6] AMD64 Architecture Programmer's Manual Volume 5: 64-Bit Media and x87 Floating-Point Instructions [7] The AMD x86-64 TM Architecture Program Overview [8] http://bochs.sourceforge.net Bochs Linyang Zhongke Software College (Linyang@dl.cn)

转载请注明原文地址:https://www.9cbs.com/read-87979.html

New Post(0)