WO2009114961A1 - 一种支持x86虚拟机的risc处理器装置及方法 - Google Patents

一种支持x86虚拟机的risc处理器装置及方法 Download PDF

Info

Publication number
WO2009114961A1
WO2009114961A1 PCT/CN2008/002023 CN2008002023W WO2009114961A1 WO 2009114961 A1 WO2009114961 A1 WO 2009114961A1 CN 2008002023 W CN2008002023 W CN 2008002023W WO 2009114961 A1 WO2009114961 A1 WO 2009114961A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
register
virtual machine
address
bit
Prior art date
Application number
PCT/CN2008/002023
Other languages
English (en)
French (fr)
Inventor
李国杰
胡伟武
李晓钰
苏孟豪
Original Assignee
中国科学院计算技术研究所
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国科学院计算技术研究所 filed Critical 中国科学院计算技术研究所
Priority to JP2011500028A priority Critical patent/JP5501338B2/ja
Priority to US12/922,949 priority patent/US8949580B2/en
Priority to KR1020107020814A priority patent/KR101232343B1/ko
Priority to EP08873507.1A priority patent/EP2267598B1/en
Priority to CA2718724A priority patent/CA2718724C/en
Publication of WO2009114961A1 publication Critical patent/WO2009114961A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/3017Runtime instruction translation, e.g. macros
    • G06F9/30174Runtime instruction translation, e.g. macros for non-native instruction set, e.g. Javabyte, legacy code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30094Condition code generation, e.g. Carry, Zero flag
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30181Instruction operation extension or modification
    • G06F9/30185Instruction operation extension or modification according to one or more bits in the instruction, e.g. prefix, sub-opcode

Definitions

  • the present invention relates to the field of cross-platform compatibility technology of a microprocessor architecture, and more particularly to a reduced instruction set computer (RISC) processor apparatus and method for supporting an X86 virtual machine.
  • RISC reduced instruction set computer
  • the central processing unit (CPU), referred to as the microprocessor, is the core unit of the computer.
  • the instruction set and design specification (architecture) used by the microprocessor is the primary feature of the computer, which determines the type of peripherals and applications that the computer needs.
  • RISC Reduced Instruction Set Computing
  • MIPS MIPS32/64 instruction set
  • CISC Complex Instruction Set Computing
  • Program software running on processors with different architectures needs to be written specifically for the architecture of the processor.
  • the application software on the X86 usually cannot be run on the computer of the RSIPS processor of the MIPS instruction set, which is often said to be incompatible. .
  • a processor (CPU) computer having one type of architecture is referred to as a host; and a processor (CPU) environment that requires host emulation, an unrelated architecture type is referred to as a target machine, and an application is required.
  • a program can cause the host to execute one or more host instructions, and in response to a given target machine instruction, run software written for the target machine, which is called a virtual machine.
  • the existing virtual machines are: SimOS, QEMU, Transmeta, etc.
  • the virtual machine running overhead is too large, and the execution efficiency is too low. It is difficult to apply to actual work.
  • a RISC processor supporting an X86 virtual machine for the purpose of the present invention includes an instruction module, a decoder, a lookup table, a fixed point operation component, and a floating point operation component, wherein:
  • the instruction module is configured to store a virtual machine instruction set supporting an X86 virtual machine
  • the decoder is configured to distinguish the virtual machine instruction set mode of the instruction in the virtual machine instruction set instruction decoding process, and output the instruction to the fixed point operation according to the differentiated virtual machine instruction set mode.
  • Component or floating point arithmetic component
  • the lookup table is configured to store a jump address and a MIPS jump address in the X86 program, and support fast translation of the translation of the jump address to the MIPS jump address in the X86 program according to the output of the decoder. Improve virtual machine performance;
  • the fixed point computing component is configured to perform corresponding processing on the fixed point instruction of the virtual machine instruction set according to the output of the decoder, and output an execution result;
  • the floating point operation unit is configured to perform corresponding processing on the floating point instruction of the virtual machine instruction set according to the output of the decoder, and output an execution result.
  • the RISC processor supporting the X86 virtual machine further includes a memory access execution unit, a memory, and a data path;
  • the memory access execution unit performs data transmission between the register and the memory through the data path according to the output of the decoder.
  • the RISC processor supporting the X86 virtual machine further includes a general physical register file, the general physical register file including an overflow check register, an upper bound, a lower bound address register, and an analog target Register, and virtual machine mode control register;
  • the overflow check register is configured to store a result of a stack overflow exception check when floating point access is performed to a stack register simulated by the RISC processor;
  • the upper bound and lower bound address registers are used to store the effective address of the upper boundary and the lower bound when simulating the bounded memory access mechanism of the X86 processor;
  • the analog flag register is used to simulate a flag register flag bit of the X86 processor; the virtual machine mode control register includes a control bit flag, and when the control bit flag is 1, it indicates that the corresponding instruction is running in the X86 virtual state. In the machine instruction set mode; when the control bit flag is 0, it means that the corresponding instruction runs in the non-X86 virtual machine instruction set mode.
  • the RISC processor supporting the X86 virtual machine further includes a floating point register file; the floating point register file includes a floating point control register; a floating point register stack, and first to third floating point registers.
  • the virtual machine instruction set includes one or a combination of one of a memory access extension instruction, a prefix instruction, an EFLAG flag bit related instruction, a floating point stack related instruction, and a lookup table related instruction.
  • the decoder includes an instruction processing module, and a pattern recognition module, wherein:
  • the instruction processing module is configured to decode an instruction of a virtual machine instruction set, and then output a given point operation component or a floating point operation component;
  • the pattern recognition module is configured to distinguish the virtual machine instruction set mode of the instruction during the instruction decoding process, and perform corresponding processing.
  • the mode recognition module includes a multiple storage decoding module and/or a multiple reading decoding module, and the multiple storage decoding module is configured to: when the input instruction is a storage operation instruction in the memory expansion instruction, The source register is expanded from one to a plurality of adjacent registers, and then output to the memory access execution unit;
  • the multiple reading and decoding module is configured to decode the read operation instruction into a plurality of internal operation instructions when the input instruction is a read operation instruction in the memory expansion instruction, and expand the target register by one extension A plurality of adjacent registers are then allocated to the plurality of internal operations, and the output is executed by the memory access execution unit.
  • the pattern recognition module further includes a prefix instruction decoding module and a flag bit instruction decoding module;
  • the flag bit instruction decoding module is configured to process an EFLAG flag bit related instruction in an analog EFLAGS working mode, and decode the analog flag register into a source register of the instruction according to different EFLAG flag related instructions. Or target register;
  • the prefix instruction decoding module is configured to indicate that the multiple instructions after the prefix instruction are in the X86 virtual machine instruction set mode.
  • the decoder further includes a prefix instruction counter for recording the number of instructions of the sequence of instructions affected by the prefix instruction and without the branch instruction, the number of instructions being equal to the range parameter.
  • the decoder further includes a TOP pointer register, and a lookup table module, wherein:
  • the TOP pointer register is configured to maintain a floating point stack operation pointer, and store a value of the floating point stack operation pointer
  • the lookup table module is configured to implement conversion from an X86 source instruction address to a MIPS target instruction address by using a lookup table according to a lookup table related instruction.
  • the fixed point operation component includes a flag read/write module, a flag operation module, an exception processing module, and a prefix exception control register;
  • the flag reading and writing module is configured to read and write a value of an analog flag register flag bit
  • the flag operation module is configured to: when the RISC processor is in the X86 virtual machine working mode, obtain the analog flag register flag according to the operation result, or according to one or more bits in the analog flag register flag bit, Executing a branch jump instruction;
  • the exception processing module is configured to: when the prefix instruction only affects an instruction immediately following, if an execution exception occurs, the bd bit of the Cause register is set in the same manner as the delay slot exception, and the EPC is pointed to the prefix.
  • the instruction re-executing the prefix instruction after the exception service program is completed; the prefix exception control register is configured to record whether the instruction that the exception occurs is affected by the prefix instruction; and the current instruction count is stored when the exception occurs and the process is interrupted. When the abnormal end returns to the interrupted process, the interrupted process is resumed according to the count.
  • the floating point operation component includes a pointer operation module, a stack overflow determination module, and a conversion module; the pointer operation module is configured to operate the TOP pointer register, and simulate the operation of the floating point register stack, The stack operation of the stack operation pointer, modifying and monitoring the state of the operation pointer;
  • the stack overflow judging module is configured to check a chirp register in a specified floating point register stack, and The overflow check register is operated according to the value of the stack register, and the stack overflow exception check is performed during floating point access;
  • the conversion module is configured to perform mutual conversion between extended double precision floating point data and double precision floating point data.
  • a data processing method for a RISC processor device supporting an X86 virtual machine which includes the following steps:
  • Step A setting the working mode of the RISC processor in the RISC processor to the X86 virtual machine working mode
  • Step B reading an instruction to distinguish the virtual machine instruction set mode of the instruction; in the instruction decoding process, decoding the instruction according to the differentiated virtual machine instruction set mode according to the virtual machine instruction set mode of the differentiated instruction After output
  • Step c according to the output, perform corresponding calculation or access processing, and output the executed result.
  • the RISC processor supports the data processing of the X86 virtual machine as support for using the EFLAG instruction
  • the step A is specifically:
  • Step A1 setting the working mode of the RISC processor in the RISC processor to the X86 virtual machine working mode, indicating that the analog flag register is available;
  • the step B is specifically:
  • Step Bl the decoder recognizes that the operation is in the analog EFLAGS working mode, and then decodes the analog flag register into a source register and/or a target register according to different instructions;
  • the step C is specifically:
  • Step C1 during the operation of the RISC processor, when the working mode of the RISC processor is the X86 virtual machine working mode, the value of the analog flag register flag bit is read/written to realize the acquisition/storage of the operation state, and according to the operation result
  • the analog flag register flag or the branch jump instruction is executed according to one or more bits in the analog flag register flag.
  • the step A is specifically:
  • Step A2 determine whether the floating point register is selected for simulating the floating point register stack operation; or set a general purpose register, the lower 8 bits of which represent the floating point register stack from low to high respectively The state of the stack register of 0 ⁇ 7; or select any three general-purpose registers as the first floating-point register, the second floating-point register and the third floating-point register, and perform format conversion of 64-bit floating-point number and 80-bit floating-point number. jobs;
  • the step B is specifically:
  • Step B2 storing the value of the stack operation pointer in the 3-bit TOP pointer register in the decoder; or decoding the newly added stack overflow judgment instruction; or converting the extended double-precision floating-point data and the double-precision floating-point data Instruction decoding
  • the step C is specifically:
  • Step C2 when simulating the floating-point register operation, operating the pointer register, simulating the stack operation of the stack operation pointer, modifying and monitoring the state of the stack operation pointer; or checking the stack register in the specified floating-point register stack, and
  • the overflow check register is operated according to the value of the stack register to perform a floating-point stack overflow check; or the data conversion between the extended double-precision floating-point data and the double-precision floating-point data is performed.
  • the step A is specifically:
  • Step A3 in the X86 virtual machine of the RISC processor, setting two general-purpose registers as an upper bound address register and a lower bound address register;
  • the step B is specifically:
  • Step B3 when performing the X86 virtual machine instruction set to the MPS instruction set translation, the decoder decodes the instruction to obtain a binary code that can be processed by the RISC processor;
  • the step C is specifically:
  • Step C3 The fixed-point operation unit determines the validity of the instruction operand address and the instruction address according to the upper bound address stored in the upper bound address register and/or the lower bound address stored in the lower bound address register in the decoded memory fetch instruction. ; When the instruction operand address and the instruction address are both valid, the memory access operation is performed; otherwise, the address error exception is caused.
  • step A is specifically:
  • Step A4 reading the prefix instruction to distinguish the virtual machine instruction set mode of the instruction; or the processor fetching the multiple data width instruction input to the decoder; or in the X86 virtual machine of the RISC processor
  • Step A4 initialize the lookup table, and fill in the lookup table with the contents of the obtained X86 virtual machine instruction address to the MDPS instruction address;
  • the step B is specifically:
  • Step B4 in the instruction decoding process, according to the virtual machine instruction set mode of the differentiated instruction, the instruction is decoded according to the differentiated virtual machine instruction set mode, and the decoder determines the instruction type, and identifies Decoding a multiple data width instruction; or the decoder identifies a lookup table related instruction for decoding;
  • the step C is specifically:
  • Step C4 the fixed point operation component executes the instruction affected by the prefix instruction, and calculates a corresponding EFLAG flag bit according to the operation result; or sends the decoded multiple data width instruction to the memory access execution unit to perform the operation; or performs a lookup table correlation
  • the instruction gets the value of the target instruction address or jumps to the target address for execution.
  • FIG. 1 is a schematic structural diagram of a RISC processor device supporting an X86 virtual machine according to the present invention
  • FIG. 2 is a flow chart of a data processing method for a RISC processor supporting an X86 virtual machine according to the present invention. The best way to implement the invention
  • the RISC processor of the MIPS64 instruction set is taken as an example to describe the RISC processor device and method for supporting the X86 virtual machine in the present invention.
  • the present invention is not limited thereto. The scope of protection requested is subject to the claims.
  • the RISC processor device and method supporting the X86 virtual machine of the present invention in order to solve the semantic gap between the X86 and RISC processor architectures, implement X86 processor compatibility support on the RISC processor, and need to be solved on the RISC processor.
  • the RISC processor supporting the X86 virtual machine of the present invention includes an instruction module 1, a decoder 2, a lookup table (not shown), a fixed point operation unit 3, a general physical register file 7, and a floating point operation.
  • Component 4 floating point physical register file 8, fetch execution unit 5, memory and data path 6, etc.
  • the instruction module 1 is configured to store a virtual machine instruction set supporting an X86 virtual machine, where the virtual machine instruction set may include a memory access extension instruction, a prefix instruction, an EFLAG flag bit related instruction, a floating point stack related instruction, and a lookup table correlation. One or more combinations of instructions.
  • the decoder 2 is configured to distinguish the virtual machine instruction set mode of the instruction in the virtual machine instruction set instruction decoding process, and decode the instruction according to the differentiated virtual machine instruction set mode, and output the given point.
  • the lookup table is configured to store a jump address and a MIPS jump address in the X86 program, and support fast translation of the jump address to the MIPS jump address in the X86 program according to the output of the decoder.
  • the fixed point arithmetic unit 3 is for processing the fixed point instruction of the virtual machine instruction set based on the output of the decoder 2, and outputs the execution result.
  • the floating point arithmetic unit 4 is configured to process a floating point instruction of the virtual machine instruction set according to the output of the decoder 2, and output an execution result.
  • the memory access execution unit 5 is configured to perform data transmission between the register and the memory through the data path according to the output of the decoder.
  • the decoder 2 includes an instruction processing module 21, a pattern recognition module 24, a TOP pointer register 22, and a lookup table module 23.
  • the instruction processing module is configured to perform instruction decoding on the instruction of the virtual machine instruction set, and then output the given point operation component 3 or the floating point operation component 4 or the memory access execution unit 5;
  • the pattern recognition module 24 is configured to distinguish the virtual machine instruction set mode of the instruction during the instruction decoding process, and perform corresponding processing.
  • the pattern recognition module 24 includes a multiple storage decoding module 244 and/or a multiple reading decoding module
  • the multiple storage decoding module 244 is configured to expand the source register into one of a plurality of adjacent registers when the input instruction is a memory operation instruction in the memory expansion instruction, and then output the result to the memory access execution unit 5 carried out;
  • the multiple read decoding module 245 is configured to decode the read operation instruction into a plurality of internal operation instructions when the input instruction is a read operation instruction in the memory expansion instruction, and set the target register by The expansion is performed into a plurality of adjacent registers, and then distributed to the plurality of internal operations, and the output is executed to the memory access execution unit 5.
  • the pattern recognition module 24 further includes a prefix instruction decoding module 241 and a flag bit instruction decoding module 243.
  • the flag bit instruction decoding module 243 is configured to be in an analog EFLAGS working mode.
  • the EFLAG flag related instruction is processed, and the analog flag register 71 is decoded into the source register and/or the target register of the instruction according to different EFLAG flag related instructions;
  • the prefix instruction decoding module 241 is configured to indicate that multiple instructions after the prefix instruction are in the X86 virtual machine instruction set mode; further, when the range parameter of the prefix instruction is n, the decoder 2 further includes a prefix instruction. a counter 242, configured to record an instruction sequence of the instruction sequence affected by the prefix instruction and not having a branch instruction, the instruction number being equal to the range parameter;
  • the TOP pointer register 22 is configured to maintain a floating point operation pointer, and store a value of a floating point stack operation pointer
  • the lookup table module 23 is configured to use a lookup table to implement conversion from an X86 source instruction address to a MIPS target instruction address according to a lookup table related instruction.
  • the fixed point arithmetic unit 3 includes a flag read/write module 31, a flag operation module 32, an exception processing module 34, and a prefix exception control register 33.
  • the flag read/write module 31 is configured to read and write the value of the flag of the analog flag register 71;
  • the flag operation module 32 is configured to perform the operation result, when the RISC processor is in the X86 virtual machine working mode, according to the operation result Obtaining an analog flag register flag bit, or executing a branch jump instruction according to one or more bits in the analog flag register flag bit;
  • the exception processing module 34 is configured to: when the prefix instruction affects only one instruction immediately following, if an execution exception occurs, the bd bit of the Cause register is set in the same manner as the delay slot exception, and the EPC is pointed at the same time.
  • the prefix instruction re-executes the prefix instruction after the exception service program is completed.
  • the prefix exception control register 33 is configured to record whether an instruction that generates an exception is affected by the prefix instruction; store a count of the current instruction when an exception occurs and interrupt the process, and return to the interrupted process when the abnormal end is returned, according to the Counting resumes the interrupted process.
  • the general physical register file 7 includes an overflow check register 72, an upper bound, a lower bound address register 74, an analog flag register 71, and a virtual machine mode control register 73.
  • the overflow check register 72 is configured to store a result of checking for an overflow exception when performing floating point access to the RISC processor emulated ⁇ register;
  • the upper bound and lower bound address register 74 is configured to simulate an effective address of the upper boundary and the lower bound when simulating the bounded memory access mechanism of the X86 processor;
  • the analog flag register 71 is configured to simulate a flag register flag bit of the X86 processor; the virtual machine mode control register 73 includes a control bit flag. When the control bit flag is 1, it indicates that the corresponding instruction is running at this time. In the X86 virtual machine instruction set mode; when the control bit flag is 0, it means that the corresponding instruction runs in the non-X86 virtual machine instruction set mode.
  • the floating point arithmetic unit 4 includes a pointer operation module 41, a stack overflow judgment module 43, and a conversion module 42.
  • the pointer operation module 41 is configured to operate the TOP pointer register, simulate the stack operation of the stack operation pointer, and modify and monitor the state of the stack operation pointer when the floating point register ⁇ 83 is simulated;
  • the stack overflow judging module 43 is configured to check a stack register in the specified floating point register stack 83, and operate the overflow check register 72 according to the value of the stack register to perform an overflow exception check when performing floating point access;
  • the conversion module 42 is configured to perform mutual conversion between extended double precision floating point data and double precision floating point data.
  • the floating point register file 8 includes a floating point control register 81; a floating point register stack 0-7; and a 1 ⁇ 3 floating point register 82.
  • the three registers of the first to third floating point registers 82 can be overlapped and applied to the floating point register stacks 0 to 7.
  • the memory access execution unit 5 includes a merging unit, an upper and lower boundary determining module.
  • the merging unit is configured to merge the multiple internal operations before the execution unit performs after the multiple read decoding module 244 decodes the read memory operation instruction.
  • the upper and lower bound determination module is configured to support validity determination of an address included in the access command by the upper bound and the lower bound address when the bounded memory access instruction is supported.
  • a data processing method for a RISC processor device supporting an X86 virtual machine is provided, which includes the following steps:
  • Step A setting the working mode of the RISC processor in the RISC processor to the X86 virtual machine working mode
  • Step B reading an instruction to distinguish the virtual machine instruction set mode of the instruction; in the instruction decoding process, decoding the instruction according to the differentiated virtual machine instruction set mode according to the virtual machine instruction set mode of the differentiated instruction After output
  • Step C Perform corresponding calculation or access processing according to the output, and output an execution result.
  • the step A is specifically:
  • Step A setting the working mode of the RISC processor in the RISC processor to the X86 virtual machine working mode, indicating that the analog flag register 71 is available;
  • the step B is specifically:
  • Step Bl the decoder recognizes that the operation is in the analog EFLAGS mode of operation, and then decodes the analog flag register 71 into a source register and/or a destination register according to different instructions;
  • the step C is specifically:
  • Step C1 During the operation of the RISC processor, when the working mode of the RISC processor is the X86 virtual machine working mode, the value of the flag of the analog flag register 71 is read and written to realize the acquisition/storage of the operation state, and/or according to the simulation. The value of the flag register 71 flag is controlled.
  • the RISC processor supports the data processing of the X86 virtual machine for X86 floating point format and floating point ⁇ support,
  • the step A is specifically:
  • Step A2 determine whether the floating point register is selected for simulating the floating point register ⁇ 83 operation; or set a general purpose register, the lower 8 bits of which represent the floating point register ⁇ 83 from 0 to 0
  • the status of the stack register of the 7th; or any three general-purpose registers, as the 1 ⁇ 3 floating-point register 82, is used for the format conversion of 64-bit floating-point numbers and 80-bit floating-point numbers;
  • the step B is specifically:
  • Step B2 storing the value of the stack operation pointer in the 3-bit TOP pointer register in the decoder; or decoding the newly added stack overflow judgment instruction; or converting the extended double-precision floating-point data and the double-precision floating-point data Instruction decoding
  • the step C is specifically:
  • Step C2 when the floating point register stack 83 is operated, the pointer register is operated, the stack operation of the operation pointer is simulated, the state of the operation pointer is modified and monitored, or the stack register in the specified floating point register stack 83 is checked.
  • the overflow check register 72 is operated according to the value of the ⁇ register to perform a floating point ⁇ overflow check; or data conversion between the extended double precision floating point data and the double precision floating point data is performed.
  • the step A is specifically:
  • Step A3 in the X86 virtual machine of the RISC processor, set two general-purpose registers as upper bound and lower bound address registers 74;
  • the step B is specifically:
  • Step B3 when performing the X86 virtual machine instruction set to the MIPS instruction set translation, the decoder decodes the instruction to obtain a binary code that can be processed by the RISC processor;
  • the step C is specifically:
  • Step C3 The fixed-point operation unit determines the instruction operand according to the upper bound address stored in the upper bound address register and/or the lower bound address stored in the lower bound address register in the decoded memory access instruction. The validity of the address and instruction address; when the instruction operand address and the instruction address are both valid, the memory access operation is performed; otherwise, the address error exception is caused.
  • the step A is specifically:
  • Step A4 reading the prefix instruction, distinguishing the virtual machine instruction set mode of the instruction; or the processor extracting the multiple data width instruction input to the decoder; or initializing the lookup table when the X86 virtual machine of the RISC processor is started, The X86 virtual machine instruction address to the contents of the MIPS instruction address to fill in the lookup table;
  • the step B is specifically:
  • Step B4 in the instruction decoding process, according to the virtual machine instruction set mode of the differentiated instruction, the instruction is decoded and output according to the differentiated virtual machine instruction set mode; or the decoder determines the instruction type, identifies and Decoding a multiple data width instruction; or the decoder identifies a lookup table related instruction; the step C is specifically:
  • Step C4 the fixed point operation component executes the instruction affected by the prefix instruction, and calculates the corresponding EFLAG flag bit according to the operation result.
  • the decoded multiple data width instruction is sent to the memory access execution unit to perform the operation.
  • execute the lookup table related instruction to get the value of the target instruction address or jump to the target address for execution.
  • EFLAG instructions In order to support the use of EFLAG instructions, two methods are provided: one is to expand each physical register in the physical register file to 72 bits, including 64-bit data bits and 8-bit flag bits. When the operation is performed, the data portion of the operation result and the flag portion are written back to the target register. At the same time, a new flag bit pointer Reflag is set in the decoder 2 to indicate the general register logical number combined with the latest flag bit. The other is to add an internal logic register to the physical register file to implement the X86 EFLAG flag. For each instruction that modifies EFLAG, a new related instruction is added to specifically modify the EFLAG.
  • the first is to increase the EFLAG bit "horizontal" in each register; the second method is to add a register in the "vertical" of all registers to specifically save the EFLAG bit.
  • the analog flag register 71 is used to simulate the CISC implementing the X86 instruction set.
  • the processor's flag register (EFLAGS) flag bits which indicate the CF bit, PF bit, A bit, ZF bit, SF bit, and OF bit, respectively, from low to high.
  • Step 110 setting the working mode of the RISC processor in the RISC processor to the X86 virtual machine working mode, that is, the analog flag register 71 is available, and the decoder 2 recognizes that the operation is in the X86 virtual machine working mode of the RISC processor, that is, In the analog EFLAGS mode of operation, the analog flag register 71 is then decoded into a source register and/or a destination register according to different instructions;
  • the analog flag register emulates the flag register (EFLAGS) flag of the X86 instruction set.
  • the lower six bits of the register represent the CF bit, PF bit, AF bit, ZF bit, SF bit and low, respectively. OF bit.
  • the analog flag register 71 When the analog flag register 71 is available, it is recognized that the operation is in the X86 virtual machine working mode of the RISC processor, that is, in the analog EFLAGS working mode, the value of the corresponding analog flag register 71 is modified according to the execution result, and then according to different instructions, The analog flag register is decoded as a source register and/or a destination register, and the result may not be saved in the original destination register.
  • the instruction associated with the analog flag register modifies the flag bit of the analog flag register
  • the instruction is preceded by a prefix instruction SETFLAG indicating that the instruction is in the X86 virtual machine working mode of the RISC processor. If the subsequent instruction is in X86 virtual machine mode.
  • the instruction format is: SETFLAG / Analog EFLAGS working mode prefix instruction
  • the instruction to modify the flag of the analog flag register 71 is:
  • the input set of decoder 2 is all possible 32-bit codes, including all legal and illegal instructions.
  • decoder 2 adds a legal input, SETFLAG, indicating that an instruction following the instruction is in the X86 virtual machine operating mode of the RISC processor, ie, the simulated EFLAGS mode of operation.
  • the decoder 2 outputs an instruction according to the analog EFLAGS working mode, and adjusts the internal operation code to the fixed-point operation unit 3 according to the prefix instruction.
  • the destination register of the instruction is decoded.
  • the analog flag register M-EFLAGS
  • one of the source registers is also the analog flag register (M-EFLAGS). Since some operations only modify a part of the analog flag register (M-EFLAGS), the original analog flag register (M-EFLAGS) needs to be sent to the fixed point arithmetic unit 3.
  • the instruction After decoding by the decoder 2, the instruction is output to the fixed-point arithmetic unit 3, and the fixed-point arithmetic unit 3 judges the internal operation code. If it is a normal command, it operates according to the normal procedure; if it is in the simulated EFLAGS working mode, the result is calculated first, and then According to the calculation result and the intermediate result, the analog flag register (M-EFLAGS) flag is set, and the calculation result may not be saved in the target register.
  • M-EFLAGS analog flag register
  • Step 120 During the operation of the RISC processor, when the RISC processor is in the X86 virtual machine operating mode, the analog flag register flag is read and written. The value, and/or control is based on the value of the analog flag register flag.
  • reading and writing the value of the analog flag register flag includes the following steps: Step 121: When the RISC processor is in the X86 virtual machine working mode, extract the value of one or more bits of the analog flag register flag, according to The 8-bit mask value is used to control one or several bits in the analog flag register, and the value of the extracted analog flag register 71 flag is stored in the target register;
  • Step 122 When the RISC processor is in the X86 virtual machine working mode, modify the value of one or more bits of the analog flag register flag, and control one bit in the analog flag register according to the 8-bit mask value. Or a few bits, modify the analog flag register using the value in the source register.
  • the embodiment of the present invention modifies or reads the value of the analog flag register flag by two instructions MTFLAG and MFFLAG, and uses an 8-bit mask to modify or read the corresponding of the analog flag register.
  • Flag bits which respectively write the value of the analog flag register flag and read the value of the analog flag register flag into a specified general-purpose register.
  • the MTFLAG instruction implements the extraction of the value of one or more bits of the analog flag register (M-EFLAGS) flag, and controls the extraction of one of the analog flag registers according to the 8-bit mask value (represented by the immediate value) in the instruction. Bit or number, the value of the extracted analog flag register (M-EFLAGS) flag is stored in the destination register GPR[rt].
  • the analog flag register will be fetched.
  • the second bit is the contents of the AF bit and is placed in the destination register GPR[rt].
  • the MTFLAG instruction directly modifies the value of one or more bits of the analog flag register (M-EFLAGS) flag, and controls the modification of the analog flag register (M- according to the 8-bit mask value (indicated by the immediate value) in the instruction.
  • One or more bits in EFLAGS modify the analog flag register (M-EFLAGS) using the value in the GPR[rs] source register.
  • this instruction repairs the CF, PF, SF, and OF bits in the analog flag register (M-EFLAGS). Set the values of these four bits to 0, 1, 1, and 0, respectively.
  • the control process includes the following steps - step 121', and the analog flag register (M-EFLAG) flag bit is obtained according to the operation result; for example, according to the analog flag register (M-EFLAG) flag bit, directly operated Instructions such as the X86ADD instruction.
  • M-EFLAG analog flag register
  • the X86ADD instruction implements the 32-bit integer in the GPR [rs] register and the 32-bit integer in the GPR [rt] register to produce a 32-bit result.
  • the result is not saved. Only the OF of the analog flag register (M-EFLAGS) is modified according to the result. /SF/ZF/AF/PF bit.
  • Step 122 Perform a branch jump instruction according to one or more bits in the analog flag register (M-EFLAG) flag bit.
  • M-EFLAG analog flag register
  • the X86J instruction implements comparing certain bits of EFLAGS and performs processor-related jumps according to the corresponding conditions.
  • the upper 6 bits (31bit: 26bit) of the 32-bit instruction code of the MIPS64 instruction set are opcode fields.
  • the SPECIAL2 (opcode is 011100) instruction slot can be defined by the user according to the MIPS specification.
  • the new instructions in the embodiment of the present invention are all implemented by using the value of the SPECIAL2 empty slot reserved in the existing MIPS64 instruction set.
  • the RISC processor device supports the data processing method process of the X86 virtual machine when the data processing process of the processor supporting the X86 virtual machine is supported for X86 floating point format and floating point ⁇ in detail.
  • X86 provides a special arithmetic component that supports 80-bit floating-point precision and is a stack operation, which is quite different from RISC processors.
  • the invention realizes support for the floating point format and the floating point stack, and adds a conversion instruction between three 64-bit floating point numbers and 80-bit floating point numbers, and sets an instruction from 80-bit floating-point number to 64-bit floating-point number, from Convert 64-bit floating-point numbers to 80-bit floating-point numbers and set two instructions.
  • 32 general-purpose floating-point registers of the RISC physical register file including the MIPS instruction set are dynamically selected as any of the first-to-three floating-point registers 82 for the conversion work. After the conversion is completed, these three general-purpose registers can be used separately from other general-purpose registers.
  • the first floating point register is configured to store a sign bit and a step of the extended double precision floating point data, occupying the lower 16 bits of the register;
  • the second floating point register is configured to store a mantissa portion of the extended double precision floating point data, which is 64 bits in total;
  • the third floating point register is configured to store double precision floating point data.
  • the RISC processor device supports the data processing method process of the X86 virtual machine, including the following steps.
  • Step 210 dividing the 80-bit extended double-precision floating-point data in the memory into a sign bit and a step part, and a mantissa part, respectively storing them in different first floating point registers and second floating point registers, by using floating point arithmetic parts 4 is converted to 64-bit double-precision floating-point data and stored in the third floating-point register.
  • Step 210 specifically includes the following steps:
  • Step 211 the 80-bit extended double-precision floating-point data in the memory is divided into a sign bit and a step part, and a mantissa part.
  • the 80th to the 64th are the first part, a total of 16 bits, and the 63rd to the 0th are the second part, a total of 64 bits.
  • the user selects an existing read-in method (MIPS provides multiple read-in methods), and reads the two parts into two floating-point registers $f (i) , $f (j );
  • Step 212 The floating point register $f (i) stores the sign bit and the order of the 80-bit extended double-precision floating-point data, occupying the lower 16 bits of the register;
  • Step 213 the floating-point register $f (j) stores the mantissa portion of the 80-bit extended double-precision floating-point data, which is 64 bits in total;
  • Step 214 using the floating point register $f (i) and the floating point register $f (j ) as the source register, the floating point register $f (t) as the target register, the floating point register $f (i) and the floating point
  • the 80-bit extended double-precision floating-point data stored in register $f (j) is converted to 64-bit double-precision floating-point data.
  • the conversion can be performed by the instruction (1).
  • the upper 6 bits (31 bits: 26 bits) of the 32-bit instruction code of the MIPS64 instruction set are opcode fields.
  • the SPECIALS (opcode 011100) instruction slot can be defined by the user according to the MIPS specification.
  • the embodiment of the present invention is defined by the value of the SPECIAL2 empty slot reserved in the existing MIPS64 instruction set.
  • Equation (1) shows that $f ⁇ 3 ⁇ 4, $f (the extended double-precision data represented by the two stack registers is converted to a double-precision number and stored in the stack register $ ⁇ ).
  • the output 64-bit data is stored in the floating-point register $£ (t) to obtain 64-bit double-precision floating-point data.
  • Step 220 Extract 64-bit double-precision floating-point data in the third floating-point register, extract the sign bit and the step part, and the mantissa part, and convert the symbol bit and the step part of the 80-bit floating-point data by the floating-point arithmetic component 4, and
  • the mantissa portion of the 80-bit floating-point data is stored in the first floating-point register and the second floating-point register, respectively, and the 80-bit extended double-precision floating-point data is represented by two registers to obtain 80-bit floating-point data.
  • Step 220 specifically includes the following steps: Step 221, storing a 64-bit double-precision floating-point data into the floating-point register $f (t); Step 222, extracting the sign bit and the step part of the double-precision floating-point data in the floating-point register $£ (t)
  • the conversion can be performed by the instruction (2).
  • the converted step is expanded by 0 to obtain 64-bit floating point data. Since the destination register is 64-bit, only 16-bit data is needed here, but in order to store it in a 64-bit target register $f (i), it is necessary to perform 0-expansion for 48 bits of 16 bits or more. Stored in floating point register f (i);
  • Step 223 extracting the mantissa portion of the floating point register $(t) by 53 bits, converting to the mantissa portion of the 80-bit floating point data, 64 bits, and storing it in the floating point register $f (D).
  • the extraction is done in floating-point arithmetic unit 4, which converts the extracted 53-bit data into 64-bit parts of the 80-bit floating-point data.
  • the conversion can be performed by the instruction (3).
  • the extraction and conversion may be performed in accordance with the relevant provisions of the IEEE 754 standard, and those skilled in the art may implement the conversion of the present invention according to the instruction (2), and therefore, will not be described in detail in the present invention.
  • Step 224 the value of the floating point register $ f (i) is used as the sign bit and the order, the floating point register $ f
  • (j ) The value of (j ) is used as the mantissa to obtain 80-bit extended double-precision floating-point data.
  • the floating point data conversion of the invention enables the processor of the non-X86 architecture to support the special 80-bit floating point data type in the X86, thereby facilitating the binary translation work of the virtual machine, improving the efficiency of the virtual machine and enhancing the compatibility of the processor.
  • the floating-point register number given by the partial floating-point instruction is a relative value, which must be added to the top-of-stack pointer TOP of the floating-point loop stack in the floating-point status word to be the true floating-point register. number.
  • the present invention sets the TOP pointer register 22 in the decoder 2, and maintains a stack enable signal in the floating-point control register 81 in the floating-point physical register file to determine whether or not eight floating-point registers are selected.
  • a stack enable signal used to simulate floating point ⁇ , if the stack enable is set, in the corresponding floating point instruction operation, any register with register number less than 8 will modify its own source or destination logical register number according to the value of TOP during decoding. And modify the TOP value according to the content of the instruction; then send it to the processor; if the stack enable bit is cleared, then in the operation, the register emulation stack is considered to be absent, and the normal work step is performed normally.
  • the floating point control register 81 is configured to control the use of the floating point register file 8 to enable or disable the analog floating point register ⁇ 83.
  • the processor When the enable bit is set, the processor will simulate the floating-point register stack operation of the X86 processor; when the enable bit is set to 0, the processor will not emulate the floating-point register of the X86 processor. ⁇ Operation, the processor operates in accordance with the normal process.
  • 32 floating-point registers of the X86 processor are simulated by using 32 existing floating-point registers numbered 0-31 in the RISC processor.
  • the TOP pointer register 22 is used to maintain a TOP pointer, that is, a stack operation pointer, and stores a value of the TOP pointer.
  • the TOP pointer can be read, written, incremented by 1, or decremented by one.
  • the pointer operation module 41 is configured to operate on the pointer register, simulate the stack operation of the pointer operation of the pointer register when simulating the floating-point register stack operation, and modify and monitor the state of the operation pointer.
  • the serial number is 0 ⁇ 7.
  • the stack enable bit in the floating-point control register 81 is set to 1, it is used in the operation, indicating that the floating-point register stack of the register emulation exists, then any register with a number less than 8 used in the floating-point operation instruction, Both are used as stack registers for floating point registers ⁇ 83 to emulate the floating point register stack of the X86 processor.
  • the pointer operation module then uses the TOP pointer to convert the stack register number, that is, the floating point register number seen by the user is converted with the floating point register number used by the program. For example, the register number refers to the register ST of the i-th unit from the top. (i) Add the TOP pointer value.
  • the floating-point register stack 83 is composed of eight floating-point registers of the RISC processor, passes through the floating-point control register 81, and is simulated.
  • the TOP pointer function of X86 that is, the stack pointer operation function, completes the stack operation of the analog floating point register.
  • the method for simulating floating point chirp operation of the RISC processor supporting the X86 virtual machine of the present invention comprises the following steps:
  • Step 2100 determine whether 8 floating point registers are selected for simulating 8 stack registers in the floating point register stack, simulate floating point register stack operations, and set a pointer register; the step 2100 includes the following steps :
  • Step 2110 selecting one bit in the floating-point control register 81 as a floating-point stack enable bit; when the enable bit is 1, indicating that the floating-point stack of the X86 processor is to be simulated, performing a floating-point stack operation; when the enable position is 0 When it is, it means that the floating-point stack of the X86 processor is not simulated, the floating-point stack operation cannot be performed, and the processor works according to the normal process;
  • Step 2120 setting a pointer register of at least 3 bits, and storing the value of the TOP pointer.
  • the value of the TOP pointer can be read, written, incremented by 1, or decremented by 1.
  • the TOP pointer ranges from 0 to 7.
  • the TOP pointer is pushed into register No. 7 when the stack is pushed, and the value of the TOP pointer is set to 6; if the TOP pointer value is 7, during the impeachment, the TOP pointer value is set to 0 after the stack.
  • the stack grows from top to bottom, that is, the TOP pointer value is decremented by one when the stack is pushed, and the TOP pointer value is incremented by one when popping up, so when the data is stored in the 7th register (that is, to 7)
  • the number of registers is pushed, and the value of the TOP pointer should be decremented by one to six.
  • the TOP pointer value should be incremented by 1 to 8, but since there are only 8 registers from 0 to 7 Therefore, the TOP pointer value is a maximum of 7.
  • the TOP pointer should point to the next register, that is, the 0th register in the loop stack, and the TOP pointer value should become 0.
  • Step 2200 when the floating-point register stack operation is simulated, the pointer register is operated to simulate the stack operation of the stack operation pointer. , modify and monitor the status of the operation pointer.
  • the step 2200 includes the following steps:
  • Step 2210 setting the operation mode, the floating-point stack enable position 1, allowing the user to simulate the floating-point register stack for the floating-point stack operation;
  • setting the analog floating-point stack mode to set the X86 floating-point stack mode can be performed by the following instructions.
  • the memory access extension instruction provided by the present invention uses the reserved value of the empty slot of SPECIAL2 in the MIPS instruction set to define the extended instruction.
  • the enable position 1 operation is completed by the instruction, which sets the X86 floating-point stack mode, allowing the user to use the x86 floating-point stack for floating-point operations.
  • Step 2220 clearing the stack operation mode, the floating-point stack enable position is 0, and the user is not allowed to simulate the floating-point register stack to perform a floating-point stack operation;
  • the embodiment of the present invention clears the floating-point stack mode, and the instruction format of the X86 floating-point stack mode is set to 0: CLRTM
  • the set and clear stack pointer operation instructions can complete the activation and deactivation of the floating point register.
  • step 2230 the value of the stack operation pointer is increased by 1, that is, the value of the TOP pointer is increased by one;
  • the value of the stack pointer is increased by 1, that is, the instruction format of the value of the TOP pointer is increased by one: INCTOP Step 2240, the value of the operation pointer is decremented by 1, that is, the value of the TOP pointer is decreased by 1;
  • the stack pointer value is decreased by 1, that is, the instruction format of the value of the TOP pointer minus 1 is: DECTOP
  • the value of the TOP pointer is increased by one, and the minus one instruction can simulate the stacking and popping work of the X86 processor floating point ⁇ ;
  • Step 2250 reading the operation pointer value, that is, reading the value of the TOP pointer
  • the instruction format for reading the TOP pointer value operation in the embodiment of the present invention is - MFTOP rd
  • Its instruction function is to read the value of the X86 floating-point stack top pointer into the register GPR[rd].
  • step 2260 the write operation pointer value is written, that is, the value of the current TOP pointer is written in the pointer register.
  • the instruction format of the TOP pointer value operation in the embodiment of the present invention is: MTTOP imm
  • Its command function is to write the three-digit immediate imm to the x86 floating-point stack top pointer.
  • the read and write TOP pointer instructions can conveniently control the operation of the floating point stack.
  • the analog X86 floating point stack operation is activated, even if it can be set to 1;
  • $f(9) does not need to be converted; // 9>7 so no conversion is needed, directly use register $9)
  • the final expression for the actual operation is add.s $f(0), $f(3), $f(9 ).
  • the floating-point register stack 83 is composed of 8 stack registers that can directly perform floating-point operations, and is numbered sequentially according to the order, respectively 0 ⁇ 7;
  • the overflow check register 72 is configured to implement the function of the TAG in the floating point flag register of the X86, and to detect floating point access to the stack register in the floating point register stack 83.
  • a ⁇ overflow exception occurs, which is a multi-bit register of at least 8 bits representing the TAG bit, that is, the overflow check function bit, which indicates the state of stack registers 0 to 7 of the floating-point register stack 83, respectively.
  • a general-purpose register r(i) is selected, and the lower 8 bits of the low-to-high state respectively indicate the state of the stack register 0 ⁇ 7 of the floating-point register ⁇ 83.
  • each bit corresponds to a stack register in the floating-point register stack 83, and the value of each bit represents a different state, wherein 0 means empty, can be pushed, cannot be popped, otherwise Overflow; 1 means valid, no more pressure, otherwise it will overflow.
  • the RISC processor of the present invention includes a floating-point register stack 83 consisting of a total of 32 multi-bit floating-point registers of 0 ⁇ 31, wherein 0 ⁇ 7, a total of 8 stack registers , emulating 8 stack registers of X86 floating-point register stack 83; in RISC processor, it also includes a 32-bit general-purpose register (fixed point) r(i), whose low 8 bits represent low-to-high floating-point registers respectively
  • the state of the stack register 0 ⁇ 7 of the stack 83 completes the TAG function in the X86 floating point stack mechanism.
  • the stack overflow judging module 43 is configured to check the stack register in the specified floating point register stack 83, and operate the overflow check register 72 according to the value of the stack register to perform a floating point stack overflow check.
  • the floating stack register stack 83 is composed of 8 stack registers of the RISC processor; Register 72, whose lower 8 bits emulate the X86 TAG function, each bit corresponds to a different state of a stack register.
  • a method for performing a floating-point stack overflow check on a RISC processor supporting an X86 virtual machine includes the following steps:
  • Step 21000 checking the stack register in the specified floating-point register stack, and operating the overflow check register 72 according to the value of the ⁇ register to perform a floating-point stack overflow check;
  • the step 21000 includes the following steps:
  • Step 21100 Determine whether the specified stack register in the floating-point register stack is empty. If it is empty, set the corresponding position of the TAG bit of the specified overflow check register 72 to 1 and continue execution; otherwise, raise a floating-point stack overflow exception. ; Step 21200: determining whether the specified stack register in the floating-point register stack is valid. If valid, the corresponding position of the TAG bit of the specified overflow check register 72 is 0, and continues to execute; otherwise, a floating-point ⁇ overflow exception is triggered;
  • Step 21300 Determine whether the two stack registers specified in the floating-point register stack are valid. If both are valid, and the data in the buffer does not need to be popped, the value of the TAG bit of the specified overflow check register 72 is maintained. And continue to execute; otherwise, raise a floating-point stack overflow exception;
  • Step 21400 Determine whether the two stack registers specified in the floating-point register stack are valid. If both are valid, and there is a stack register, the data in the stack register needs to be popped, and the overflow check register corresponding to the stack register of the data is popped. The position of the TAG bit corresponds to 0, and then continues to execute; otherwise, the floating-point stack overflow exception is raised;
  • Step 21500 determining whether the two stack registers specified in the floating-point register stack are valid, if all are valid, and the data in the ⁇ register needs to be popped, the two corresponding TAG bits of the overflow check register 72 are corresponding. Bits are set to 0 and then resume; otherwise, a floating-point stack overflow exception is raised.
  • the following takes the operation of the floating-point register as an example to further explain the method of floating-point stack overflow check on the RISC processor.
  • the RISC processor determines the dome of the floating point register and reads the TAG bit of the overflow check register 72 corresponding to the stack register of the top of the stack;
  • the RISC processor determines the dome of the floating-point register stack according to the floating-point register of the present invention, and determines the TAG bit of the overflow check register 72 corresponding to the stack register of the corresponding stack top of the present invention, which is an existing
  • the invention is not the invention of the present invention.
  • the above operations can be implemented by those skilled in the art according to the description of the embodiments of the present invention. Therefore, the detailed description is not described in detail in the present invention.
  • the general register r(3) is selected as the lower 8 bits of the overflow check register r(3), that is, bit r(3)_0 ⁇ bit r(3)_7 respectively Corresponds to the state of the stack registers f(0) ⁇ f(7) in the floating-point register ⁇ .
  • bit r(3)—4 of the overflow check register is cleared first, then the data is popped and stored in the specified floating point register.
  • the fifth bit of the overflow check register r(3) is judged, that is, whether bit r(3)-4 is 1;
  • bit r(3)_4 If it is 1, the 5th bit of the overflow check register, that is, bit r(3)_4 is cleared, and then the operation operation is continued;
  • the present invention provides an access operation that supports determining whether an access address is out of bounds, that is, a source register of load and store operations, and a bound register is neither used to calculate an address nor to store data, but is used for accessing The address is compared. If the access address is found to be beyond the boundary specified by the bound register, the address is out of bounds.
  • the address boundary is divided into the upper boundary or the lower boundary.
  • the effective address of the memory access must be guaranteed not to be greater than the upper boundary or not lower than the lower boundary.
  • the upper boundary address register of the physical register file in the embodiment of the present invention is used to store an effective address as an upper bound; and a lower bound address register is used to store an effective address as a lower bound.
  • the upper and lower bound address registers may be any of the general purpose registers in the physical registers.
  • the upper and lower bound determination module is configured to determine, in the memory access instruction, the validity of the instruction operand address according to the upper bound address stored in the upper bound address register and/or the lower bound address stored in the lower bound address register.
  • the judgment of the limit is added. If the access address satisfies the condition, the instruction fetches normally, otherwise the address exception in the MPS is triggered. After the instruction is decoded, the address limit in the register is used as a register operand of the instruction.
  • the effective address is first compared with the address boundary in the register, if the semantic condition of the instruction is met, If the register is an upper bound address register, the effective address is less than or equal to the address limit in the register, or if the register is a lower bound address register, the effective address is greater than or equal to the address limit in the register, then the normal save operation is completed; The address is wrong.
  • a total of 24 access instructions in the MIPS instruction set including a load instruction and a store instruction, are added to the boundary judgment.
  • 12 load instructions including 8 fixed-point instructions, 4 floating-point instructions, and addressing modes are base mode.
  • These instructions are byte fetch with upper boundary condition, fetch byte with lower boundary condition, halfword with upper boundary condition, halfword with lower boundary condition, fetch with boundary condition, take down
  • the word boundary condition, the double word with the upper boundary condition, the double word with the lower boundary condition, the single precision floating point number with the upper boundary condition, the single precision floating point number with the lower boundary condition, and the upper boundary condition One or more combinations of double precision floating point numbers and double precision floating point numbers with lower boundary conditions.
  • GPR[bound] The content in GPR[bound] is the exception of the address exception; otherwise, the 8-bit byte data is fetched from the memory according to the effective address, and the data is extended by the sign bit and stored in GPR[rt].
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs. gsLHGT rt, base, bound
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs. gsLWLE rt, base, bound
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • gsLDLE rt, base, bound First get the effective address from the content of GPR[base]. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued: Otherwise, the 64-bit double word is taken out from the memory according to the aligned effective address to GPR [ Rt].
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs. gsLWLECl ft, base, bound
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • gsLDLECl ft, base, bound First get the effective address from the content of GPR[ba S e]. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued: Otherwise, 64-bit data is fetched from the memory according to the aligned effective address. FPR[ft].
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs.
  • Embodiments of the present invention are defined using the values of the LWC2 and SWC2 slots reserved in the existing MIPS64 instruction set.
  • the upper 6 bits (31 bits: 26 bits) of the 32-bit instruction code of the MIPS64 instruction set are opcode fields.
  • LWC2 (opcode is 110010) and SWC2 (opcode is 111010) instruction slots are user-defined by MIPS.
  • These instructions are memory bytes with upper boundary conditions, memory bytes with lower boundary conditions, halfwords with upper boundary conditions, halfwords with lower boundary conditions, stored words with upper boundary conditions, and tapes.
  • Words with boundary conditions double words with upper boundary conditions, double words with lower boundary conditions, deposit-precision floating-point numbers with upper boundary conditions, deposit-precision floating-point numbers with lower boundary conditions, and storage with upper boundary conditions
  • gsSBLE rt, base, bound First, get the effective address from the content of GPR[base]. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued; otherwise, the 8-bit data content in GPR[rt] is saved to the memory. This is the effective address.
  • gsSBGT rt, base, bound
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs. gsSWLE rt, base, bound
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs. gsSDGT rt, base, bound
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs. gsSWLECl ft, base, bound
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • gsSWGTCl ft, base, bound First get the effective address from the content of GPR[base]. If the effective address is not greater than the content in GPR[bound], the address exception is issued; otherwise, the lower 32-bit data content in FPR[ft] is saved to the memory. The valid address of this alignment.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs.
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs.
  • the address In the instruction that judges the upper and lower bounds at the same time, the address must satisfy both the upper bound condition and the lower bound condition, and a boundary violation exception will be issued once a boundary is not satisfied.
  • the upper and lower bound determination module is configured to determine, in the memory access instruction, the validity of the instruction address according to the upper bound address stored in the upper bound address register and/or the lower bound address stored in the lower bound address register.
  • two instructions are added to the RISC processor MIPS instruction set for register value comparison. These two instructions are used to determine whether the address is out of bounds. If the address satisfies the condition, the operation is empty, otherwise RISC is triggered. The exception is the address in the processor.
  • the invention supports the bounded memory access process of the RISC processor of the X86 virtual machine, and includes the following steps: Step 31: In the X86 virtual machine of the RISC processor, set two general-purpose registers in the physical register file to be upper and lower bound addresses respectively. Register 74.
  • the upper bound address register stores the effective address as the upper bound; the lower bound address register stores the effective address as the lower bound.
  • Step 32 When performing the X86 virtual machine instruction set to the MIPS instruction set translation, the decoder decodes the instruction to obtain a binary code that can be processed by the RISC processor.
  • Step 33 The fixed-point arithmetic unit 3 determines the validity of the instruction operand address based on the upper bound address stored in the upper bound address register and/or the lower bound address stored in the lower bound address register in the decoded memory access instruction.
  • the step 33 includes the following steps:
  • the address limit in the register is used as a register operand of the instruction, and the operation content data forms an effective address according to the base method;
  • Step 332 the effective address is first compared with an address boundary in the register
  • Step 333 if the semantic condition of the instruction is met, that is, if the register is an upper address register, the effective address is less than or equal to the address limit in the register; or if the register is a lower address register, the effective address is greater than or equal to the address boundary in the register , then complete the normal save operation; otherwise, the address exception is raised.
  • step 333 for the operation of taking a load instruction, the shell IJ:
  • the effective address is first obtained from the content of GPR[base]. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued; otherwise, it is valid according to this.
  • the address takes the 8-bit byte data from the memory, and the data is extended by the sign bit and stored in GPR[rt], ie gsLBLE rt, base, bound. If it is a byte-order instruction with a lower boundary condition, the effective address is first obtained from the content of GPR[ba S e].
  • the address exception is issued; otherwise, according to this
  • the effective address takes the 8-bit byte data from the memory, and the data is extended by the sign bit and stored in GPR[rt], ⁇ P gsLBGT rt, base, bound 0. If it is a half-word instruction with a boundary condition, then Get the effective address from the content of GPR[base]. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued; otherwise, the 16-bit halfword data is taken out from the memory according to the aligned effective address. This data is extended by sign bit and stored in GPR[rt], which is gsLHLE rt, base, bound.
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs. If the half-word is taken with the lower boundary condition, the effective address is first obtained from the content of GPR[ba Se ]. If the effective address is not greater than the content in GPR[boimd], the address exception is issued; otherwise, according to the effective address
  • the 16-bit halfword data is taken out of the memory, and the data is extended by the sign bit and stored in GPR[rt], which is gsLHGT rt, base, bound.
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs.
  • the effective address is first obtained from the content of GPR[ba S e], and if the effective address is not less than or equal to the content in GPR[b 0 imd], an address exception is issued; otherwise
  • the 32-bit word data is fetched from the memory according to the aligned effective address, and the data is bit-symbol-extended and stored in GPR[rt], which is gsLWLE rt, base, bound.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If it is a fetching instruction with a lower boundary condition, the effective address is first obtained from the content of GPR[ba S e]. If the effective address is not greater than the content in GPR[bound], the address exception is issued; otherwise, according to this alignment The effective address is taken out of the 32-bit word data, and the data is extended by the sign bit and stored in GPR[rt], S ⁇ gsLWGT rt, base, boimd.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If it is a double-word instruction with a boundary condition, the effective address is obtained from the content of GPR[base] first. If the effective address is not less than or equal to the content in GPR[bound], an address exception is issued: otherwise, according to this alignment
  • the effective address takes the 64-bit double word from memory to GPR[rt], which is gsLDLE rt, base, bound.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs. If the double-word instruction is taken with the lower boundary condition, the effective address is first obtained from the content of GPR[ba Se ]. If the effective address is not greater than the content in GPR[boimd], the address exception is issued: otherwise, according to this alignment The effective address takes the 64-bit double word from memory to GPR[rt], which is gsLDGT rt, base, bound.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs. If it is a single-precision floating-point number with a boundary condition, the effective address is obtained from the content of GPR[ba Se ]. If the effective address is not less than or equal to the content in GPR[bomid], the address is sent out. Otherwise, 32-bit data is fetched from memory according to the aligned effective address and stored in the lower 32 bits of FPR[ft], ie gsLWLECl ft, base, bound.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If the number is a single-precision floating-point number with a lower boundary condition, the effective address is obtained from the content of GPRCbase]. If the effective address is not greater than the content in GPR[bound], the address exception is issued; otherwise, the alignment is valid. The address is taken from the memory and 32 bits of data are stored in the lower 32 bits of FPR[ft], ⁇ P gsLWGTCl ft, base, bound.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If the double-precision floating-point number is taken with the upper boundary condition, the effective address is obtained from the content of GPR[ba S e] first. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued: otherwise This aligned valid address fetches 64-bit data from memory to FPR[ft], which is gsLDLECl ft, base, bound.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs. If the double-precision floating-point number is taken with the lower boundary condition, the effective address is first obtained from the content of GPR[b aSe ]. If the effective address is not greater than the content in GPR[boimd], the address exception is issued: otherwise, according to this alignment The effective address is taken from memory and stored in 64-bit data to FPR[ft], which is gsLDGTC 1 ft, base, bound.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs.
  • the shell If it is a byte instruction with a boundary condition, the effective address is first obtained from the content of GPR[ba Se ]. If the effective address is not less than or equal to the content in GPR[boimd], an address exception is issued; otherwise, GPR is issued.
  • the 8-bit byte data content in [rt] is saved to the effective address in memory, ie gsSBLE rt, base, bound. If it is a byte instruction with a lower boundary condition, the effective address is first obtained from the content of GPRtbase].
  • GPR[rt] is The 8-bit byte data content is saved to the effective address in memory, ie gsSBGT rt, base, bound. If it is a half-word instruction with a boundary condition, the effective address is obtained from the content of GPR[ba S e]. If the effective address is not less than or equal to the content in GPR[bound], the exception is issued; otherwise, the 16-bit half-word data content in GPR[rt] is saved to the aligned effective address in memory, ⁇ gsSHLE rt, Base, bound.
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs. If it is a half-word instruction with a lower boundary condition, the effective address is first obtained from the content of GPR[base]. If the effective address is not greater than the content in GPR[boimd], the address exception is issued; otherwise, GPR[rt The 16-bit half-word data content in ] is saved to the aligned effective address in memory, ie gsSHGT rt, base, bound.
  • the effective address is aligned, and if any one of the lower 1-bit addresses is non-zero, an address error exception occurs. If it is a stored word instruction with a boundary condition, the effective address is first obtained from the content of GPR[base]. If the effective address is not less than or equal to the content in GPR[boimd], the address exception is issued; otherwise, GPR[rt The 32-bit word data content in ] is saved to the aligned effective address in memory, ie gsSWLE rt, base, bound.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If it is a word-sending instruction with a lower boundary condition, the effective address is first obtained from the content of GPR[ba S e]. If the effective address is not greater than the content in GPR[boimd], an address exception is issued; otherwise, GPR is [ The 32-bit word data content in rt] is saved to the aligned effective address in memory, ie gsSWGT rt, base, bound.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If it is a double word instruction with a boundary condition, the effective address is obtained from the content of GPRCbase] first. If the effective address is not less than or equal to the content in GPR[bound], the address exception is issued; otherwise, GPR[rt] The 64-bit double word content is saved to the aligned valid address in memory, ie gsSDLE rt, base, bound.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs. If it is a double word instruction with a lower boundary condition, the effective address is first obtained from the content of GPR[ba S e]. If the effective address is not greater than the content in GPR[bound], the address exception is issued; otherwise, GPR is issued.
  • the 64-bit double word content in [rt] is saved to the aligned effective address in memory. That is gsSDGT rt, base, bound.
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs. If it is a deposit-precision floating-point number with a boundary condition, the effective address is obtained from the content of GPR[base] first. If the effective address is not less than or equal to the content in GPR[boimd], an address exception is issued; otherwise, FPR is [ The lower 32-bit word data content in ft] is saved to the aligned effective address in memory, gs gs gsSWLECl ft, base, boundo
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If it is a deposit-precision floating-point number with a lower boundary condition, the effective address is first obtained from the content of GPR[ba Se ]. If the effective address is not greater than the content in GPR[bound], an address exception is issued; otherwise, FPR is [ The lower 32-bit word data content in ft] is saved to the aligned effective address in memory, ie gsSWGTCl ft, base, bound.
  • the effective address is aligned, and if any one of the lower 2-bit addresses is non-zero, an address error exception occurs. If it is a double-precision floating-point number with a boundary condition, the effective address is obtained from the content of GPR[ba Se ] first. If the effective address is not less than or equal to the content in GPR[bound], the address is sent out by mistake; Otherwise, the 64-bit double word content in FPR[ft] is saved to the aligned effective address in memory, ie gsSDLECl ft, base, bound.
  • the effective address is aligned, and if any one of the lower 3 bit addresses is non-zero, an address error exception occurs. If it is a double-precision floating-point number with a lower boundary condition, the effective address is first obtained from the content of GPR[ba Se ]. If the effective address is not greater than the content in GPR[bound], an address exception is issued; otherwise, FPR is issued. The 64-bit double word content in [ft] is saved to the aligned effective address in memory, ie gsSDGTC 1 ft, base, bound.
  • the effective address is aligned, and if any one of the lower 3-bit addresses is non-zero, an address error exception occurs.
  • the step 33 further includes the following steps:
  • step 334 in the instruction for simultaneously determining the upper and lower bounds, the address satisfies both the upper bound condition and the lower bound condition, and an out-of-bounds exception is issued once a boundary is not satisfied. More preferably, after the step S300, the following steps are further included:
  • Step 34 In the memory access instruction, determine the validity of the instruction address according to the upper bound address stored in the upper bound address register and/or the lower bound address stored in the lower bound address register.
  • the step 34 includes the following steps: Step 341, in the fetch operand (load) instruction, compare the general-purpose register GPR [rs], that is, the upper bound address register and the general-purpose register GPR [rt], that is, the value in the lower bound address register, if the value in GPR [rs] Less than or equal to the value in GPR [rt], the next instruction is executed sequentially; otherwise, adel is generated, ⁇ gsLE rs, rt.
  • Step 342 In the write operation (store) instruction, compare the general-purpose register GPR [rs], that is, the upper bound address register and the general-purpose register GPR [rt], that is, the value in the lower bound address register, if the value in GPR [rs] Greater than the value in GPR [rt], the next instruction is executed sequentially; otherwise, the add exception is raised, ie gsGT rs, rt.
  • the bounded memory access method of the RISC processor of the present invention in the virtual machine supported by the RISC processor, translates from the X86 virtual machine instruction to the binary code of the MIPS instruction set, and improves the running speed when running on the RISC processor, and The impact on the speed of the virtual machine will be reduced, and the operating efficiency of the virtual machine will be improved.
  • the RISC processor device supports the data processing method process of the X86 virtual machine when the processor supports the data processing of the X86 virtual machine to support the virtual mechanism.
  • the X86 general-purpose registers have been mapped to the fixed MIPS registers, but when the virtual machine code and the translated MIPS code are switched between contexts, the values of these fixed MIPS registers need to be saved or restored to ensure These registers are free to use in both contexts without interfering with each other.
  • the present invention provides a memory access extension instruction having a data width of twice the original data width, which can also be used to improve performance while speeding up virtual machine context switching.
  • the RISC processor pattern recognition module 24 supporting the X86 virtual machine of the present invention includes a memory access instruction for multiple data widths.
  • the multiple data width memory access instruction includes a read data memory of multiple data widths, a write memory, and a read data memory of a multiple data width of the floating point register, and a total of four types of data width write memory. Save the extension instruction.
  • W 200 is an implementable manner, and the present invention proposes four multiple data width memory access extension instructions, including double data width read memory, write memory instruction, and double data width to floating point register. Read memory, write memory instructions.
  • the multiple data width extension instruction provided by the present invention utilizes the values of the LWC2 and SWC2 slots reserved in the existing MPS64 instruction set, wherein the upper 6 bits of the 32-bit instruction Olbit: 26 bits are opcode fields.
  • the LWC2 (opcode is 110010) and SWC2 (opcode is 111010) instruction slots are MIPS-defined and can be defined by the user.
  • the addressing mode of the memory access is the addressing mode of base+8 bits offset.
  • the 5-bit base field represents the base address
  • the 5-bit rt (Register Target (Source/Destination)) field represents the source/destination register
  • the offset represents the offset address
  • the last 6-bit fonc field is used to distinguish each extended instruction.
  • the four extended instructions of the present invention are custom instructions that are extended to the user in the MIPS64 instruction set.
  • the decoder outputs an internal sq operation;
  • the decoder For the fetch instruction LQ, the decoder outputs two adjacent internal operations lql and lq2, where lql has the lower 64-bit logical register number of the LQ instruction and lq2 has the high 64-bit logical register number of the LQ instruction.
  • the decoder 2 decodes the instruction and sends it to the transmission queue (not shown) of the memory access execution unit 5, and the transmission queue selects the operation prepared by the operand, and transmits it to the memory access unit of the memory access execution unit 5 (not show) .
  • the fetch unit of the fetch execution unit 5 merges the two internal operations as they enter the transmit queue.
  • the method of merging is to find that if the two operations that are to enter the queue are four-word 128-bit fetch instructions, the latter operation does not enter the transmit queue, but the destination physical register number is stored before The upper 64 bits of the physical register number of an operation.
  • the merged fetch operation has two destination physical register numbers that are transmitted to the fetch unit of the fetch execution unit 5 when the address is determined (corresponding to the source physical register ready).
  • the fetch execution unit 5 is a component that executes access data, which fetches data from the memory or stores the data in the memory according to the instruction. This process is an existing standard technology and will be apparent to those skilled in the art, and therefore, it will not be described in detail in the embodiments of the present invention.
  • the following describes the double data width read memory, the write memory instruction, and the read data memory and write memory instructions of the double data width of the floating point register:
  • rt If rt is even, it is stored in registers rt and rt+1; if rt is odd, it is stored in registers rt-1 and rt.
  • ft If ft is even, it is stored in registers ft and ft+1; if ft is odd, it is stored in registers ft-1 and ft.
  • the effective address is aligned. If any of the lower 4 bits is non-zero, an address error occurs.
  • the signed 8-bit offset and the contents of GPR[ba Se ] are first added to obtain the effective address, and then the four words in the adjacent two general-purpose registers are stored in the effective address in the memory.
  • the effective address is aligned. If any of the lower 4-bit addresses is non-zero, an address error exception occurs. gsSQCl ft, offset(base) / save four words from the floating point register to the memory The signed 8-bit offset and GPR[bas e ] contents are first added to obtain the effective address, and then the four words in the adjacent two floating-point registers are stored in the effective address in the memory. If ft is even, the values in registers ft and ft+1 are fetched into memory; if ft is odd, the values in registers ft-1 and ft are fetched into memory.
  • the effective address must be aligned. If any of the lower 4-bit addresses is non-zero, an address exception exception occurs.
  • the data fetching method of the RISC processor supporting the X86 virtual machine of the present invention comprises the following steps:
  • Step N110 the processor first takes out an instruction input to the decoder
  • Step N120 the decoder determines the instruction type, identifies and decodes the multiple data width instruction; if it is an instruction in the existing MIPS instruction set, the decoder translates it into an internal operation, such as giving a corresponding OP, source Registers and target registers, etc.
  • the decoder automatically expands the source/or destination register into one of two pairs of registers
  • rt If rt is even, it is stored in registers rt and rt+1; if rt is odd, it is stored in registers rt-1 and rt.
  • the decoder automatically expands the target register from one adjacent register to a plurality of adjacent registers, and allocates the read operation to multiple internal operations, multiple pairs
  • the registers are the target registers for these multiple internal operations.
  • the decoder expands the source register from one to a plurality of adjacent registers.
  • the processor first takes an instruction input to the decoder, and the decoder determines the instruction type. If it is an instruction in the original MIPS instruction set, the decoder translates it into an internal operation, for example, giving a corresponding operation (OP). The source register device and the target register are output to the storage operation unit for execution; if the input instruction is a storage operation in the memory access extension instruction proposed by the present invention, the decoder automatically expands the source/target register from one to two. The pair of registers is then output to the storage arithmetic unit for execution.
  • the decoder determines the instruction type. If it is an instruction in the original MIPS instruction set, the decoder translates it into an internal operation, for example, giving a corresponding operation (OP).
  • the source register device and the target register are output to the storage operation unit for execution; if the input instruction is a storage operation in the memory access extension instruction proposed by the present invention, the decoder automatically expands the source/target register from one to two. The pair of registers is then output
  • the processor first takes an instruction input to the decoder, and the decoder determines the type of the instruction and converts it into an internal operation.
  • the coding of internal operations is more regular than the instructions of the processor's features, which helps to simplify internal logic.
  • usually external instructions to internal operations are one-to-one mapping.
  • the internal operation of the decoder output consists of several fields, such as opcode (op), extended opcode (felt), source register number, destination register number, immediate value, and so on.
  • Step N130 the decoded multiple data width instruction is sent to the memory access execution unit 5 to perform an operation.
  • the decoder After the decoder decodes the input instruction, it sends it to the memory access execution unit 5.
  • the memory access execution unit 5 if it is a read operation instruction, the two internal operations lql and lq2 of the read operation instruction LQ are merged into one. The operation is sent to the memory access unit of the memory access execution unit 5 for execution.
  • the decoder 3 expands the source register number from one to two pairs of register numbers. For example, the 4th register is expanded into 4 and 5 register numbers; the 7th register is expanded into 6, 7 and 2. The two source register numbers as internal operations are sent to the transmit queue of the fetch execution unit 5.
  • the decoder decodes the read operation into two internal operations, and the target register is also automatically extended from one to two pairs of registers. Then, it is assigned to the above two internal operations, and the output is executed to the memory access execution unit 5, and then merged into one operation and sent to the memory access unit of the memory access execution unit 5 for execution.
  • the decoder expands the target register number from one to two pairs of register numbers. And split into two adjacent internal operations lql, lq2, respectively with these two target register numbers, sent to the transmit queue of the memory access execution unit 5.
  • the fetch execution unit 5 receives the internal operations from the decoder and selects those fetched components that are prepared to the fetch execution unit 5 in which the source physical registers are prepared.
  • the LQ instruction is transmitted to the fetching component as a fetch operation, so the merge of the two internal operations is completed by the merge module of the fetch execution unit 5.
  • the method is to store the destination physical register of lq2 in the high 64-bit physical register of the lql operation, and lq2 itself does not enter the transmit queue.
  • the memory access unit performs a memory access operation. For lql, there are two value fields in the result, which are respectively written into the corresponding physical registers.
  • Support for X86 virtual machines on RISC processors requires an instruction to distinguish whether it is in the original instruction set mode or in X86 mode.
  • the processing of the addition in the PS instruction set is to perform the addition operation of two numbers.
  • the addition instruction not only calculates the addition of two operands, but also modifies the flag bits in the corresponding EFLAG according to the result of the addition.
  • the present invention is directed to the above problem and provides a method for distinguishing whether a RISC instruction is operating in an X86 virtual machine mode.
  • the present invention provides three different ways of distinguishing:
  • Control bit flag execution method The present invention sets a special control bit x86mode flag in the RISC processor. When the bit is 1, it indicates that the corresponding instruction runs at x86 mode at this time; when the flag is 0, it indicates an instruction. Run in non-X86 mode.
  • Prefix instruction execution method The present invention adds a prefix instruction SETFLAG, indicating that the subsequent instruction is in X86 mode.
  • SETFLAG indicating that the subsequent instruction is in X86 mode.
  • Dedicated instruction method In the present invention, for an X86 instruction having a particularly high command frequency, it is necessary to set a special instruction in the instruction set to perform one-to-one correspondence to improve efficiency.
  • the set instructions can be classified into two categories: one for the X86 instruction set and the EFLAG flag related instructions, and the other for the special structure of the X86 instruction set, such as floating point.
  • the instruction of the stack operation performs the corresponding instruction, and the newly added instruction provides a special instruction to partially support the X86 instruction to reduce the corresponding overhead.
  • the pattern recognition module 24 of the RISC processor device supporting the X86 virtual machine of the present invention is used to distinguish the virtual machine instruction set mode of the instruction.
  • the decoder in addition to the prior art data path, the decoder includes a decoded input and output, and an instruction decoding function, and can also distinguish the virtual machine instruction set mode of the instruction according to the pattern recognition module 24. Then, the decoder decodes the instruction according to the differentiated virtual machine instruction set mode and outputs it to the fixed point operation unit 3, which enhances the function of the existing decoder and directly decodes, thereby improving the operation speed of the processor.
  • the fixed point arithmetic unit 3 After receiving the decoding command, the fixed point arithmetic unit 3 performs processing and outputs the result of the execution.
  • the fixed point operation unit 3 can also distinguish the instruction set mode by the decoder 2, and the fixed point operation unit 3 performs the corresponding according to different instruction modes. The calculation, the output is executed as a result. (One)
  • the pattern recognition module 24 of the RISC processor device of the present invention is a virtual machine mode control register 73, and the virtual machine mode control register 73 includes a control bit flag X86MODE1 when the bit is 1 The time indicates that the corresponding instruction runs in the X86 virtual machine instruction set mode; when the flag is 0, it indicates that the corresponding instruction is running in the non-X86 virtual machine instruction set mode.
  • some CoprocessorO (CP0) control registers are reserved for user-defined.
  • the 22nd register is reserved for the user in the case of all Sel bits.
  • the embodiment of the present invention utilizes one of these control registers (CP0) to perform the X86 mode control flag bit X86MODE1. When it is necessary to distinguish the mode in which the instruction is located, it can be judged by reading the corresponding bit of the control register. When the flag is 1, it indicates that the corresponding instruction is running in the X86 virtual machine instruction set mode. When the flag is 0, it indicates that the corresponding instruction is running in the non-X86 virtual machine instruction set mode.
  • the decoder 2 When the RISC processor fetches instructions and is decoded and executed by the decoder 2, the decoder 2 first reads the control bit flag X86MODE1 of the virtual machine mode control register 73, according to the virtual value of the flag bit being 0 or 1. The machine instruction set mode is decoded in its virtual machine instruction set mode until the control bit flag X86MODE1 of the virtual machine mode control register 73 is overwritten.
  • the RISC processor determines the corresponding control register to distinguish it from the X86 virtual machine instruction set mode or the non-X86 virtual machine instruction set mode.
  • the flag operation module 32 of the fixed point operation unit 3 is configured to perform an operation according to the input instruction, and then calculate a corresponding EFLAG flag bit according to the operation result.
  • the RISC processor device of the present invention is a prefix instruction decoding module 241 included in the decoder, and the prefix instruction decoding module 241 includes a prefix instruction.
  • SETFLAG is used to indicate that multiple instructions after the prefix instruction are in the X86 virtual machine instruction set mode.
  • the prefix instruction in the prefix instruction decoding module 241 of the embodiment of the present invention is implemented by using the reserved value of the empty slot of the SPECIAL2 in the MIPS instruction set.
  • the prefix instruction decoding module 241 of the decoder 2 sets a flag when decoding the prefix instruction, and the instruction following the instruction is translated into an X86 virtual machine instruction set mode, and then the prefix instruction is translated into a null operation NOP.
  • the prefix instruction SETFLAG includes a range parameter for indicating a range of influence of the prefix instruction SETFLAG, which may be 1, indicating that the prefix instruction only affects one subsequent instruction; or n, indicating the prefix instruction Affects the subsequent n instructions.
  • a range parameter for indicating a range of influence of the prefix instruction SETFLAG which may be 1, indicating that the prefix instruction only affects one subsequent instruction; or n, indicating the prefix instruction Affects the subsequent n instructions.
  • the prefix instruction counter 242 of the decoder 2 is used to record the instruction number ⁇ of the instruction sequence affected by the prefix instruction and without the branch instruction;
  • is decremented by 1 when the next instruction enters the decoder 2.
  • the branch instruction is not allowed in the instruction sequence, that is, the instruction sequence starting from the branch instruction is not affected by the prefix instruction once the branch instruction occurs.
  • the exception processing module 34 of the fixed-point arithmetic component 3 is configured to use an exception with the delay slot if the prefix instruction only affects one instruction immediately after the prefix instruction.
  • the bd bit of the Cause register is set, and the EPC is pointed to the prefix instruction, and the prefix instruction is re-executed after the exception service program is completed.
  • the prefix exception control register 33 of the fixed point operation component 3 is configured to record whether an instruction in which an exception occurs is affected by the prefix instruction.
  • the count of the current instruction is stored in the prefix exception control register 33; when the interrupted process is returned to the abnormal end, the count recovery according to the previous prefix exception control register 33 is interrupted according to the count. The state of the process.
  • the flag operation module 32 of the fixed point operation unit 3 is configured to perform an operation according to the input instruction for the instruction in the virtual machine instruction set mode, and then calculate a corresponding EFLAG flag according to the operation result. (three)
  • the pattern recognition module 24 is an instruction processing module 21 for marking a virtual machine instruction set mode of the instruction in the MIPS instruction of the RISC processor.
  • the instruction is the X86 virtual machine instruction set mode, which is directly executed by the RISC processor's MIPS instruction set to reduce the corresponding overhead.
  • the instruction affected by the instruction processing module 21 can only affect the decoding execution of the instruction, but does not affect other instructions. Other instructions are executed according to their original virtual instruction set mode.
  • the MIPS instruction of the RISC processor includes a virtual machine instruction corresponding to an instruction related to the EFLAG flag in the X86 instruction set, and an instruction corresponding to a special structure such as floating point ⁇ in the X86 instruction set. Virtual machine instructions.
  • the add instruction (Add) of the instruction processing module 21 to the RISC processor indicates that the virtual machine instruction set mode of the instruction is the X86 virtual machine instruction set mode X86Add, which can utilize the reserved value of the empty slot of the SPECIAL2 in the RISC processor MIPS instruction set. achieve.
  • This instruction is not the same as the original Add instruction. It only provides partial support for the original instruction. It adds the values in the register and also modifies the corresponding EFLAGS flag according to the result. , but the result of the calculation is not stored in the register, ie the value of the register does not change.
  • the multi-mode data processing method of the RISC processor device supporting the X86 virtual machine of the present invention comprises the following steps:
  • Step N210 When reading the instruction, distinguish the virtual machine instruction set mode of the instruction.
  • the step N210 includes the following steps:
  • Step N211 the decoder reads a prefix instruction SETFLAG, indicating that the plurality of instructions after the instruction are in the X86 virtual machine instruction set mode, and distinguishes the virtual machine instruction set mode of the instruction;
  • the prefix instruction SETFLAG further includes a range parameter indicating the range of influence of the prefix instruction SETFLAG, which may be 1, indicating that the prefix instruction only affects one subsequent instruction; or n (n ⁇ 1), indicating that the prefix instruction affects The next n instructions.
  • a range parameter indicating the range of influence of the prefix instruction SETFLAG, which may be 1, indicating that the prefix instruction only affects one subsequent instruction; or n (n ⁇ 1), indicating that the prefix instruction affects The next n instructions.
  • the flag is set when the prefix instruction is decoded.
  • the instruction following this instruction is translated into the X86 virtual machine instruction set mode, and then the prefix instruction is translated as a null operation NOP.
  • the step N210 includes the following steps:
  • Step N210' when the instruction enters the decoder 2, the control bit flag of the virtual machine mode control register 73 X86MODE1 distinguishes the virtual machine instruction set mode of the instruction.
  • the step N210' includes the following steps:
  • Step ⁇ 21 ⁇ determining the control bit flag X86MODE of the virtual machine mode control register 73; Step N212', when the flag bit is 1, it indicates that the corresponding instruction is running in the X86 virtual machine instruction set mode;
  • Step N213' when the flag is 0, it means that the corresponding instruction is running in the non-X86 virtual machine instruction set mode.
  • the step N210 includes the following steps:
  • Step N211 the decoder reads the instruction, and according to the virtual machine instruction set mode of the flag in the instruction, distinguishes the virtual machine instruction set mode of the instruction.
  • Step N220 During the instruction decoding process, the decoder outputs the instruction to the fixed-point operation component of the RISC processor according to the differentiated virtual machine instruction set mode according to the virtual machine instruction set mode of the differentiated instruction. 3 ;
  • the step N220 further includes the following steps:
  • Step N222 the prefix instruction counter 242 in the decoder records the instruction number n of the instruction sequence affected by the prefix instruction and does not appear the conversion instruction ;
  • n is decremented by 1.
  • the branch instruction is not allowed in the instruction sequence, that is, the instruction sequence starting from the branch instruction is not affected by the prefix instruction once the branch instruction occurs.
  • step N220 decoder performs decoding, including the following steps:
  • Step ⁇ 22 ⁇ when the RISC processor fetches instructions and is decoded and executed by the decoder 2, the decoder first reads the control bit flag X86MODE1 of the virtual machine mode control register 73, and the value according to the flag bit is 0 or 1.
  • the virtual machine instruction set mode is decoded in its virtual machine instruction set mode until the control bit flag X86MODE1 of the virtual machine mode control register 73 is overwritten.
  • Step N230 the fixed-point arithmetic unit of the RISC processor performs processing according to the output of the decoder, and outputs the result of the execution.
  • Step SN231 since the decoder decodes the prefix instruction into an internal null operation NOP, the fixed point operation component executes the NOP instruction;
  • the step N230 comprises the following steps:
  • Step N232 When the prefix instruction affects only one instruction immediately after the prefix instruction, if an execution exception occurs, the bd (Branch delay) bit of the Cause register is set in the same manner as the delay slot exception, and the EPC is simultaneously (The Exception Program Counter) points to the prefix instruction, and the exception service is re-executed after the exception service is completed.
  • the EPC register holds the entry address where the processor continues its original operation when the exception service is executed.
  • Step N233 the fixed point operation unit uses the prefix exception control register 33 to record whether the instruction in which the exception occurred is affected by the prefix instruction when the prefix instruction affects n instructions.
  • the count of the current instruction is stored in the prefix exception control register 33 when an abnormality occurs and the process is interrupted.
  • the interrupted process is returned to the abnormal end, the state of the interrupted process is restored based on the count, that is, based on the count held by the previous prefix exception control register 33.
  • Step N234 the fixed point operation unit performs an operation according to the input instruction, and then calculates a corresponding EFLAG flag bit output according to the operation result.
  • the data processing method of the RISC processor device of the present invention is multi-mode by means of a prefix instruction:
  • a prefix instruction enters the decoder
  • the next instruction that is, when the addition instruction enters the decoder, judges whether the prefix flag bit exists.
  • the decoder normally decodes the source register and the destination register with the instruction itself and the internal Operation opcode (op); If the addition instruction is within the prefix instruction parameter range, that is, the addition instruction in X86 mode, the EFLAGS flag is modified according to the calculation result according to the X86 virtual machine instruction set mode, so the decoder The EFLAGS flag is decoded into one of the source registers, and the EFLAGS flag is decoded into the target register. The source and destination registers of the addition instruction itself and the internal operation opcode (op) are also added.
  • the fixed-point arithmetic component takes the output of the decoder as an input, and if it is an instruction in the normal MIPS instruction set, performs an addition calculation; if it is an addition instruction affected by the prefix instruction, the fixed-point arithmetic component performs the addition calculation first, and then adds according to the addition. The result of the operation computes the value of the new EFLAGS flag.
  • the core is a process of translation or interpretation, that is, a process that can be executed on a local processor by translating or interpreting the cost code from the target code.
  • the virtual machine encounters the jump instruction, and needs to convert the instruction address of the X86 source program into the instruction address of the corresponding PS target program, and then implement the jump according to the instruction address of the target program.
  • the invention adds a structure capable of resolving a source instruction address (X86 instruction address) to a target instruction address (MIPS instruction address) mapping lookup table in the RISC processor, speeding up conversion from a source instruction address to a target instruction address, thereby improving the virtual machine. performance.
  • the lookup table module 23 of the RISC processor supporting the X86 virtual machine in the embodiment of the present invention is configured to implement conversion from an X86 source instruction address to a MIPS target instruction address by using a lookup table.
  • the invention has a lookup table on the hardware, which can quickly search for the translation of the jump address to the MIPS jump address in the X86 program, and improve the performance of the virtual machine.
  • the lookup table may be a content-addressable lookup table, and is implemented by a content-addressable memory/random access memory (CAM/RAM).
  • CAM/RAM content-addressable memory/random access memory
  • the RAM inputs an address and outputs the data in the corresponding address;
  • the CAM is the input content, and outputs the index number of the unit storing the content or the content of another unit associated with the index number.
  • the lookup table may be a content-addressed lookup table that implements X86 jump address translation to MIPS transfer address translation, ie, conversion from an X86 source instruction address to a MIPS target instruction address in an X86 virtual machine of a RISC processor. Its entries are shown in Table 1. Table 1 lookup table entries
  • the X86 Source Instruction (SPC) to MIPS Target Instruction Address (TPC) conversion uses three domains: the ASID field, the SPC domain, and the TPC domain.
  • the ASID field is used to store the ID number of multiple X86 VM processes started on the operating system. When these X86 virtual machine processes need to use the lookup table, they use the operating system to assign their assigned ID numbers (ASIDs) so that they do not interfere with each other;
  • the SPC domain is used to store the X86 source instruction address
  • the TPC domain is used to store the MIPS target instruction address
  • the ASID and SPC fields are located in the address portion (CAM) of the lookup table, and the TPC is located in the storage portion (RAM) of the lookup table.
  • the lookup table module 23 searches, the ASID of the current X86 virtual machine process and the SPC given by the table lookup instruction form the "address" part of the lookup table, and are sent to all the entries, and each entry stores its own stored ASID, SPC and The input is compared, and if it matches, the TPC stored therein is output. Therefore, as far as the X86 virtual machine process of the RISC processor is concerned, as long as the X86 source instruction address that it wants to find is input, the corresponding MIPS target instruction address can be found from the lookup table 23.
  • the values of the SPC domain and the TPC domain in the lookup table are initialized by the virtual machine at initialization, and the value of the ASID field is given by the local operating system.
  • the lookup table module 23 is implemented by four instructions for accessing or modifying the lookup table structure.
  • Instruction one CAMPV instruction.
  • the instruction queries the lookup table RAM table entry value;
  • the content in RAM is obtained.
  • the lookup table is indexed according to the content in the general register GPR [rs]. If it hits, the contents of the corresponding RAM are stored in the destination register GPR [rd]; if the entry is not hit, the entry address of the missed service program is stored in the destination register GPR [rd].
  • the execution process of the instruction is the flow of execution of the entire processor instruction, including instruction fetching execution, etc., and the component it accesses is the lookup table mentioned above.
  • Instruction 2 CAMPI instruction.
  • the format of the instruction is as follows:
  • the index (index) of the entry of the content is obtained.
  • the lookup table is indexed according to the contents of the general register GPR [rs]. If it hits, the index of the corresponding entry is stored in the destination register GPR [rd]; if the entry is not hit, the highest position of the destination register rd is set to 1.
  • the execution process of the instruction is the flow of execution of the entire processor instruction, including instruction fetching execution, etc., and the component it accesses is the lookup table mentioned above.
  • Instruction three CAMWI instruction.
  • the instruction fills in the lookup table based on the index (index) of the lookup table RAM entry.
  • the format of the instruction is as follows:
  • the execution process of the instruction is the flow of execution of the entire processor instruction, including instruction fetching execution, etc., and the component it accesses is the lookup table mentioned above.
  • Instruction four RAMRI instruction. The instruction reads the contents of the lookup table RAM table entry according to an index (index) of the lookup table RAM entry;
  • the contents of the RAM of the lookup table are read according to the value of GPR [rs].
  • the contents of the RAM of the lookup table are read according to the index value in the general register GPR [rs] and stored in the destination register GPR [rd].
  • search miss that is, when the lookup table is unsuccessful, that is, the pair of SPC-TPCs in the lookup table does not have the corresponding process expectation; the corresponding processing.
  • the miss service routine is an existing routine and is an existing standard technology of the RISC processor of the MIPS instruction set, and thus will not be described in detail in the embodiment of the present invention.
  • the entry address of the miss service program is saved by using a CP0 register CAM.default, and a default value is provided by the virtual machine, and is stored in the CP0 register CAM.default as a miss service program. Entrance address.
  • the lookup table is not hit, the default value stored in CAM.default is sent to the target register, so that the table lookup program can jump to the MIPS instruction address in the case of a hit; In the case, jump to the entry address of the missed service program, and then fill in the lookup table with the corresponding address found by the miss service program. This also avoids adding a branch instruction after the table lookup to determine whether it hits.
  • the jump can be realized by using the direct jump instruction JR rs in the existing MIPS64.
  • rs is the register placed by the target address.
  • the entry address of the miss service program may be stored in item 0 of the lookup table entry instead of a control register in the first embodiment.
  • VJR a new instruction
  • the content of the general-purpose register No. 31 is used as the SPC look-up table.
  • the instruction function of VJR is similar to the function of the two instructions of CAMPV+JR in the first method.
  • the contents of the RAM of the lookup table are read according to the value of the general-purpose register No. 31.
  • the contents of the RAM of the lookup table (that is, the translated target address) are read according to the value in the general register GPR [31].
  • the search is successful, it is stored in the destination register GPR [rt].
  • the instruction then jumps to the target address based on the value of the rt register; otherwise, the RAM contents of the 0th entry in the lookup table are stored in the destination register GPR [rt].
  • the instruction jumps to the miss service routine according to the value of the rt register.
  • the execution process of the instruction is the flow of execution of the entire processor instruction, including instruction fetching execution, etc., and the component it accesses is the lookup table mentioned above.
  • the value of the source instruction address is placed in a fixed register (such as register No. 31) by an instruction before the instruction, such as the JMP mx instruction in X86;
  • the VJ instruction looks up the table according to the value in the fixed register. If it hits, it directly converts to the code segment pointed to by the target instruction address. If it does not hit, it directly jumps to the 0th of the lookup table. Item, then jump to miss the server.
  • the instruction address conversion lookup process of the RISC processor device supporting the X86 virtual machine of the present invention is described in detail below, including the following steps:
  • Step N310 when the X86 virtual machine of the RISC processor is started, initialize the lookup table, and fill in the lookup table by using the obtained X86 virtual machine instruction address to the content of the MIPS instruction address;
  • the missed service program is used to initialize the corresponding X86 instruction address to the MIPS instruction address by the CAMPI instruction and the CAMWI instruction according to the contents of the hash table maintained by the miss service program. table.
  • the jump instruction of the X86 virtual machine of the RISC processor accesses the lookup table because it needs to complete the conversion from the X86 source instruction address to the target instruction address;
  • the step N320 includes the following steps:
  • Step N321 using the CAMPV instruction of querying the table entry value, searching the lookup table according to the source instruction address in the register to obtain the target instruction address;
  • Step N322 if the search hits, the value of the directly obtained target instruction address is stored in the target register, and the program is jumped by the jump instruction to the code segment pointed by the target address; Step N323, if the lookup misses, it will get the address of the miss service program, the address is given by the virtual machine, stored in the target register, and the program jumps to the miss service program execution. Step N330, the miss service program refills the lookup table according to the content of the hash table maintained by the virtual machine;
  • the step N330 includes the following steps:
  • Step N331 using the CAMPI instruction of querying the index of the table entry, obtaining an index (index) of the entry of the value according to the value of the source instruction address, and storing the index in the target register;
  • Step N332 using the search according to the The index of the table entry fills in the CAMWI instruction of the lookup table, and fills the table with the ASID of the process, the source instruction address, and the corresponding target instruction address according to the index value in the target register.
  • the process of the instruction address translation search method further includes the following steps:
  • Step N340 invalidating one item in the lookup table; or reading the contents of the lookup table RAM.
  • Fill in the CAMWI instruction of the lookup table according to the index of the lookup table RAM table entry fill in a fixed value to the item of the specified index (index), and the fixed value cannot match the source instruction address of the program. , that is, the item is invalid.
  • the RAMRI instruction for reading the contents of the lookup table RAM table according to the index of the lookup table RAM table entry is read, and the value of the lookup table RAM of the specified index table entry is read and stored in the destination register for debugging. .
  • the RISC processor device of the present invention and its instruction address conversion search method add a structure of a lookup table capable of solving the mapping of the X86 source instruction address to the MIPS target instruction address in the RISC processor, and accelerate in the X86 virtual machine of the RISC processor.
  • the conversion from the X86 source instruction address to the MIPS target instruction address is used to improve the performance of the virtual machine.
  • the RISC processor and data processing method of the present invention provides support for using EFLAG instructions, support for X86 floating point format and floating point ⁇ , support for X86 storage structure, and support for virtual mechanisms, thereby narrowing X86 and RISC systems.
  • the semantic gap in the structure enables the support of the X86 virtual machine on the RISC processor, improves the processing speed of the X86 virtual machine in the RISC processor, and improves the performance of the RISC processor.

Description

P406224 一种支持 X86虚拟机的 RISC处理器装置及方法 技术领域
本发明涉及微处理器体系架构跨平台兼容技术领域, 特别是涉及一种支 持 X86虚拟机的精简指令集计算机(RISC) 处理器装置及方法。 背景技术
中央处理器 (CPU) 简称微处理器, 是计算机的核心单元。 微处理器采 用的指令集、 设计规范 (体系结构) 是计算机的首要特征, 它决定了计算机 需要采用的外围设备和应用软件的类型。
当今世界比较流行的两大处理器体系结构分别为: 以 MIPS 公司的 MIPS32/64 指令集为代表的精简指令集计算机 (Reduced Instruction Set Computing, RISC) 处理器体系结构和以 Intel公司的 X86为代表的复杂指令 集计算机(Complex Instruction Set Computing, CISC)处理器体系结构。 CISC 处理器指令数量繁多, 一些指令可执行相当复杂的功能, 一般需要许多时钟 周期来执行; RISC处理器使用较少数量的可用指令, 以更高的速率执行一组 更简单的功能。 而采用不同的体系结构的处理器上运行的程序软件需要针对 处理器的体系结构专门编写, X86上的应用软件通常不能在 MIPS指令集的 RSIC处理器的计算机上运行, 即常说的不兼容。
然而计算机制造商希望通过在自己制造的一种体系结构的微处理器上运 行更多的现有软件来节省软件开发的开销, 同时达到市场占有率最大化的目 的。
为了解决这一问题, 虚拟机应运而生。 一般地, 将具有一种类型体系结 构的处理器 (CPU) 计算机称为主机; 同时将需要主机仿真的, 不相关体系 结构类型的处理器 (CPU)环境称为目标机, 需要一种应用程序, 这种程序 能够促使主机执行一个或多个主机指令, 响应于给定的目标机指令, 运行为 目标机编写的软件, 这种程序就叫虚拟机。
目前现有的虚拟机有: SimOS, QEMU, Transmeta等, 但是现有的虚拟 机由于各种体系结构的巨大差异造成虚拟机运行开销过大, 执行效率过低, 很难应用到实际工作中。
而从 X86虚拟机到 RISC的二进制指令翻译效率, 很大程度上依靠 RISC 和 X86体系结构上的相似性。但是, X86体系结构的很多特性是 RISC架构所 没有的, 包括 X86体系结构中的定点运算指令支持标志位运算; X86架构中 80位的浮点数操作和浮点栈运算; 段基址寄存器的存在等特性。 这样, 使得 RISC处理器上的 X86虚拟机在运算过程中 , 由于不同体系结构指令的翻译问 题, 而使得二进制指令翻译效率低下, 不能提高运算速度。 发明内容
本发明的目的在于提供一种支持 X86虚拟机的 RISC处理器装置及方法。 其提高 RISC处理器性能。
为实现本发明目的而提供的一种支持 X86虚拟机的 RISC处理器, 包括 指令模块, 译码器, 査找表, 定点运算部件和浮点运算部件, 其中:
所述指令模块, 用于存储支持 X86虚拟机的虚拟机指令集;
所述译码器, 用于在该虚拟机指令集指令译码过程中, 区分出指令的虚 拟机指令集模式, 将指令按照所区分的虚拟机指令集模式, 进行译码后输出 给定点运算部件或者浮点运算部件;
所述査找表, 用于存储 X86程序中的跳转地址和 MIPS跳转地址, 并根 据所述译码器的输出支持对 X86程序中的跳转地址到 MIPS跳转地址的翻译 进行快速查找, 提高虚拟机性能;
所述定点运算部件用于根据译码器的输出, 对虚拟机指令集的定点指令 进行相应的处理, 输出执行结果;
所述浮点运算部件用于根据译码器的输出, 对虚拟机指令集的浮点指令 进行相应的处理, 输出执行结果。
所述的支持 X86虚拟机的 RISC处理器, 还包括访存执行单元、 内存, 及数据通路;
所述访存执行单元根据译码器的输出, 通过数据通路完成寄存器与内存 之间的数据传输。
所述的支持 X86虚拟机的 RISC处理器, 还包括通用物理寄存器堆, 所 述通用物理寄存器堆包括溢出检査寄存器, 上界、 下界地址寄存器, 模拟标 志寄存器, 和虚拟机模式控制寄存器;
所述溢出检查寄存器,用于存储在对 RISC处理器模拟的栈寄存器进行浮 点访问时栈溢出例外检查的结果;
所述上界、 下界地址寄存器, 用于模拟 X86处理器的有界访存机制时存 储作为上界、 下界的有效地址;
所述模拟标志寄存器, 用于模拟实现 X86处理器的标志寄存器标志位; 所述虚拟机模式控制寄存器包括一个控制位标志, 当该控制位标志为 1 时表示此时相应的指令运行在 X86虚拟机指令集模式下; 当该控制位标志为 0时表示此时相应的指令运行在非 X86虚拟机指令集模式下。
所述的支持 X86虚拟机的 RISC处理器, 还包括浮点寄存器堆; 所述浮点寄存器堆包括浮点控制寄存器; 浮点寄存器栈, 以及第 1 至 3 浮点寄存器。
所述虚拟机指令集包括访存扩展指令、 前缀指令、 EFLAG标志位相关指 令、 浮点栈相关指令和查找表相关指令中的一种或者一种以上的组合。
所述译码器包括指令处理模块, 和模式识别模块, 其中:
所述指令处理模块, 用于对虚拟机指令集的指令进行指令译码, 然后输 出给定点运算部件或者浮点运算部件;
所述模式识别模块, 用于在指令译码过程中, 区分出指令的虚拟机指令 集模式, 进行相应的处理。
所述模式识别模块包括多倍存储译码模块和 /或多倍读取译码模块; 所述多倍存储译码模块, 用于在输入的指令是访存扩展指令中的存储操 作指令时, 将源寄存器由一个扩展成多个相邻的寄存器, 然后输出到访存执 行单元执行;
所述多倍读取译码模块, 用于在输入的指令是访存扩展指令中的读取操 作指令时, 将该读取操作指令译码为多条内部操作指令, 将目标寄存器由一 个扩展成多个相邻的寄存器, 然后分配到所述多条内部操作中, 输出到访存 执行单元执行。
所述模式识别模块还包括前缀指令译码模块和标志位指令译码模块; 所述标志位指令译码模块, 用于对处于模拟 EFLAGS 工作模式下的 EFLAG标志位相关指令进行处理, 根据不同的 EFLAG标志位相关指令, 将 模拟标志寄存器译码为其指令的源寄存器和 /或目标寄存器;
所述前缀指令译码模块, 用于指示前缀指令后的多条指令处于 X86虚拟 机指令集模式下。
当前缀指令的范围参数为 n时, 译码器还包括前缀指令计数器, 用于记 录受前缀指令影响且不出现转移指令的指令序列的指令数, 该指令数与所述 范围参数相等。
所述译码器还包括 TOP指针寄存器, 和查找表模块, 其中:
所述 TOP指针寄存器, 用于维护一浮点栈操作指针, 存储浮点栈桟操作 指针的值;
所述査找表模块, 用于根据査找表相关指令, 利用査找表实现从 X86源 指令地址到 MIPS目标指令地址的转换。
所述定点运算部件包括标志读写模块, 标志运算模块, 例外处理模块, 和前缀例外控制寄存器;
所述标志读写模块, 用于读写模拟标志寄存器标志位的值;
所述标志运算模块, 用于在运算过程中, 当 RISC处理器处于 X86虚拟 机工作模式时, 根据运算结果得到模拟标志寄存器标志位, 或根据模拟标志 寄存器标志位中的一位或者多位, 执行分支跳转指令;
所述例外处理模块, 用于在前缀指令只影响紧接其后的一条指令时, 如 果出现执行例外, 则采用与延迟槽例外相同的方法, 将 Cause寄存器的 bd位 置 1, 同时将 EPC指向前缀指令, 例外服务程序完成后重新执行前缀指令; 所述前缀例外控制寄存器, 用于记录发生例外的指令是否受所述前缀指 令影响; 在出现异常而中断进程的时候存入当前指令的计数, 在异常结束返 回被中断进程时, 根据所述计数恢复所述被中断进程。
所述浮点运算部件包括指针操作模块, 栈溢出判断模块, 和转换模块; 所述指针操作模块, 用于对所述 TOP指针寄存器进行操作, 在模拟所述 浮点寄存器栈操作时, 模拟所述栈操作指针的栈操作, 修改并监控桟操作指 针的状态;
所述栈溢出判断模块, 用于检查指定的浮点寄存器栈中的桟寄存器, 并 根据栈寄存器的值对所述溢出检查寄存器进行操作, 进行浮点访问时栈溢出 例外检查;
所述转换模块, 用于进行扩展双精度浮点数据和双精度浮点数据之间的 相互转换。
如图 2所示, 为实现本发明目的还提供一种 RISC处理器装置支持 X86 虚拟机的数据处理方法, 包括下列步骤:
步骤 A,在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机工 作模式;
步骤 B, 读取指令, 区分指令的虚拟机指令集模式; 在指令译码过程中, 根据区分出的指令的虚拟机指令集模式, 将指令按照所区分的虚拟机指令集 模式, 进行译码后输出;
步骤 c, 根据所述输出, 进行相应的计算或存取处理, 输出执行的结果。 当 RISC处理器支持 X86虚拟机的数据处理过程为对使用 EFLAG指令的 支持时,
所述步骤 A具体为:
步骤 A1 , 在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机 工作模式, 表示模拟标志寄存器可用;
所述步骤 B具体为:
步骤 Bl, 译码器识别出运算是处于模拟 EFLAGS工作模式下, 然后根据 不同的指令, 将模拟标志寄存器译码为源寄存器和 /或目标寄存器;
所述步骤 C具体为:
步骤 Cl, RISC处理器在运算过程中, 当 RISC处理器的工作模式为 X86 虚拟机工作模式时, 读 /写模拟标志寄存器标志位的值以实现运算状态的获取 / 存储, 和根据运算结果得到模拟标志寄存器标志位或根据模拟标志寄存器标 志位中的一位或者多位执行分支跳转指令。
当 RISC处理器支持 X86虚拟机的数据处理过程为对 X86浮点格式和浮 点栈的支持时,
所述步骤 A具体为:
步骤 A2, 根据栈使能位, 决定是否选定浮点寄存器用于模拟浮点寄存器 栈操作; 或者设置一通用寄存器, 其低 8位由低到高分别表示浮点寄存器栈 的 0〜7号栈寄存器的状态; 或者选用任意三个通用寄存器, 作为第一浮点寄 存器, 第二浮点寄存器和第三浮点寄存器, 担任 64位浮点数和 80位浮点数 的格式转换工作;
所述步骤 B具体为:
步骤 B2,在译码器中 3位的 TOP指针寄存器中存放栈操作指针的值; 或 者对新增的栈溢出判断指令译码; 或者对扩展双精度浮点数据与双精度浮 点数据的转换指令译码;
所述步骤 C具体为:
步骤 C2, 在模拟浮点寄存器桟操作时, 对指针寄存器进行操作, 模拟栈 操作指针的栈操作, 修改并监控栈操作指针的状态; 或者检査指定的浮点 寄存器栈中的栈寄存器, 并根据栈寄存器的值对溢出检查寄存器进行操作, 进行浮点栈溢出检查; 或者执行扩展双精度浮点数据与双精度浮点数据之间 的数据转换。
当 RISC处理器支持 X86虚拟机的数据处理过程为对 X86存储结构的支 持时,
所述步骤 A具体为:
歩骤 A3, 在 RISC处理器的 X86虚拟机中, 设置两个通用寄存器分别为 上界地址寄存器和下界地址寄存器;
所述步骤 B具体为:
步骤 B3, 在进行 X86虚拟机指令集到 MPS指令集翻译时, 译码器将指 令进行译码, 得到能被 RISC处理器处理的二进制代码;
所述步骤 C具体为:
步骤 C3, 定点运算部件在译码后的访存指令中, 根据上界地址寄存器中 存储的上界地址和 /或下界地址寄存器中存储的下界地址, 判断指令操作数地 址和指令地址的有效性; 当指令操作数地址和指令地址皆为有效时, 执行访 存操作; 否则引发地址错例外。
当 RISC处理器支持 X86虚拟机的数据处理过程为对虚拟机制的支持时, 所述步骤 A具体为:
步骤 A4, 读取前缀指令, 区分指令的虚拟机指令集模式; 或者处理器 取出多倍数据宽度指令输入到译码器; 或者在 RISC处理器的 X86虚拟机启 动时, 初始化査找表, 用得到的 X86虚拟机指令地址到 MDPS指令地址的内 容来填写查找表;
所述步骤 B具体为:
步骤 B4, 在指令译码过程中, 根据区分出的指令的虚拟机指令集模式, 将指令按照所区分的虚拟机指令集模式, 进行译码后输出; 或者译码器判断 指令类型, 识别并译码多倍数据宽度指令; 或者译码器识别査找表相关指令 进行译码;
所述步骤 C具体为:
步骤 C4, 定点运算部件执行受前缀指令影响的指令, 并根据运算结果计 算相应的 EFLAG标志位;或者将译码后的多倍数据宽度指令发送到访存执行 单元执行操作; 或者执行査找表相关指令, 得到目标指令地址的值或者跳转 到目标地址执行。 附图简要说明
图 1为本发明支持 X86虚拟机的 RISC处理器装置结构示意图; 图 2为本发明支持 X86虚拟机的 RISC处理器数据处理方法流程图。 实现本发明的最佳方式
为了使本发明的目的、 技术方案及优点更加清楚明白, 以下结合附图及 实施例, 对本发明的支持 X86虚拟机的 RISC处理器装置及方法进行进一步详 细说明。 应当理解, 此处所描述的具体实施例仅仅用以解释本发明, 并不用 于限定本发明。
本发明实施例中, 以 MIPS64指令集的 RISC处理器为例, 对本发明支持 X86虚拟机的 RISC处理器装置及方法进行详细说明, 但应当说明的是,其并 不是对本发明的限制, 本发明请求保护的范围, 以权利要求书为准。
本发明的支持 X86虚拟机的 RISC处理器装置及方法,为解决 X86和 RISC 处理器体系结构上的语义差距, 实现在 RISC处理器上对 X86处理器兼容的 支持, 需要在 RISC处理器上解决以下几个方面的问题:
1、 对使用 EFLAG指令的支持;
2、 对浮点格式和浮点栈的支持; 3、 对存储结构的支持;
4、 对虚拟机制的支持。 如图 1所示,本发明的支持 X86虚拟机的 RISC处理器,包括指令模块 1, 译码器 2, 查找表(未示出) , 定点运算部件 3, 通用物理寄存器堆 7, 浮点 运算部件 4, 浮点物理寄存器堆 8, 访存执行单元 5, 内存及数据通路 6等。
所述指令模块 1, 用于存储支持 X86虚拟机的虚拟机指令集, 所述虛拟 机指令集可以包括访存扩展指令、 前缀指令、 EFLAG标志位相关指令、 浮点 栈相关指令、 査找表相关指令中的一种或者一种以上的组合。
所述译码器 2,用于在该虚拟机指令集指令译码过程中, 区分出指令的虚 拟机指令集模式, 将指令按照所区分的虚拟机指令集模式, 进行译码后输出 给定点运算部件 3或者浮点运算部件 4;
所述査找表, 用于存储 X86程序中的跳转地址和 MIPS跳转地址, 并根 据所述译码器的输出支持对 X86程序中的跳转地址到 MIPS跳转地址的翻译 进行快速查找
所述定点运算部件 3用于根据译码器 2的输出, 对虚拟机指令集的定点 指令进行处理, 输出执行结果。
所述浮点运算部件 4用于根据译码器 2的输出, 对虚拟机指令集的浮点 指令进行处理, 输出执行结果。
所述访存执行单元 5,用于根据译码器的输出,通过数据通路完成寄存器 与内存之间的数据传输。 较佳地, 所述译码器 2包括指令处理模块 21, 模式识别模块 24, TOP指 针寄存器 22, 查找表模块 23。
所述指令处理模块, 用于对虚拟机指令集的指令进行指令译码, 然后输 出给定点运算部件 3或者浮点运算部件 4或者访存执行单元 5;
所述模式识别模块 24, 用于在指令译码过程中, 区分出指令的虚拟机指 令集模式, 进行相应的处理。
所述模式识别模块 24包括多倍存储译码模块 244和 /或多倍读取译码模块
s 所述多倍存储译码模块 244,用于在输入的指令是访存扩展指令中的存储 操作指令时, 将源寄存器由一个扩展成多个相邻的寄存器, 然后输出到访存 执行单元 5执行;
所述多倍读取译码模块 245,用于在输入的指令是访存扩展指令中的读取 操作指令时, 将该读取操作指令译码为多条内部操作指令, 将目标寄存器由 一个扩展成多个相邻的寄存器, 然后分配到所述多条内部操作中, 输出到访 存执行单元 5执行。
所述模式识别模块 24还包括前缀指令译码模块 241和标志位指令译码模 块 243。
所述标志位指令译码模块 243 , 用于对处于模拟 EFLAGS工作模式下的
EFLAG标志位相关指令进行处理, 根据不同的 EFLAG标志位相关指令, 将 模拟标志寄存器 71译码为其指令的源寄存器和 /或目标寄存器;
所述前缀指令译码模块 241, 用于指示前缀指令后的多条指令处于 X86 虚拟机指令集模式下; 进一歩地, 当前缀指令的范围参数为 n时, 译码器 2 还包括前缀指令计数器 242,用于记录受前缀指令影响且不出现转移指令的指 令序列的指令数, 该指令数与所述范围参数相等;
所述 TOP指针寄存器 22, 用于维护一浮点桟操作指针, 存储浮点栈栈操 作指针的值;
所述査找表模块 23, 用于根据査找表相关指令, 利用查找表实现从 X86 源指令地址到 MIPS目标指令地址的转换。 所述定点运算部件 3包括标志读写模块 31, 标志运算模块 32, 例外处理 模块 34, 前缀例外控制寄存器 33。
所述标志读写模块 31, 用于读写模拟标志寄存器 71标志位的值; 所述标志运算模块 32, 用于在运算过程中, 当 RISC处理器处于 X86虚 拟机工作模式时, 根据运算结果得到模拟标志寄存器标志位, 或根据模拟标 志寄存器标志位中的一位或者多位, 执行分支跳转指令;
所述例外处理模块 34, 用于在前缀指令只影响紧接其后的一条指令时, 如果出现执行例外, 则采用与延迟槽例外相同的方法, 将 Cause寄存器的 bd 位置 1, 同时将 EPC指向前缀指令, 例外服务程序完成后重新执行前缀指令。 所述前缀例外控制寄存器 33, 用于记录发生例外的指令是否受所述前缀 指令影响; 在出现异常而中断进程的时候存入当前指令的计数, 在异常结束 返回被中断进程时, 根据所述计数恢复所述被中断进程。 所述通用物理寄存器堆 7包括溢出检查寄存器 72, 上界、 下界地址寄存 器 74, 模拟标志寄存器 71, 和虚拟机模式控制寄存器 73。
所述溢出检查寄存器 72, 用于存储在对 RISC处理器模拟的桟寄存器进 行浮点访问时检查是否存在桟溢出例外的结果;
所述上界、 下界地址寄存器 74, 用于模拟 X86处理器的有界访存机制时 存储作为上界、 下界的有效地址;
所述模拟标志寄存器 71,用于模拟实现 X86处理器的标志寄存器标志位; 所述虚拟机模式控制寄存器 73包括一个控制位标志, 当该控制位标志为 1 时表示此时相应的指令运行在 X86虚拟机指令集模式下; 当该控制位标志 为 0时表示此时相应的指令运行在非 X86虚拟机指令集模式下。 所述浮点运算部件 4包括指针操作模块 41, 栈溢出判断模块 43, 转换模 块 42。
所述指针操作模块 41, 用于对所述 TOP指针寄存器进行操作, 在模拟所 述浮点寄存器桟 83操作时, 模拟所述栈操作指针的栈操作, 修改并监控栈操 作指针的状态;
所述栈溢出判断模块 43,用于检查指定的浮点寄存器栈 83中的栈寄存器, 并根据栈寄存器的值对溢出检査寄存器 72进行操作, 进行浮点访问时桟溢出 例外检査;
所述转换模块 42, 用于进行扩展双精度浮点数据和双精度浮点数据之间 的相互转换。 所述浮点寄存器堆 8包括浮点控制寄存器 81 ; 0-7号浮点寄存器栈 83 ; 以及第 1〜3浮点寄存器 82。
所述第 1〜3浮点寄存器 82这三个寄存器可以与所述 0〜7号浮点寄存器栈 83交叉重叠应用。 所述访存执行单元 5包括合并单元, 上下界判断模块。
所述合并单元, 用于在多倍读取译码模块 244对读取内存操作指令译码 后, 在执行单元执行前, 把多个内部操作进行合并。
所述上下界判断模块, 用于支持有界访存指令时对上界、 下界地址判断 访存指令所包含的地址进行有效性判断。 如图 2所示, 为实现本发明目的还提供一种 RISC处理器装置支持 X86 虚拟机的数据处理方法, 包括下列步骤:
步骤 A,在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机工 作模式;
步骤 B, 读取指令, 区分指令的虚拟机指令集模式; 在指令译码过程中, 根据区分出的指令的虚拟机指令集模式, 将指令按照所区分的虚拟机指令集 模式, 进行译码后输出;
步骤 C, 根据所述输出, 进行相应的计算或存取处理, 输出执行结果。 当 RISC处理器支持 X86虚拟机的数据处理过程为对使用 EFLAG指令的 支持时, :
所述步骤 A具体为:
步骤 Al, 在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机 工作模式, 表示模拟标志寄存器 71可用;
所述步骤 B具体为:
步骤 Bl,译码器识别出运算是处于模拟 EFLAGS工作模式下, 然后根据 不同的指令, 将模拟标志寄存器 71译码为源寄存器和 /或目标寄存器;
所述步骤 C具体为:
步骤 C1, RISC处理器在运算过程中, 当 RISC处理器的工作模式为 X86 虚拟机工作模式时, 读写模拟标志寄存器 71标志位的值以实现运算状态的获 取 /存储, 和 /或根据模拟标志寄存器 71标志位的值, 进行控制。 当 RISC处理器支持 X86虚拟机的数据处理过程为对 X86浮点格式和浮 点桟的支持时,
所述步骤 A具体为:
步骤 A2, 根据栈使能位, 决定是否选定浮点寄存器用于模拟浮点寄存器 桟 83操作; 或者设置一通用寄存器, 其低 8位由低到高分别表示浮点寄存器 桟 83的 0〜7号栈寄存器的状态; 或者选用任意三个通用寄存器,作为第 1~3 浮点寄存器 82, 担任 64位浮点数和 80位浮点数的格式转换工作;
所述步骤 B具体为:
步骤 B2,在译码器中 3位的 TOP指针寄存器中存放栈操作指针的值; 或 者对新增的栈溢出判断指令译码; 或者对扩展双精度浮点数据与双精度浮 点数据的转换指令译码;
所述步骤 C具体为:
步骤 C2, 在模拟浮点寄存器栈 83操作时, 对指针寄存器进行操作, 模拟 桟操作指针的栈操作, 修改并监控桟操作指针的状态; 或者检查指定的浮 点寄存器栈 83中的栈寄存器, 并根据桟寄存器的值对溢出检査寄存器 72进 行操作, 进行浮点桟溢出检查; 或者执行扩展双精度浮点数据与双精度浮点 数据之间的数据转换。 当 RISC处理器支持 X86虚拟机的数据处理过程为对 X86存储结构的支 持时,
所述步骤 A具体为:
步骤 A3, 在 RISC处理器的 X86虚拟机中, 设置两个通用寄存器分别为 上界、 下界地址寄存器 74;
所述步骤 B具体为:
步骤 B3, 在进行 X86虚拟机指令集到 MIPS指令集翻译时, 译码器将指 令进行译码, 得到能被 RISC处理器处理的二进制代码;
所述步骤 C具体为:
步骤 C3, 定点运算部件在译码后的访存指令中, 根据上界地址寄存器中 存储的上界地址和 /或下界地址寄存器中存储的下界地址, 判断指令操作数地 址和指令地址的有效性; 当指令操作数地址和指令地址皆为有效时, 执行访 存操作; 否则引发地址错例外。 当 RISC处理器支持 X86虚拟机的数据处理过程为对虚拟机制的支持时, 所述步骤 A具体为:
步骤 A4, 读取前缀指令, 区分指令的虚拟机指令集模式; 或者处理器 取出多倍数据宽度指令输入到译码器; 或者在 RISC处理器的 X86虚拟机启 动时, 初始化查找表, 用得到的 X86虚拟机指令地址到 MIPS指令地址的内 容来填写查找表;
所述步骤 B具体为:
步骤 B4, 在指令译码过程中, 根据区分出的指令的虚拟机指令集模式, 将指令按照所区分的虛拟机指令集模式, 进行译码后输出; 或者译码器判断 指令类型,识别并译码多倍数据宽度指令; 或者译码器识别査找表相关指令; 所述步骤 C具体为:
歩骤 C4, 定点运算部件执行受前缀指令影响的指令, 并根据运算结果计 算相应的 EFLAG标志位。或者将译码后的多倍数据宽度指令发送到访存执行 单元执行操作。 或者执行査找表相关指令, 得到目标指令地址的值或者跳转 到目标地址执行。 下面详细描述当处理器支持 X86虚拟机的数据处理过程为对使用 EFLAG 指令的支持时, RISC处理器装置支持 X86虚拟机的数据处理方法过程。
为了对使用 EFLAG指令的支持,提供两种方式:一种是将物理寄存器堆 中每个物理寄存器扩展为 72位, 包括 64位的数据位和 8位的标志位。 运算 时把运算结果的数据部分和标志部分一起写回到目标寄存器中。 同时在译码 器 2中设置一个最新标志位指针 Reflag,指示与最新标志位结合的通用寄存器 逻辑编号。 另一种是在物理寄存器堆中增加设置一内部逻辑寄存器专门实现 X86的 EFLAG标志位, 对于每一条修改 EFLAG的运算指令都增加新的相关 指令来专门修改 EFLAG。
上述两种方式, 第一种是在每一个寄存器中 "横向 "增加 EFLAG位; 第 二种方法是在所有寄存器的 "纵向"增加一个寄存器专门保存 EFLAG位。 作为一种可实施方式, 为进行支持 X86— EFLAGS标志位, 本发明的支持 X86虚拟机的 RISC处理器装置, 所述模拟标志寄存器 71 (M-EFLAGS) , 用于模拟实现 X86指令集的 CISC处理器的标志寄存器(EFLAGS)标志位, 该寄存器的低六位由低到高分别表示 CF位、 PF位、 A 位、 ZF位、 SF位和 OF位。 下面详细说明本发明支持 X86虚拟机的 RISC处理器的寄存器标志位处 理过程, 其包括下列步骤:
步骤 110, 在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机 工作模式,即表示模拟标志寄存器 71可用,译码器 2识别出运算是处于 RISC 处理器的 X86虚拟机工作模式, 即模拟 EFLAGS工作模式下, 然后根据不同 的指令, 将模拟标志寄存器 71译码为源寄存器和 /或目标寄存器;
模拟标志寄存器 (M-EFLAGS ) 模拟实现 X86 指令集的标志寄存器 (EFLAGS)标志位, 该寄存器的低六位由低到高分别表示 CF位、 PF位、 AF位、 ZF位、 SF位禾口 OF位。
在模拟标志寄存器 71可用时, 识别出该运算是在 RISC处理器的 X86虚 拟机工作模式, 即模拟 EFLAGS工作模式下, 根据执行结果修改相应模拟标 志寄存器 71的值, 然后根据不同的指令, 将模拟标志寄存器译码为源寄存器 和 /或目标寄存器, 而可以不在原有目标寄存器中保存结果。
作为一种可实施方式, 与模拟标志寄存器相关的指令在修改模拟标志寄 存器的标志位时, 该指令之前有一条标明该指令是在 RISC处理器的 X86虚 拟机工作模式下的前缀指令 SETFLAG,表示如果其后指令处于 X86虚拟机模 式下。
指令格式为: SETFLAG /模拟 EFLAGS工作模式前缀指令
表示紧跟在该指令后的一条指令处于模拟 EFLAGS工作模式。
那么它在执行时, 只根据执行结果修改相应的模拟标志寄存器 71的标志 位的值, 而不在目标寄存器中保存结果, 举例如下:
正常的 MIPS指令:
ADD $5,$ 1, $2 表示将 1号通用寄存器和 2号通用寄存器中的值相加, 结果存于 5号通 用寄存器中;
而修改模拟标志寄存器 71的标志位的指令为:
SETFLAG ADD $5,$ 1, $2
表示将 1号通用寄存器和 2号通用寄存器中的值相加, 运算结果不保存, 而根据结果修改模拟标志寄存器中的标志位相应位。
译码器 2的输入集是所有可能的 32位编码, 包括所有合法及非法指令。 对于这种方式, 译码器 2新增了一种合法输入, SETFLAG, 表示紧跟在该指 令后的一条指令处于 RISC处理器的 X86虚拟机工作模式, 即模拟 EFLAGS 工作模式。
译码器 2根据前缀指令, 在前缀指令后一条指令译码时, 其输出根据模 拟 EFLAGS工作模式, 调整内部操作码送到定点运算部件 3, 此时这条指令 的目的寄存器经过译码后变为模拟标志寄存器(M-EFLAGS) , 其中一个源 寄存器也为模拟标志寄存器(M-EFLAGS) 。 因为有些运算只修改一部分模 拟标志寄存器 (M-EFLAGS ) , 所以需要把原有的模拟标志寄存器 (M-EFLAGS)送到定点运算部件 3。
其中, 所述调整内部操作码, 包括经过重命名即逻辑寄存器到物理寄存 器映射, 以及读写寄存器端口等操作内容属于本领域技术人员熟知内容, 因 此在本发明中不再一一详细描述。
译码器 2译码后,将指令输出到定点运算部件 3,定点运算部件 3判断内 部操作码, 如果是正常指令, 按照正常步骤运算; 如果是模拟 EFLAGS工作 模式下, 则先计算结果, 再按照计算结果和中间结果置模拟标志寄存器 (M-EFLAGS)标志位, 计算结果可以不保存到目标寄存器中。
作为另一种可实施方式, 对于本发明中使用频度很大的修改模拟标志寄 存器的标志位的指令, 将对 X86指令进行一对一的对应, 这样一条指令等价 于原来的两条指令 (一条 SETFLAG—条正常 MIPS指令) 。 举例如下: 对于使用频度很大的修改模拟标志寄存器的标志位的加指令 (ADD) , 定义指令 X86ADD, 从而
X86ADD $5,$15$2 等价于
SETFLAG ADD $5,$1,$2
这些使用频度很大的指令, 在译码时分配单独的指令槽, 功能部件在识 别出这些指令后, 产生的结果不送入目标寄存器中, 而是根据结果产生相应 的模拟标志寄存器 (M-EFLAGS ) 标志位, 把标志位送入模拟标志寄存器 (M-EFLAGS) 步骤 120, RISC处理器在运算过程中, 当 RISC处理器处于 X86虚拟机 工作模式时, 读写模拟标志寄存器标志位的值, 和 /或根据模拟标志寄存器标 志位的值, 进行控制。
所述步骤 120中, 读写模拟标志寄存器标志位的值, 包括下列步骤: 步骤 121, 当 RISC处理器处于 X86虚拟机工作模式时, 提取一位或者多 位模拟标志寄存器标志位的值, 根据其中的 8位掩码 (mask) 值来控制提取 模拟标志寄存器中的一位或者几位, 提取出来的模拟标志寄存器 71标志位的 值存入目标寄存器中;
步骤 122, 当 RISC处理器处于 X86虚拟机工作模式时, 修改一位或者多 位模拟标志寄存器标志位的值, 根据其中的 8位掩码 (mask) 值来控制修改 模拟标志寄存器中的一位或者几位, 使用源寄存器中的值对模拟标志寄存器 进行修改。
作为一种可实施方式,本发明实施例通过两条指令 MTFLAG和 MFFLAG 修改或者读取模拟标志寄存器标志位的值, 它们使用 8位的掩码 (mask) 来 修改或者读取模拟标志寄存器的相应标志位, 它们分别可以写模拟标志寄存 器标志位的值和将模拟标志寄存器标志位的值读出来到一指定的通用寄存器 中。
MTFLAG指令实现提取一位或者多位模拟标志寄存器 (M-EFLAGS) 标 志位的值, 根据指令中的 8位掩码 (mask) 值 (由立即数来表示) 来控制提 取模拟标志寄存器中的一位或者几位, 提取出来的模拟标志寄存器 ( M-EFLAGS ) 标志位的值存入目标寄存器 GPR[rt]中。
由掩码(mask)提取模拟标志寄存器中标志位的实现由以下关系式表示: GPR[rt] < - M-EFLAGS & mask
例如, 掩码 (mask) 值为 0x00000100, 那么将提取模拟标志寄存器
(M-EFLAGS) 第 2位即为 AF位的内容, 放入目标寄存器 GPR[rt]中。
MTFLAG指令直接修改一位或者多位模拟标志寄存器 (M-EFLAGS ) 标 志位的值, 根据指令中的 8位掩码 (mask) 值 (由立即数来表示) 来控制修 改模拟标志寄存器(M-EFLAGS) 中的一位或者几位, 使用 GPR[rs]源寄存器 中的值对模拟标志寄存器 (M-EFLAGS) 进行修改。
由掩码 (mask) 控制修改模拟标志寄存器 (M-EFLAGS) 中标志位的实 现由以下关系式表示:
M-EFLAGS & mask GPR[rs]
比如, GPR[rs]低 8 位的内容为 0x00010010, 掩码 (mask) 字段的值为 0x00110011, 那么这条指令修该模拟标志寄存器(M- EFLAGS)中的 CF、 PF、 SF和 OF位, 将这四位的值分别置 0、 1、 1和 0。
所述步骤 120中, 所述控制过程包括下列步骤- 步骤 121', 根据运算结果得到模拟标志寄存器 (M-EFLAG) 标志位; 例如, 根据模拟标志寄存器 (M-EFLAG) 标志位, 直接运算的指令如 X86ADD指令。
X86ADD /只影响 EFLAGS位的 32位加法
指令格式:
X86ADD rs, rt
X86ADD指令实现 GPR [rs]寄存器中 32位的整数和 GPR [rt]寄存器中 32 位整数相加, 产生 32位的结果, 结果不保存, 只根据结果修改模拟标志寄存 器 (M-EFLAGS) 的 OF/SF/ZF/AF/PF位。
步骤 122,,根据模拟标志寄存器(M-EFLAG)标志位中的一位或者多位, 执行分支跳转指令。
如 X86J M-EFLAGS条件转移
指令格式:
X86J.fint offset
X86J指令实现比较 EFLAGS的某几位,根据相应的条件进行处理器相关 的跳转。 其中不同的指令后缀(fint)代表着不同的条件, 如 X86J.a fmt=0, 表示 当 CF=0 并且 ZF=0时跳转。
MIPS64指令集的 32位指令码的高 6位 (31bit: 26bit) 为 opcode域。 其 中 SPECIAL2 (opcode为 011100) 指令槽按 MIPS的规定是可以由用户自主 定义的。 本发明实施例新增指令全部都是利用现有 MIPS64指令集中保留的 SPECIAL2空槽的值来实现的。 下面详细描述当处理器支持 X86虚拟机的数据处理过程为对 X86浮点格 式和浮点桟的支持时, RISC处理器装置支持 X86虚拟机的数据处理方法过程。
X86提供一个特殊的运算部件,支持 80位浮点精度,并且是栈操作方式, 这些与 RISC 处理器有较大的不同。 本发明为实现对浮点格式和浮点栈的支 持, 增加设置 3条 64位浮点数和 80位浮点数之间的转换指令, 从 80位浮点 数转换为 64位浮点数设置一条指令, 从 64位浮点数转换为 80位浮点数设置 两条指令。
作为一种可实施方式, 以包含 MIPS指令集的 RISC物理寄存器堆的 32 个通用浮点寄存器, 动态选用任意三个通用寄存器, 作为第 1~3 浮点寄存器 82, 担任转换工作。 在转换工作结束后, 这三个通用寄存器又可以与其它通 用寄存器没有分别地被使用。
其中:
所述第一浮点寄存器, 用于存储扩展双精度浮点数据的符号位和阶, 占 用此寄存器的低 16位;
所述第二浮点寄存器, 用于存储扩展双精度浮点数据的尾数部分, 共 64 位;
所述第三浮点寄存器, 用于存储双精度浮点数据。
当处理器支持 X86虚拟机的数据处理过程为对 X86浮点格式和浮点栈的 支持时, RISC处理器装置支持 X86虚拟机的数据处理方法过程, 包括以下步
步骤 210,把内存中的 80位扩展双精度浮点数据划分为符号位和阶部分, 以及尾数部分, 分别存储到不同的第一浮点寄存器和第二浮点寄存器中, 通 过浮点运算部件 4转换为 64位双精度浮点数据,并存储到第三浮点寄存器中。 歩骤 210具体包括下列步骤:
步骤 211 ,将内存中的 80位扩展双精度浮点数据, 分为符号位和阶部分, 以及尾数部分。
在一个 80位浮点数据的第 64位处划分, 第 80位到第 64位为第一部分, 共 16位, 第 63位到第 0位为第二部分, 共 64位。 划分好后, 由用户选择一 种现有的读入方式(MIPS提供了有多种读入方式) , 分别将两部分读入两个 浮点寄存器 $f (i) , $f (j ) ;
步骤 212, 浮点寄存器 $f (i) 中存放 80位扩展双精度浮点数据的符号位 和阶, 占用此寄存器的低 16位;
步骤 213, 浮点寄存器 $f (j) 中存放 80位扩展双精度浮点数据的尾数部 分, 共 64位;
步骤 214, 将浮点寄存器 $f (i)和浮点寄存器 $f (j ) 作为源寄存器, 将 浮点寄存器 $f (t)作为目标寄存器, 把浮点寄存器 $f (i)和浮点寄存器 $f (j) 中存放的 80位扩展双精度浮点数据转换为 64位双精度浮点数据。
作为一种可实施方式, 所述转换可以通过指令(1 )而执行。
CVT.D.LD $f(t), $f(i), $f(j) //*扩展双精度转换为双精度 (1)
MIPS64指令集的 32位指令码的高 6位(31bit: 26bit)为 opcode域。 其 中 SPECIALS (opcode为 011100)指令槽按 MIPS的规定是可以由用户自主 定义的。本发明实施例利用现有 MIPS64指令集中保留的 SPECIAL2空槽的值 来定义。
式 (1)表示把 $f<¾, $f( 两个栈寄存器表示的扩展双精度数据转换为双精度 数, 存入到栈寄存器$^)中。
将输出的 64位数据存入浮点寄存器$£ (t) 中, 得到 64位双精度浮点数 据。
步骤 220, 把第三浮点寄存器中的 64位双精度浮点数据提取符号位与阶 部分, 以及尾数部分, 通过浮点运算部件 4转换成 80位浮点数据的符号位与 阶部分, 以及 80位浮点数据的尾数部分, 并分别存储在第一浮点寄存器和第 二浮点寄存器中, 用 2个寄存器一起表示 80位的扩展双精度浮点数据, 得到 80位浮点数据。
步骤 220具体包括如下步骤: 步骤 221, 将一 64位双精度浮点数据存入浮点寄存器 $f (t) 中; 步骤 222, 提取浮点寄存器$£ (t)中双精度浮点数据的符号位和阶部分共
11位, 转换为 80位扩展双精度浮点数据的符号位和阶部分共 16位, 存储到 浮点寄存器 $f(i)中。
作为一种可实施方式, 所述转换可以通过指令 (2) 而执行。
CVT.UD.D $f(i), $f(t) //*双精度转换为扩展双精度的高位 (2) 把浮点寄存器 $f(t)表示的双精度数转换为扩展双精度数的高 16 位存入
$f(i)。
将转换后的阶进行 0扩展后得到 64位浮点数据。 因为目标寄存器是 64 位的, 这里其实只需要 16位数据就够了, 但是为了存入到一个 64位的目标 寄存器 $f (i) 中, 所以必须对 16位以上的 48位进行 0扩展, 存入浮点寄存 f (i) 中;
步骤 223, 提取浮点寄存器$ (t)的尾数部分 53位, 转换为 80位浮点数 据的尾数部分 64位, , 存储到浮点寄存器 $f(D中。
提取工作在浮点运算部件 4中完成, 将提取出来的 53位数据, 转换为 80 位浮点数据的尾数部分 64位。
作为一种可实施方式, 所述转换可以通过指令 (3 ) 而执行。
CVT.LD.D $f(j), $f(t) //*双精度转换为扩展双精度低位 ( 3 ) 把浮点寄存器 $f(t)表示的双精度数转换为扩展双精度数的低 64位存入浮 点寄存器$¾)中。
所述提取、 转换可以按照 IEEE754标准的相关规定进行, 本领域技术人 员可以根据指令(2) 而实现本发明的转换, 因此, 在本发明中不再一一详细 描述。
将转换后的尾数存入浮点寄存器 $ f (j ) 中;
步骤 224, 将浮点寄存器 $ f (i) 的值作为符号位和阶, 浮点寄存器 $ f
(j ) 的值作为尾数, 得到 80位的扩展双精度浮点数据。
本发明的浮点数据转换, 使得非 X86体系结构的处理器能够支持 X86中 的特殊 80位浮点数据类型, 从而方便虚拟机进行二进制翻译工作, 提髙虚拟 机效率, 增强处理器兼容性。 另外, 在 X86架构中, 部分浮点指令给出的浮点寄存器号是一个相对值, 必须和浮点状态字中的浮点循环栈的栈顶指针 TOP相加后才是真正的浮点寄 存器号。 为解决这一问题, 本发明在译码器 2设置 TOP指针寄存器 22, 在浮 点物理寄存器堆中的浮点控制寄存器 81中设置维护一个栈使能信号, 决定是 否选定 8个浮点寄存器用于模拟浮点桟, 如果栈使能被置位, 则在相应的浮 点指令运算中, 凡是寄存器号小于 8的寄存器, 在译码时根据 TOP的值修改 自己的源或目标逻辑寄存器号, 并根据指令的内容修改 TOP值; 然后再发送 到处理器; 如果栈使能位被清零, 则在运算中, 认为寄存器模拟栈不存在, 按照现有的工作步骤正常进行。 所述浮点控制寄存器 81, 用于控制利用浮点寄存器堆 8使能或禁止模拟 浮点寄存器桟 83。
其维护一个桟使能位, 当使能位置 1时, 表示处理器将模拟 X86处理器 的浮点寄存器栈操作; 当使能位置 0时, 表示处理器将不模拟 X86处理器的 浮点寄存器桟操作, 处理器按照正常的过程进行操作处理。
本发明实施例中,利用 RISC处理器中编号为 0~31的 32个现有的浮点寄 存器, 模拟 X86处理器的浮点寄存器桟操作。
所述 TOP指针寄存器 22, 用于维护一个 TOP指针, 也就是栈操作指针, 存储 TOP指针的值, 这个 TOP指针可以被读、 写、 增 1、 减 1等。
所述指针操作模块 41, 用于对指针寄存器进行操作, 在模拟浮点寄存器 栈操作时, 模拟指针寄存器的桟操作指针的栈操作, 修改并监控桟操作指针 的状态。
作为一种可实施方式, 如果浮点控制寄存器 81中的桟使能位被置位, 则 选择 32个浮点寄存器中的 8个寄存器,用于模拟 X86处理器的浮点寄存器栈 的栈寄存器, 序号为 0〜7。
如果浮点控制寄存器 81中的栈使能位被置位 1, 则在运算中被使用, 表 示寄存器模拟的浮点寄存器栈存在, 那么凡是浮点运算指令中用到的编号小 于 8的寄存器, 都被当作浮点寄存器桟 83的栈寄存器使用, 从而模拟 X86处 理器的浮点寄存器栈。 其后指针操作模块使用 TOP指针进行栈寄存器号进行转换, 即用户所见 的浮点寄存器号跟程序使用的浮点寄存器号转换, 例如, 寄存器号是指距离 桟顶第 i个单元的寄存器 ST (i) 加上 TOP指针值。 如果 TOP指针值是 2, 贝 U ST (0) 为第 2号寄存器, ST ( 1 ) 为第 3号寄存器。 如果溢出也有相应处 理, 使得这组寄存器形成了一个循环桟, 完成了本发明要实现的模拟 x86 中 浮点寄存器桟的功能。 然后进行后续工作, 后续工作与没有置位栈使能相同; 如果浮点控制寄存器 81中的栈使能位被置位 0, 即被清零, 则在运算中, 认为寄存器模拟栈不存在, 按照现有的工作步骤正常工作。 下面进一步详细说明本发明支持 X86虚拟机的 RISC处理器的模拟浮点 栈操作过程方法, 其以 RISC处理器的 8个浮点寄存器组成浮点寄存器栈 83, 通过浮点控制寄存器 81, 并模拟 X86的 TOP指针功能, 即栈指针操作功能, 完成模拟浮点寄存器的栈操作。
本发明的支持 X86虚拟机的 RISC处理器模拟浮点桟操作的方法, 包括 如下步骤:
步骤 2100, 根据栈使能位, 决定是否选定 8个浮点寄存器用于模拟浮点 寄存器栈中 8个栈寄存器, 模拟浮点寄存器栈操作, 并设置指针寄存器; 所述步骤 2100包括下列步骤:
步骤 2110, 在浮点控制寄存器 81中选择一位为浮点栈使能位; 当使能位 置 1时, 表示将模拟 X86处理器的浮点栈, 进行浮点栈操作; 当使能位置 0 时, 表示不模拟 X86处理器的浮点栈, 不能进行浮点栈操作, 处理器按照正 常的过程工作;
步骤 2120, 设置一个至少 3位的指针寄存器, 存放 TOP指针的值。
该 TOP指针的值可以被读、 写、 增 1、 减 1, TOP指针的范围是 0〜7。 TOP指针在压栈时压入 7号寄存器, TOP指针的值被设置成 6; 在弹桟 时如果 TOP指针值为 7, 则弹栈后 TOP指针值设置位 0。
因为 TOP指针永远指向桟顶寄存器,本栈为自顶向下生长,即压栈时 TOP 指针值减一, 弹出时 TOP指针值增一, 所以向 7号寄存器存入数据时 (也就 是向 7号寄存器压栈), TOP指针值应该减一变为 6。 当从 7号寄存器中弹出 数据时, TOP指针值应该加 1变为 8, 但是由于只有 0〜7号共 8个寄存器, 所以 TOP指针值最大为 7, 当加一时, TOP指针应该指向下一个寄存器, 也 就是循环栈中的 0号寄存器, 此时 TOP指针值应该变为 0。
例如, 如果 TOP指针的值为 3, 当使能位为 1时, 如果参与运算的浮点 寄存器为$ ): i<=7, 则用浮点寄存器$ 0)替换浮点寄存器$ )进行运算, 其 Φ j=(i+ ) mod 8 ;
如果寄存器 $f(i i>7, 则无需改变, 直接使用浮点寄存器 $f(i:)。 步骤 2200, 在模拟浮点寄存器栈操作时, 对指针寄存器进行操作, 模拟 栈操作指针的栈操作, 修改并监控桟操作指针的状态。
所述步骤 2200包括下列步骤:
步骤 2210, 设置桟操作模式, 浮点栈使能位置 1, 允许用户模拟浮点寄 存器栈进行浮点栈操作;
作为一种可实施方式, 设置模拟浮点栈模式, 为 X86浮点栈模式置位 1 可以通过下式指令而执行。
其指令格式为: SETTM
本发明提供的访存扩展指令利用 MIPS指令集中的 SPECIAL2的空槽的保 留值来定义扩展指令。
通过指令完成使能位置 1操作, 为 X86浮点栈模式置位, 允许用户使用 x86浮点栈进行浮点操作。
步骤 2220, 清除栈操作模式, 浮点栈使能位置 0, 不允许用户模拟浮点 寄存器栈进行浮点栈操作;
作为一种可实施方式, 本发明实施例清模拟浮点栈模式, X86 浮点栈模 式置位 0的指令格式为: CLRTM
其为 X86浮点栈模式清位,不允许用户使用 x86浮点桟,而只能使用 MIPS 处理器的浮点寄存器进行浮点操作。
该置位、 清零的栈指针操作指令可以分别完成浮点寄存器桟的激活、 禁 用工作。
步骤 2230, 栈操作指针值增 1, 即 TOP指针的值增 1 ;
作为一种可实施方式,本发明实施例栈指针值增 1, 即 TOP指针的值增 1 的指令格式为: INCTOP 步骤 2240, 桟操作指针值减 1, 即 TOP指针的值减 1 ;
作为一种可实施方式,本发明实施例栈指针值减 1, 即 TOP指针的值减 1 的指令格式为: DECTOP
该 TOP指针的值增 1、 减 1指令可以分别模拟 X86处理器浮点桟中的入 栈、 出栈工作;
步骤 2250, 读桟操作指针值, 即读出 TOP指针的值;
作为一种可实施方式,本发明实施例读出 TOP指针值操作的指令格式为- MFTOP rd
其指令功能为将 X86浮点栈顶指针的值读入寄存器 GPR[rd]。
步骤 2260,写桟操作指针值,即在指针寄存器中写入当前 TOP指针的值。 作为一种可实施方式, 本发明实施例完成写 TOP指针值操作的指令格式 为: MTTOP imm
其指令功能为将三位的立即数 imm写入 x86浮点栈顶指针。
该读、 写 TOP指针指令可以方便的控制操作浮点栈。
为了能更好地理解本发明的支持 X86虚拟机的 RISC处理器模拟浮点栈 操作的过程, 下面以加法运算中栈指针操作为例进行说明。
在使能位是 1, TOP指针值为 2时, 运算 add.s $f(6), $f(l), $f(9)在 RISC 处理器内部进行如下转换:
模拟 X86浮点栈操作被激活, 即使能位置 1;
用$ 0)替换 $f(6); 〃6+2 mod 8 =0
用$1(3)替换 $f(l); II 1+2 mod 8 =3
$f(9)无需转换; // 9>7所以无需变换, 直接使用寄存器$ 9) 最终实际进行运算的表达式为 add.s $f(0), $f(3), $f(9).
而此时没有入栈和出栈操作, 所以 TOP值不会发生变化。 同时, 由于浮点栈的存在, 就需要维护一个浮点栈溢出检查机制, 实时 监控浮点栈的状态, 防止浮点桟溢出例外的蔓延。
本发明实施例中, 本发明的 RISC处理器, 所述浮点寄存器栈 83由 8个 可直接进行浮点运算的栈寄存器组成, 按照顺序进行编号, 分别为 0〜7; 本发明实施例的 RISC处理器,所述溢出检查寄存器 72,用于实现与 X86 的浮点标志寄存器中的 TAG的功能, 检测对浮点寄存器栈 83中的栈寄存器 进行浮点访问时会不会发生桟溢出例外, 其为一至少 8位的多位寄存器, 表 示 TAG位, 即溢出检查功能位, 分别表示浮点寄存器栈 83的栈寄存器 0〜7 号的状态。
在本发明实施例中, 选择一个通用寄存器 r(i), 其低 8位由低到高分别表 示浮点寄存器桟 83的栈寄存器 0~7号的状态。
通用寄存器 r(i)的低 8位中, 每位对应一个浮点寄存器栈 83中的栈寄存 器, 每位的值代表不同状态, 其中, 0表示空, 可压栈, 不可出栈, 否则会溢 出; 1表示有效, 不可再压桟, 否则会溢出。
作为一种可实施方式, 本发明的 RISC处理器中, 包括一个由 0~31, 共 32个的多位浮点寄存器组成的浮点寄存器栈 83, 其中 0~7号, 共 8个栈寄存 器, 模拟 X86的浮点寄存器栈 83的 8个栈寄存器; 在 RISC处理器中, 还包 括一个 32位的通用寄存器(定点) r(i), 其低 8位由低到高分别表示浮点寄存 器栈 83的栈寄存器 0~7号的状态, 完成 X86浮点栈机制中的 TAG功能。
所述栈溢出判断模块 43,用于检査指定的浮点寄存器栈 83中的栈寄存器, 并根据栈寄存器的值对溢出检査寄存器 72进行操作, 进行浮点栈溢出检査。
下面进一步详细说明本发明的支持 X86虛拟机的 RISC处理器上进行浮 点栈溢出检查的方法过程,其以 RISC处理器的 8个栈寄存器组成浮点寄存器 栈 83; 以一通用寄存器为溢出检查寄存器 72, 其低 8位模拟 X86的 TAG功 能, 每位对应一个栈寄存器的不同状态。
支持 X86虚拟机的 RISC处理器上进行浮点栈溢出检査的方法过程, 包 括如下步骤:
步骤 21000,检查指定的浮点寄存器栈中的栈寄存器,并根据桟寄存器的 值对溢出检査寄存器 72进行操作, 进行浮点栈溢出检査;
所述步骤 21000包括下列步骤:
步骤 21100,判断浮点寄存器栈中被指定的栈寄存器是否为空,如果为空, 则将指定的溢出检查寄存器 72的 TAG位的相应位置 1, 并继续执行; 否则, 引发浮点栈溢出例外; 歩骤 21200,判断浮点寄存器栈中被指定的栈寄存器是否有效,如果有效, 则将指定的溢出检查寄存器 72的 TAG位的相应位置 0, 并继续执行; 否则, 引发浮点桟溢出例外;
步骤 21300, 判断浮点寄存器栈中被指定的两个栈寄存器是否都有效,如 果都有效, 并且桟寄存器中的数据不需要出栈, 则将指定的溢出检查寄存器 72的 TAG位的值保持, 并继续执行; 否则, 引发浮点栈溢出例外;
步骤 21400, 判断浮点寄存器栈中被指定的两个栈寄存器是否有效, 如果 都有效, 并且有一个栈寄存器中的数据需要出栈, 则将数据出栈的栈寄存器 对应的溢出检査寄存器 72的 TAG位所对应的位置 0, 然后继续执行; 否则, 引发浮点栈溢出例外;
歩骤 21500, 判断浮点寄存器栈中被指定的两个栈寄存器是否有效, 如果 都有效, 并且桟寄存器中的数据都需要出栈, 则将对应的溢出检查寄存器 72 的 TAG位所对应的两位都置 0, 然后继续执行; 否则, 引发浮点栈溢出例外。
下面以对浮点寄存器入桟的操作为例,进一步详细说明 RISC处理器上进 行浮点栈溢出检査的方法。
首先 RISC处理器确定浮点寄存器桟的桟顶,并读取该栈顶的栈寄存器对 应的溢出检查寄存器 72的 TAG位;
RISC处理器根据本发明的浮点寄存器桟,判断确定浮点寄存器栈的桟顶, 并确定对应的本发明的栈顶的栈寄存器对应的溢出捡查寄存器 72的 TAG位, 是一种现有技术, 其不是本发明的发明创造, 本领域技术人员根据本发明实 施例的描述, 可以实现上述操作, 因此, 在本发明中不再一一详细描述说明。
判断栈顶的栈寄存器对应的溢出检查寄存器 72的相应 TAG位是否为 0; 如果是, 则将栈顶的栈寄存器对应的溢出检查寄存器 72的相应 TAG位 置 1, 并将数据写入该栈寄存器, 并结束返回;
如果否, 则引发栈溢出例外。
作为一种可实施的方式,本发明实施例中, 选择通用寄存器 r(3)作为溢出 检查寄存器 r(3)的低 8位, 也就是 bit r(3)_0~bit r(3)_7分别对应浮点寄存器桟 中的栈寄存器 f(0)〜f(7)的状态。
1 ) 如果遇到入栈操作, 并且栈顶在桟寄存器 f(5);
则判断溢出检查寄存器 r(3)的第 5位, 也就是 bit r(3)_4是否为 0; 如果为 0, 则先将溢出检查寄存器的 bit r(3)—4置 1, 然后将数据入栈, 存 入栈寄存器 5:);
如果为 1, 则引发栈溢出例外。
2) 如果出栈操作, 并且栈顶在栈寄存器 f(5;i,
则判断溢出检查寄存器 r(3)的第 5位, 也就是 bit r(3)_4是否为 1;
如果为 1, 则先将溢出检査寄存器的 bit r(3)—4清零, 然后将数据出栈, 存入指定的浮点寄存器;
如果为 0, 则引发栈溢出例外。
3 ) 如果是运算操作, 并且两个源操作数分别在栈寄存器 f(4)和 f(5)中, 则判断溢出检査寄存器 r(3)的第 4位, 也就是 bit r(3)_3是否为 1;
如果为 0, 则引发栈溢出例外;
如果为 1, 则继续下面的步骤:
则判断溢出检查寄存器 r(3)的第 5位, 也就是 bit r(3)_4是否为 1;
如果为 1, 则继续运算操作;
如果为 0, 则引发栈溢出例外。
4)如果是运算并出栈操作,并且两个源操作数分别在栈寄存器 f(4)和 f(5) 中;
如果栈顶在栈寄存器 f(5), 则判断溢出检查寄存器 r(3)的第 5位, 也就是 bit r(3)—4是否为 1 ;
如果为 0, 则引发栈溢出例外;
如果为 1, 则继续下面的步骤:
判断溢出检查寄存器 r(3)的第 4位, 也就是 bit r(3)_3是否为 1;
如果为 0, 则引发栈溢出例外;
如果为 1, 则继续下面的步骤:
先将溢出检查寄存器的第 5位, 也就是 bit r(3)—4清零, 然后继续运算操 作;
5 )如果是运算并连续出栈操作, 并且两个源操作数分别在栈寄存1器 f(4) 和 f(5)中;
则判断溢出检査寄存器 r(3)的第 4位, 也就是 bit r(3)—3是否为 1 ;
如果为 0, 则引发栈溢出例外; 如果为 1, 则将溢出检查寄存器的第 4位, 也就是 bit r(3)— 3清零, 然后 继续下面的步骤:
判断溢出检查寄存器 r(3)的第 5位, 也就是 bit r(3)— 4是否为 1 ;
如果为 1, 则将溢出检査寄存器的第 5位, 也就是 bit r(3)_4清零, 然后 继续运算操作;
如果为 0, 则引发桟溢出例外。 下面详细描述当处理器支持 XS6虚拟机的数据处理过程为对 X86存储结 构的支持时, 本发明 RISC处理器的数据处理过程。
由于 X86处理器中段寄存器的存在, 即使在用户态下, X86的存储访问 寻址和保护方式也比较特殊。 因此, 本发明提供支持带判断访存地址是否越 界的存取操作, 即 load和 store操作的源寄存器中, 有一个 bound寄存器既不 用来计算地址, 也不用来存放数据, 而是用来对访问地址进行比较, 如果发 现访问地址越出该 bound寄存器规定的边界, 就报地址越界例外。
地址界限分为上界或者下界, 访存的有效地址要保证不能大于上界或者 不能小于下界。 这些指令如果访存地址满足条件则正常访存, 否则引发地址 错例外。 在 RISC处理器上支持虚拟机,当进行从 X86指令集到 RISC处理器 MIPS 指令集的翻译过程中出现访存操作时, 增加了对访存地址的判断, 判断访存 地址是否越界, 进而对 X86访存操作的翻译提高速度。
作为一种可实施方式, 本发明实施例所述物理寄存器堆的上界地址寄存 器, 用于存储作为上界的有效地址; 以及下界地址寄存器, 用于存储作为下 界的有效地址。
所述上界、 下界地址寄存器可以是物理寄存器中任一通用寄存器。
所述上下界判断模块, 用于在访存指令中, 根据上界地址寄存器中存储的 上界地址和 /或下界地址寄存器中存储的下界地址, 判断指令操作数地址的有 效性。
在 MIPS指令集中的每条访存指令, 如 load指令或者 store指令中, 增加 界限的判断,这些指令如果访存地址满足条件则正常访存,否则引发 MPS中 的地址错例外。 指令译码后, 寄存器中的地址界限作为指令的一个寄存器操作数, 当操 作内容数据根据 base方式形成有效地址后, 该有效地址首先跟寄存器中的地 址界限比较, 如果符合指令的语义条件, 即如果寄存器为上界地址寄存器, 该有效地址小于或者等于寄存器中的地址界限, 或者如果寄存器为下界地址 寄存器, 该有效地址大于或者等于寄存器中的地址界限, 那么完成正常的该 存操作; 否则引发地址错例外。
本发明实施例中, 作为一种可实施方式, 对 MIPS指令集中的共 24条访 存指令, 包括 load指令和 store指令, 增加界限判断。
其中:
12条 load指令, 包含 8条定点指令, 4条浮点指令, 寻址方式都是 base 方式。
这些指令分别为带上边界条件的取字节、 带下边界条件的取字节、 带上 边界条件的取半字、 带下边界条件的取半字、 带上边界条件的取字、 带下边 界条件的取字、 带上边界条件的取双字、 带下边界条件的取双字、 带上边界 条件的取单精度浮点数、 带下边界条件的取单精度浮点数、 带上边界条件的 取双精度浮点数、 带下边界条件的取双精度浮点数指令中的一种或者一种以 上组合。
指令的详细描述如下:
gsLBLE rt, base, bound
先从 GPR[base]的内容中得到有效地址, 如果有效地址不小于等于
GPR[bound]中的内容, 则发出地址错例外; 否则根据这个有效地址从内存中 取出 8位字节数据, 将这个数据进行符号位扩展后存到 GPR[rt]。 gsLBGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则根据这个有效地址从内存中取出 8位字 节数据, 将这个数据进行符号位扩展后存到 GPR[rt]。 gsLHLE rt, base, bound 先从 GPR[base]的内容中得到有效地址, 如果有效地址不小于等于 GPR[bOUnd]中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从 内存中取出 16位半字数据, 将这个数据进行符号位扩展后存到 GPR[rt]。
较佳地, 所述有效地址是对齐的, 如果低 1 位地址中任何一位非零, 则 发生地址错例外。 gsLHGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则根据这个有效地址从内存中取出 16位半 字数据, 将这个数据进行符号位扩展后存到 GPR[rt]。
较佳地, 所述有效地址是对齐的, 如果低 1 位地址中任何一位非零, 则 发生地址错例外。 gsLWLE rt, base, bound
先从 GPR[base]的内容中得到有效地址, 如果有效地址不小于等于
GPR[boimd]中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从 内存中取出 32位字数据, 将这个数据进行符号位扩展后存到 GPR[rt]。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsLWGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从内存中取出 32位字数据, 将这个数据进行符号位扩展后存到 GPR[rt]。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsLDLE rt, base, bound 先从 GPR[base]的内容得到有效地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外: 否则根据这个对齐的有效地址从 内存中取出 64位双字到 GPR[rt]。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 gsLDGT rt, base, bound
先从 GPR[base]的内容得到有效地址, 如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外: 否则根据这个对齐的有效地址从内存中取出 64位双字到 GPR[rt]。
较佳地, 所述有效地址是对齐的, 如果低 3 位地址中任何一位非零, 则 发生地址错例外。 gsLWLECl ft, base, bound
先从 GPR[base]的内容中得到有效地址, 如果有效地址不小于等于
GPR[bound]中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从 内存中取出 32位数据存到 FPR[ft]的低 32位。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsLWGTCl ft, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从内存中取出 32位数据存到 FPR[ft]的低 32位。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsLDLECl ft, base, bound 先从 GPR[baSe]的内容得到有效地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外: 否则根据这个对齐的有效地址从 内存中取出 64位数据存到 FPR[ft]。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 gsLDGTC 1 ft, base, bound
先从 GPR[base]的内容得到有效地址, 如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外: 否则根据这个对齐的有效地址从内存中取出 64位数据存到 FPR[ft]。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 本发明实施例利用现有 MIPS64指令集中保留的 LWC2和 SWC2空槽的 值来定义。由于 MIPS64指令集的 32位指令码的高 6位(31bit: 26bit)为 opcode 域。 LWC2 (opcode为 110010)和 SWC2 (opcode为 111010)指令槽按 MIPS 的规定是可以由用户自主定义的。
12条 store指令, 包含 8条定点指令, 4条浮点指令, 寻址方式都是 base 方式。
这些指令分别为带上边界条件的存字节、 带下边界条件的存字节、 带上 边界条件的存半字、 带下边界条件的存半字、 带上边界条件的存字、 带下边 界条件的存字、 带上边界条件的存双字、 带下边界条件的存双字、 带上边界 条件的存单精度浮点数、 带下边界条件的存单精度浮点数、 带上边界条件的 存双精度浮点数、 带下边界条件的存双精度浮点数指令中的一种或者一种以 上组合。
指令的详细描述如下:
gsSBLE rt, base, bound 先从 GPR[base]的内容中得到有效地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 8位字节数据 内容保存到内存中这个有效地址。 gsSBGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 8位字节数据内容保存到 内存中这个有效地址。 gsSHLE rt, base, bound
先从 GPR[base]的内容中得到有效地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 16位半字数 据内容保存到内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 1 位地址中任何一位非零, 则 发生地址错例外。 gsSHGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 16位半字数据内容保存 到内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 1 位地址中任何一位非零, 则 发生地址错例外。 gsSWLE rt, base, bound
先从 GPR[baSe]的内容中得到有效地址, 如果有效地址不小于等于
GPR[bound]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 32位字数据 内容保存到内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsSWGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 32位字数据内容保存到 内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsSDLE rt, base, bound
先从 GPR[baSe]的内容中得到有效地址, 如果有效地址不小于等于 GPR[boimd]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 64位双字内 容保存到内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 gsSDGT rt, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 64位双字内容保存到内 存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 gsSWLECl ft, base, bound
先从 GPR[baSe]的内容中得到有效地址, 如果有效地址不小于等于 GPR[bound]中的内容,则发出地址错例外;否则将 FPR[ft]中的低 32位字数据 内容保存到内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsSWGTCl ft, base, bound 先从 GPR[base〗的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容,则发出地址错例外;否则将 FPR[ft]中的低 32位字数据内容保存到 内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 gsSDLECl ft, base, bound
先从 GPR[baSe]的内容中得到有效地址, 如果有效地址不小于等于 GPR[bound]中的内容,则发出地址错例外;否则将 FPR[ft]中的 64位双字内容 保存到内存中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 gsSDGTCl ft, base, bound
先从 GPR[base]的内容中得到有效地址,如果有效地址不大于 GPR[bound] 中的内容,则发出地址错例外;否则将 FPR[ft]中的 64位双字内容保存到内存 中这个对齐的有效地址。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 在同时判断上下界的指令中, 地址要同时满足上界条件和下界条件, 一 旦有一个边界不满足就会发出越界例外。 所述上下界判断模块, 用于在访存指令中, 根据上界地址寄存器中存储 的上界地址和 /或下界地址寄存器中存储的下界地址,判断指令地址的有效性。
作为一种可实施方式, 在 RISC处理器 MIPS指令集中增加两条指令, 用 于进行寄存器值的比较, 这两条指令用于地址是否越界的判断, 如果地址满 足条件则空操作, 否则引发 RISC处理器中的地址错例外。
另外, 实现两条指令 gsLE rs, rt和 gsGT rs, rt。
指令的详细描述如下: gsLE rs, rt
比较寄存器中的值, 置条件地址错例外。
比较通用寄存器 GPR [rs]和通用寄存器 GPR [rt〗中的值, 如果 GPR [rs]中 的值小于等于 GPR [rt]中的值, 则顺序执行下一条指令; 否则引发 add例外。 gsGT rs, rt
比较寄存器中的值, 置条件地址错例外。
比较通用寄存器 GPR [rs]和通用寄存器 GPR [rt]中的值, 如果 GPR [rs]中 的值大于 GPR [rt]中的值, 则顺序执行下一条指令; 否则引发 add例外。 这两条指令用于地址比较, rs寄存器中存放地址界限值, rt寄存器存放待 比较的有效地址, 如果满足条件则顺序执行下一条指令, 否则引发地址错例 这两条指令分别比较通用寄存器 GPR[rs]和通用寄存器 GPR[rt]中的值, 如果 GPR[rs]中的值小于等于或者大于 GPR[rt]中的值, 其中, 小于等于是对 于 gsLE rs, rt而言的; 大于是对于 gsGT rs, rt而言的, 则顺序执行下一条指 令; 否则引发地址错例外。
本发明支持 X86虚拟机的 RISC处理器的有界访存过程, 包括如下步骤: 步骤 31, 在 RISC处理器的 X86虚拟机中, 设置物理寄存器堆中两个通 用寄存器分别为上界、 下界地址寄存器 74。
其中, 上界地址寄存器存储作为上界的有效地址; 下界地址寄存器存储 作为下界的有效地址。
步骤 32, 在进行 X86虛拟机指令集到 MIPS指令集翻译时, 译码器将指 令进行译码, 得到可被 RISC处理器处理的二进制代码。
步骤 33, 定点运算部件 3在译码后的访存指令中, 根据上界地址寄存器 中存储的上界地址和 /或下界地址寄存器中存储的下界地址, 判断指令操作数 地址的有效性。
在 MIPS指令集中的每条访存指令, 如 load指令或者 store指令中, 增加 界限的判断,这些指令如果访存地址满足条件则正常访存,否则引发 MIPS中 的地址错例外。 所述歩骤 33包括下列步骤:
步骤 331,指令译码后,寄存器中的地址界限作为指令的一个寄存操作数, 操作内容数据根据 base方式形成有效地址;
步骤 332, 该有效地址首先跟寄存器中的地址界限比较;
步骤 333, 如果符合指令的语义条件, 即如果寄存器为上界地址寄存器, 该有效地址小于或者等于寄存器中的地址界限; 或者如果寄存器为下界地址 寄存器, 该有效地址大于或者等于寄存器中的地址界限, 那么完成正常的该 存操作; 否则引发地址错例外。
具体地, 所述步骤 333, 对于取操作数(load)指令操作, 贝 IJ :
如果为带上边界条件的取字节指令,则先从 GPR[base]的内容中得到有效 地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外; 否则根据这个有效地址从内存中取出 8位字节数据, 将这个数据进行符号位 扩展后存到 GPR[rt], 即 gsLBLE rt, base, bound。 如果为带下边界条件的取字节指令,则先从 GPR[baSe]的内容中得到有效 地址, 如果有效地址不大于 GPR[boimd]中的内容, 则发出地址错例外; 否则 根据这个有效地址从内存中取出 8位字节数据, 将这个数据进行符号位扩展 后存到 GPR[rt], 艮 P gsLBGT rt, base, bound 0 如果为带上边界条件的取半字指令,则先从 GPR[base]的内容中得到有效 地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从内存中取出 16位半字数据, 将这个数据进行 符号位扩展后存到 GPR[rt], 即 gsLHLE rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 1位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的取半字, 则先从 GPR[baSe]的内容中得到有效地 址, 如果有效地址不大于 GPR[boimd]中的内容, 则发出地址错例外; 否则根 据这个有效地址从内存中取出 16位半字数据, 将这个数据进行符号位扩展后 存到 GPR[rt], 即 gsLHGT rt, base, bound。 较佳地, 所述有效地址是对齐的, 如果低 1位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的取字指令,则先从 GPR[baSe]的内容中得到有效地 址, 如果有效地址不小于等于 GPR[b0imd]中的内容, 则发出地址错例外; 否 则根据这个对齐的有效地址从内存中取出 32位字数据, 将这个数据进行符号 位扩展后存到 GPR[rt], 即 gsLWLE rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的取字指令,则先从 GPR[baSe]的内容中得到有效地 址, 如果有效地址不大于 GPR[bound]中的内容, 则发出地址错例外; 否则根 据这个对齐的有效地址从内存中取出 32位字数据, 将这个数据进行符号位扩 展后存到 GPR[rt], S卩 gsLWGT rt, base, boimd。
较佳地, 有效地址是对齐的, 如果低 2位地址中任何一位非零, 则发生 地址错例外。 如果为带上边界条件的取双字指令,则先从 GPR[base]的内容得到有效地 址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外: 否 则根据这个对齐的有效地址从内存中取出 64位双字到 GPR[rt] , 即 gsLDLE rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的取双字指令,则先从 GPR[baSe]的内容得到有效地 址, 如果有效地址不大于 GPR[boimd]中的内容, 则发出地址错例外: 否则根 据这个对齐的有效地址从内存中取出 64位双字到 GPR[rt], 即 gsLDGT rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的取单精度浮点数,则先从 GPR[baSe]的内容中得到 有效地址, 如果有效地址不小于等于 GPR[bomid]中的内容, 则发出地址错例 夕卜; 否则根据这个对齐的有效地址从内存中取出 32位数据存到 FPR[ft]的低 32位, 即 gsLWLECl ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的取单精度浮点数,则先从 GPRCbase]的内容中得到 有效地址, 如果有效地址不大于 GPR[bound]中的内容, 则发出地址错例外; 否则根据这个对齐的有效地址从内存中取出 32位数据存到 FPR[ft]的低 32位, 艮 P gsLWGTCl ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的取双精度浮点数,则先从 GPR[baSe]的内容得到有 效地址,如果有效地址不小于等于 GPR[bound]中的内容,则发出地址错例外: 否则根据这个对齐的有效地址从内存中取出 64 位数据存到 FPR[ft], 即 gsLDLECl ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3 位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的取双精度浮点数,则先从 GPR[baSe]的内容得到有 效地址, 如果有效地址不大于 GPR[boimd]中的内容, 则发出地址错例外: 否 则根据这个对齐的有效地址从内存中取出 64 位数据存到 FPR[ft], 即 gsLDGTC 1 ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 所述步骤 S330, 对于存操作数 (store) 指令操作, 贝 如果为带上边界条件的存字节指令,则先从 GPR[baSe]的内容中得到有效 地址, 如果有效地址不小于等于 GPR[boimd]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 8位字节数据内容保存到内存中这个有效地址,即 gsSBLE rt, base, bound。 如果为带下边界条件的存字节指令,则先从 GPRtbase]的内容中得到有效 地址, 如果有效地址不大于 GPR[bound]中的内容, 则发出地址错例外; 否则 将 GPR[rt]中的 8位字节数据内容保存到内存中这个有效地址, 即 gsSBGT rt, base, bound 如果为带上边界条件的存半字指令,则先从 GPR[baSe]的内容中得到有效 地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地吃错例外; 否则将 GPR[rt]中的 16位半字数据内容保存到内存中这个对齐的有效地址, 艮卩 gsSHLE rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 1 位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的存半字指令,则先从 GPR[base]的内容中得到有效 地址, 如果有效地址不大于 GPR[boimd]中的内容, 则发出地址错例外; 否则 将 GPR[rt]中的 16位半字数据内容保存到内存中这个对齐的有效地址, 即 gsSHGT rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 1 位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的存字指令,则先从 GPR[base]的内容中得到有效地 址, 如果有效地址不小于等于 GPR[boimd]中的内容, 则发出地址错例外; 否 则将 GPR[rt]中的 32位字数据内容保存到内存中这个对齐的有效地址, 即 gsSWLE rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的存字指令,则先从 GPR[baSe]的内容中得到有效地 址, 如果有效地址不大于 GPR[boimd]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 32位字数据内容保存到内存中这个对齐的有效地址,即 gsSWGT rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的存双字指令,则先从 GPRCbase]的内容中得到有效 地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例外; 否则将 GPR[rt]中的 64位双字内容保存到内存中这个对齐的有效地址, 即 gsSDLE rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的存双字指令,则先从 GPR[baSe]的内容中得到有效 地址, 如果有效地址不大于 GPR[bound]中的内容, 则发出地址错例外; 否则 将 GPR[rt]中的 64位双字内容保存到内存中这个对齐的有效地址。即 gsSDGT rt, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的存单精度浮点数,则先从 GPR[base]的内容中得到 有效地址, 如果有效地址不小于等于 GPR[boimd]中的内容, 则发出地址错例 外;否则将 FPR[ft]中的低 32位字数据内容保存到内存中这个对齐的有效地址, 艮口 gsSWLECl ft, base, boundo
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的存单精度浮点数,则先从 GPR[baSe]的内容中得到 有效地址, 如果有效地址不大于 GPR[bound]中的内容, 则发出地址错例外; 否则将 FPR[ft]中的低 32位字数据内容保存到内存中这个对齐的有效地址,即 gsSWGTCl ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 2位地址中任何一位非零, 则 发生地址错例外。 如果为带上边界条件的存双精度浮点数,则先从 GPR[baSe]的内容中得到 有效地址, 如果有效地址不小于等于 GPR[bound]中的内容, 则发出地址错例 夕卜;否则将 FPR[ft]中的 64位双字内容保存到内存中这个对齐的有效地址, 即 gsSDLECl ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 如果为带下边界条件的存双精度浮点数,则先从 GPR[baSe]的内容中得到 有效地址, 如果有效地址不大于 GPR[bound]中的内容, 则发出地址错例外; 否则将 FPR[ft]中的 64位双字内容保存到内存中这个对齐的有效地址, 即 gsSDGTC 1 ft, base, bound。
较佳地, 所述有效地址是对齐的, 如果低 3位地址中任何一位非零, 则 发生地址错例外。 所述步骤 33还包括下列步骤:
步骤 334,在同时判断上下界的指令中,地址要同时满足上界条件和下界 条件, 一旦有一个边界不满足就发出越界例外。 更佳地, 所述步骤 S300之后还包括下列步骤:
步骤 34, 在访存指令中, 根据上界地址寄存器中存储的上界地址和 /或下 界地址寄存器中存储的下界地址, 判断指令地址的有效性。
所述步骤 34包括下列步骤: 步骤 341, 在取操作数(load)指令中, 比较通用寄存器 GPR [rs], 即上 界地址寄存器和通用寄存器 GPR [rt],即下界地址寄存器中的值,如果 GPR [rs] 中的值小于等于 GPR [rt]中的值,则顺序执行下一条指令;否则引发 adel例夕卜, 艮卩 gsLE rs, rt。
步骤 342, 在写操作数(store)指令中, 比较通用寄存器 GPR [rs], 即上 界地址寄存器和通用寄存器 GPR [rt],即下界地址寄存器中的值,如果 GPR [rs] 中的值大于 GPR [rt]中的值, 则顺序执行下一条指令; 否则引发 add例外, 即 gsGT rs, rt。
本发明 RISC处理器的有界访存方法, 在 RISC处理器支持的虚拟机中, 从 X86虚拟机指令翻译到 MIPS指令集的二进制代码,在 RISC处理器上运行 时, 提高运行的速度, 而将对虚拟机运行的速度影响降低, 提高虚拟机的运 行效率。 下面详细描述当处理器支持 X86虚拟机的数据处理过程为对虚拟机制的 支持时, RISC处理器装置支持 X86虚拟机的数据处理方法过程。
除了 X86指令和 RISC处理器指令之间的功能差别外, 虚拟机系统本身 的开销也会引起虚拟机性能的降低, 因此, 需要对虚拟机的实现机制本身提 供必要的支持, 主要包括以下三个方面:
N1 )虚拟机代码和翻译后的 MIPS代码切换的支持
在虚拟机的设计中, X86通用寄存器已经映射到固定的 MIPS寄存器,但 是在虚拟机的代码和翻译后的 MIPS代码两种上下文切换时,需要保存或者恢 复这些固定的 MIPS寄存器的值,以保证这些寄存器在两种上下文中都可以自 由的使用, 而不互相干扰。
本发明提供数据宽度是原有数据宽度 2倍的访存扩展指令, 加快虚拟机 上下文切换的同时也可以用于提高性能。
本发明的支持 X86虚拟机的 RISC处理器模式识别模块 24, 包括对多倍 数据宽度进行访存指令。 所述多倍数据宽度访存指令包括对多倍数据宽度的 读取内存、 写入内存、 以及对浮点寄存器的多倍数据宽度的读取内存、 写入 内存共四类多倍数据宽度访存扩展指令。 W 200 作为一种可实施方式, 本发明一共提出了四条多倍数据宽度的访存扩展 指令, 包括双倍数据宽度的读取内存、 写入内存指令, 以及对浮点寄存器的 双倍数据宽度的读取内存、 写入内存指令。
作为一种可实施方式, 本发明提供的多倍数据宽度扩展指令利用现有 MPS64指令集中保留的 LWC2和 SWC2空槽的值, 其中 32位指令的高 6位 Olbit: 26bit)为 opcode域。其中 LWC2 (opcode为 110010)和 SWC2 (opcode 为 111010)指令槽都是 MIPS规定的可以由用户自主定义的。 其访存的寻址 方式是 base+8 bits offset的寻址方式。
其中, 5 位的 base 域表示基址, 5 位的 rt ( Register Target (Source/Destination) ) 域表示源 /目标寄存器, offset表示偏移地址, 最后 6 位的 fonc域用于区分各条扩展指令。
本发明的四条扩展指令是 MIPS64指令集中给用户扩展的自定义指令。 对于存数指令 SQ, 译码器输出一个内部的 sq操作;
对于取数指令 LQ, 译码器输出两个相邻的内部操作 lql和 lq2, 其中 lql 带有 LQ指令的低 64位逻辑寄存器号, lq2带有 LQ指令的高 64位逻辑寄存 器号。
译码器 2对指令进行译码后送到访存执行单元 5的发射队列 (未示出) , 发射队列从中选取操作数准备好的操作, 发射到访存执行单元 5 的访存部件 (未示出) 。
对于读取内存的四个字的共 128位取数指令操作, 所述访存执行单元 5 的合并单元, 把两个内部操作在进入发射队列时进行合并。 合并的方法是如 果发现相邻的将要进入队列的两个操作是四个字的 128位取数指令译码而成, 则后一个操作不进入发射队列, 而将其目的物理寄存器号存入前一操作的高 64位目的物理寄存器号。
合并后的取数操作有两个目的物理寄存器号, 在地址确定 (对应源物理 寄存器准备好) 时会发射到访存执行单元 5的访存部件执行。
访存执行单元 5是执行存取数据的部件, 其根据指令从内存中取出数据 或者把数据存放到内存中。 这个过程是现有的标准技术, 对本领域技术人员 是显而易见的, 因此, 本发明实施例中不再一一详细描述。 下面对双倍数据宽度的读取内存、 写入内存指令, 以及对浮点寄存器的 双倍数据宽度的读取内存、 写入内存指令共四条指令进行说明:
gsLQ rt, of set(base) /读取四字数据到内存
从内存中取四字存入到寄存器中, 先将带符号的 8位 offset和 GPR[base] 的内容相加得到有效地址, 再根据这个对齐的有效地址从内存中取出 128位 四字, '存放到相邻的 2个通用寄存器中。
如果 rt为偶数, 则存放到寄存器 rt和 rt+1中; 如果 rt为奇数, 则存放到 寄存器 rt- 1和 rt中。
有效地址是对齐的, 如果低 4位地址中任何一位非零, 则发生地址错例 外。 gsLQCl ft, offset(base) /四字数据写入内存
先将带符号的 8位 offset和 GPR[baSe]的内容相加得到有效地址, 再根据 这个对齐的有效地址从内存中取出 128位四字, 存放到相邻的 2个浮点寄存 器中。
如果 ft为偶数, 则存放到寄存器 ft和 ft+1中; 如果 ft为奇数, 则存放到 寄存器 ft-1和 ft中。
有效地址是对齐的, 如果低 4位地址中任何一位非零, 则发生地址错例
gsSQ rt, offset(base) /存四字数据到内存
先将带符号的 8位 offset和 GPR[baSe]的内容相加得到有效地址, 然后将 相邻 2个通用寄存器中的四字存放到内存中的有效地址中。
如果 rt为偶数, 则取出寄存器 rt和 rt+1中的值存放到内存; 如果 rt为奇 数, 则取出寄存器 rt-1和 rt中的值存放到内存。
有效地址是对齐的, 如果低 4位地址中任何一位非零, 则发生地址错例 外。 gsSQCl ft, offset(base) /从浮点寄存器存四字到内存 先将带符号的 8位 offset和 GPR[base]的内容相加得到有效地址, 然后将 相邻 2个浮点寄存器中的四字存放到内存中的有效地址中。 如果 ft为偶数, 则取出寄存器 ft和 ft+1中的值存放到内存;如果 ft为奇数,则取出寄存器 ft-1 和 ft中的值存放到内存。
有效地址必须是对齐的, 如果低 4位地址中任何一位非零, 则发生地址 错例外。
为本发明支持 X86虛拟机的 RISC处理器的数据访存方法, 其包括下列 步骤:
步骤 N110, 处理器首先取出一条指令输入到译码器;
步骤 N120, 译码器判断指令类型, 识别并译码多倍数据宽度指令; 如果是现有的 MIPS指令集中的指令,译码器就将其译为内部操作, 比如 给出相应的 OP, 源寄存器和目标寄存器等;
如果输入的指令是本发明提出的多倍访存扩展指令操作, 译码器将源 /或 目标寄存器由一个自动扩展成两个成对的寄存器;
如果 rt为偶数, 则存放到寄存器 rt和 rt+1中; 如果 rt为奇数, 则存放到 寄存器 rt-1和 rt中。
如果输入指令是多倍数据宽度的读取指令时, 译码器将目标寄存器由一 个自动扩展成多个相邻的寄存器, 并将读取操作分配到多个内部操作里, 多 个成对的寄存器分别为这多个内部操作的目标寄存器。
如果输入指令是多倍数据宽度的存储指令时, 译码器将源寄存器由一个 扩展成多个相邻的寄存器。
处理器首先取出一条指令输入到译码器, 译码器判断指令类型, 如果是 原有 MIPS指令集中的指令,译码器就将其译为内部操作,例如给出相应的操 作 (OP) , 源寄存器械和目标寄存器等, 输出到存储运算部件执行; 如果输 入的指令是本发明提出的访存扩展指令中的存储操作, 译码器将源 /或目标寄 存器由一个自动扩展成两个成对的寄存器, 然后输出到存储运算部件执行。
处理器首先取出一条指令输入到译码器, 译码器判断指令类型, 并转换 成内部操作。 内部操作的编码对处理器的功能部件而言比指令更规整, 有利 于简化内部逻辑。 RISC处理器中, 通常外部的指令到内部操作是一一映射。 译码器输出的内部操作由若干个域组成, 如操作码 (op)、扩展操作码 (felt)、源 寄存器号、 目的寄存器号、 立即数等。
步骤 N130, 将译码后的多倍数据宽度指令发送到访存执行单元 5执行操 作。
译码器对输入指令译码后 ,发送到访存执行单元 5,在访存执行单元 5中, 如果是读取操作指令,则读取操作指令 LQ的 2个内部操作 lql, lq2合并成一 个操作, 送到访存执行单元 5的访存部件执行。
如果输入的指令是本发明提出的访存扩展指令中的四个字共 128位的存 数指令 SQ, 译码器 3将源寄存器号由一个扩展成两个成对的寄存器号。 比如 4号寄存器扩展成 4、 5两个寄存器号; 7号寄存器扩展成 6、 7两个。 作为内 部操作的两个源寄存器号送到访存执行单元 5的发射队列。
如果输入的指令是本发明提出的访存扩展指令中的读取操作, 译码器将 该读取操作译码为两条内部操作, 同样将目标寄存器由一个自动扩展为两个 成对的寄存器, 然后分配到上述两个内部操作里, 输出到访存执行单元 5执 行, 然后将其合并成一个操作送到访存执行单元 5的访存部件中执行。
也就是说, 如果输入的指令是本发明提出的访存扩展指令中的四个字共 128位的存数指令 LQ, 译码器将目标寄存器号由一个扩展成两个成对的寄存 器号。并且拆成两个相邻的内部操作 lql、 lq2,分别带上这两个目标寄存器号, 送入访存执行单元 5的发射队列。 访存执行单元 5接收来自译码器的内部操 作, 选择其中源物理寄存器准备好的那些发射到访存执行单元 5的访存部件。 LQ指令作为一个访存操作发射到访存部件, 因此由访存执行单元 5的合并模 块完成两个内部操作的合并。方法是把 lq2的目的物理寄存器存入 lql操作的 高 64位目的物理寄存器中, lq2本身并不进入发射队列。 访存部件执行访存 操作, 对于 lql, 在结果中有两个值域, 分别写入对应的物理寄存器。
N2) 区分翻译后的代码是否处于 X86模式下
在 RISC处理器上支持 X86虚拟机, 对于一条指令来说需要区分其是处 于原有的指令集模式下还是处于 X86模式下。 例如, 以 PS指令集为例, 对于架法指令来说, PS指令集中对加法的处理是进行两个数的相加操作, 但是对于 X86指令集来说, 加法指令不仅要计算两个操作数相加, 还要依据 加法的结果修改相应的 EFLAG中的标志位。
本发明针对上述问题,提供方法用于区分一条 RISC指令是否运行于 X86 虚拟机模式下。
根据不同指令的使用频度, 本发明提供三种区分方式:
( 1 )控制位标志执行方法: 本发明在 RISC处理器中设置专门的控制位 x86mode标志, 当该位为 1时表示此时刻相应的指令运行在 x86模式下; 当 该标志为 0时表示指令运行在非 X86模式下。
(2)前缀指令执行方法: 本发明增加设置一条前缀指令 SETFLAG, 表 示其后的指令处于 X86模式下。 根据前缀指令影响范围的不同, 又分为两种 方式, 一种是前缀指令只影响其后一条指令, 一种是前缀指令影响其后若干 条指令。
(3 )专用指令方法: 本发明对于指令频度特别高的 X86指令, 则需要在 指令集中设置专门的指令来进行一对一的对应, 以提高效率。 所述设置的指 令又可以归为两大类: 一种对 X86指令集中与 EFLAG标志相关的指令一一 对应的指令, 另一种是对 X86指令集中的特殊结构进行操作的指令, 如浮点 栈操作的指令进行对应的指令, 新增加设置的指令提供专门的指令对 X86指 令进行部分的支持, 以减少相应的开销。 本发明的支持 X86虚拟机的 RISC处理器装置的模式识别模块 24, 用于 区分指令的虚拟机指令集模式。
本发明的 RISC处理器装置中,译码器除了具有现有技术的数据通路, 包 括了译码的输入输出, 指令译码功能以外, 还可以根据模式识别模块 24区分 指令的虚拟机指令集模式, 然后该译码器将指令按照所区分的虚拟机指令集 模式进行译码后输出给定点运算部件 3,其增强了现有译码器的功能,直接译 码, 提高了处理器运算速度。
定点运算部件 3接收到译码指令后, 进行处理, 输出执行的结果。
定点运算部件 3 除具有现有技术的数据通路, 包括指令输入输出, 指令 执行外, 还可以由译码器 2对指令区分其指令集模式后, 由定点运算部件 3 根据不同的指令模式执行相应的计算, 输出执行的结果。 (一)
作为一种可实施的方式, 本发明的 RISC处理器装置的模式识别模块 24, 为一虚拟机模式控制寄存器 73, 所述虚拟机模式控制寄存器 73, 包括控制位 标志 X86MODE1 ,当该位为 1时表示此时相应的指令运行在 X86虚拟机指令 集模式下; 当该标志为 0时表示此时相应的指令运行在非 X86虚拟机指令集 模式下。
在 RISC处理器的 MIPS64指令集中, 有一些 CoprocessorO (CP0)控制 寄存器是预留给用户自定义的, 如 22号寄存器在所有 Sel位的情况下都是预 留给用户自定义的。
本发明实施例利用这些控制寄存器(CP0) 中的一位来做 X86模式控制 标志位 X86MODE1, 在需要区分指令所处模式的时候, 可以通过读取这个控 制寄存器的相应位来进行判断。 当该标志位为 1 时表示此时相应的指令运行 在 X86虚拟机指令集模式下; 当该标志位为 0时表示此时相应的指令运行在 非 X86虚拟机指令集模式下。
当 RISC处理器取指令, 由译码器 2进行译码并执行时, 译码器 2首先读 取虚拟机模式控制寄存器 73的控制位标志 X86MODE1 ,根据标志位的值为 0 或 1 区分的虚拟机指令集模式, 并按其虚拟机指令集模式译码, 直到虚拟机 模式控制寄存器 73的控制位标志 X86MODE1被改写。
如一条加法指令进入译码器时, RISC处理器对相应的控制寄存器进行判 断, 区分其为 X86虚拟机指令集模式或者非 X86虚拟机指令集模式。
所述定点运算部件 3的标志运算模块 32, 用于根据输入指令进行运算, 然后根据运算结果计算相应的 EFLAG标志位。
(二)
作为一种可实施的方式, 本发明的 RISC处理器装置, 所述模式识别模块 24为一包括在译码器中的前缀指令译码模块 241,所述前缀指令译码模块 241 包括一前缀指令 SETFLAG,用于表示该前缀指令后的多条指令处于 X86虚拟 机指令集模式下。
本发明实施例的前缀指令译码模块 241中的前缀指令,利用 MIPS指令集 中的 SPECIAL2的空槽的保留值实现。 译码器 2的前缀指令译码模块 241,在对该前缀指令译码时设置标志,这 条指令后面的指令被译为 X86虚拟机指令集模式, 然后该前缀指令译为空操 作 NOP。
较佳地, 所述前缀指令 SETFLAG包括一范围参数, 用于表示前缀指令 SETFLAG的影响范围,其可以是 1,表示该前缀指令只影响其后的一条指令; 也可以是 n, 表示该前缀指令影响其后的 η条指令。
较佳地,所述译码器 2的前缀指令计数器 242,用于记录受前缀指令影响 且不出现转移指令的指令序列的指令数 η;
当受影响的当前指令进入定点运算部件,即下一条指令进入译码器 2时 η 减 1。所述指令序列中不允许出现转移指令, 即一旦出现转移指令则从转移指 令开始的指令序列不受前缀指令的影响。
较佳地,作为一种可实施方式,所述定点运算部件 3的例外处理模块 34, 用于在前缀指令只影响紧接其后的一条指令时, 如果出现执行例外, 则采用 与延迟槽例外相同的方法, 将 Cause寄存器的 bd位置 1, 同时将 EPC指向前 缀指令, 例外服务程序完成后重新执行前缀指令。
较佳地, 作为另一种可实施方式, 所述定点运算部件 3 的前缀例外控制 寄存器 33, 用于记录发生例外的指令是否受所述前缀指令影响。 在出现异常 而中断进程的时候向前缀例外控制寄存器 33中存入当前指令的计数; 在异常 结束返回被中断进程时, 根据所述计数, 即根据之前前缀例外控制寄存器 33 保存的计数恢复被中断进程这个状态。
所述定点运算部件 3的标志运算模块 32, 用于对于处于虚拟机指令集模 式的指令,根据输入指令进行运算,然后根据运算结果计算相应的 EFLAG标 志位。 (三)
作为另一种可实施的方式, 所述模式识别模块 24为一指令处理模块 21, 用于在 RISC处理器的 MIPS指令中标志该指令的虛拟机指令集模式。
对于使用频度特别高的 X86虚拟机指令,则需要地在 RISC处理器的 MPS 指令集中, 通过指令处理模块 21, 设置一标志, 标志该 MIPS指令为在 X86 虚拟机指令集模式下执行的指令。 这样, 对使用频度高的 X86虚拟机指令, 标志该指令为 X86虚拟机指令集模式,直接由 RISC处理器的 MIPS指令集执 行, 以减少相应的开销。
受指令处理模块 21影响的指令, 只能影响该条指令的译码执行, 对其它 指令则不影响, 其它指令按其原有的虚拟指令集模式执行。
较佳地,所述 RISC处理器的 MIPS指令,包括在 X86指令集中与 EFLAG 标志相关的指令对应的虚拟机指令, 以及在 X86指令集中, 对特殊结构, 如 浮点桟进行操作的指令对应的虚拟机指令。
如指令处理模块 21对 RISC处理器的加法指令 (Add) , 标志该指令的 虚拟机指令集模式为 X86虚拟机指令集模式 X86Add,其可以利用 RISC处理 器 MIPS指令集中 SPECIAL2的空槽的保留值实现。这条指令并不是和原有的 加法指令(Add)指令一样, 而只是对原有的指令提供部分的支持, 其对寄存 器中的值进行相加操作, 并且也根据结果修改相应的 EFLAGS标志位, 但是 计算的结果并不存储到寄存器中, 即寄存器的值并不会发生改变。
本发明的支持 X86虚拟机的 RISC处理器装置多模式下数据处理方法, 包括如下步骤:
步骤 N210, 读取指令时, 区分指令的虚拟机指令集模式。
作为一种可实施的方式, 所述步骤 N210包括下列步骤:
步骤 N211 , 译码器读取一条前缀指令 SETFLAG, 表示该指令后的多条 指令处于 X86虚拟机指令集模式下, 区分出指令的虚拟机指令集模式;
前缀指令 SETFLAG还包括一范围参数,表示前缀指令 SETFLAG的影响 范围, 其可以是 1, 表示该前缀指令只影响其后的一条指令; 也可以是 n (n ≠1 ) , 表示该前缀指令影响其后的 n条指令。
对该前缀指令译码时设置标志, 这条指令后面的指令被译为 X86虚拟机 指令集模式, 然后该前缀指令译为空操作 NOP。
作为另一种可实施方式, 所述步骤 N210包括下列步骤:
步骤 N210', 当指令进入译码器 2时, 虚拟机模式控制寄存器 73的控制 位标志 X86MODE1区分指令的虚拟机指令集模式。
所述步骤 N210'包括下列步骤:
步骤 Ν21 Γ, 判断虚拟机模式控制寄存器 73的控制位标志 X86MODE; 步骤 N212', 当该标志位为 1时表示此时相应的指令运行在 X86虛拟机 指令集模式下;
步骤 N213', 当该标志位为 0时表示此时相应的指令运行在非 X86虚拟 机指令集模式下。
作为另一种可实施方式, 所述步骤 N210包括下列步骤:
步骤 N211", 译码器读取指令, 按该指令中的标志的虚拟机指令集模式, 区分指令的虚拟机指令集模式。
步骤 N220, 译码器在指令译码过程中, 根据区分出的指令的虚拟机指令 集模式, 将指令按照所区分的虚拟机指令集模式, 进行译码后输出给 RISC处 理器的定点运算部件 3 ;
当以前缀指令区分出指令的虚拟机指令集模式时, 包括下列步骤: 歩骤 N221, 译码器通过译码识别前缀指令, 在译码器置一个标志位 X86mode2=l ,
所述步骤 N220还包括下列步骤:
步骤 N222, 译码器中的前缀指令计数器 242, 记录受前缀指令影响且不 出现转换指令的指令序列的指令数 n;
当受影响的当前指令进入定点运算部件,即下一条指令进入译码器 2时 n 减 1。
所述指令序列中不允许出现转移指令, 即一旦出现转移指令则从转移指 令开始的指令序列不受前缀指令的影响。
当以虚拟机模式控制寄存器 73控制位标志 X86MODE1区分出指令的虚 拟机指令集模式时, 所述步骤 N220译码器进行译码, 包括下列步骤:
步骤 Ν22Γ, 当 RISC处理器取指令, 由译码器 2进行译码并执行时, 译 码器首先读取虚拟机模式控制寄存器 73的控制位标志 X86MODE1,根据标志 位的值为 0或 1区分的虚拟机指令集模式, 并按其虚拟机指令集模式译码, 直到虚拟机模式控制寄存器 73的控制位标志 X86MODE1被改写。
步骤 N230, RISC处理器的定点运算部件根据译码器的输出, 进行处理, 输出执行的结果。
当以前缀指令区分出指令的虚拟机指令集模式时, 包括下列步骤: 步骤 SN231 , 由于译码器将前缀指令译码为内部的空操作 NOP, 所以定 点运算部件执行 NOP指令;
为了避免在多模式指令集指令执行过程中, 出现中断例外, 较佳地, 所 述步骤 N230包括下列步骤:
步骤 N232, 定点运算部件在前缀指令只影响紧接其后的一条指令时, 如 果出现执行例外, 则采用与延迟槽例外相同的方法, 将 Cause 寄存器的 bd (Branch delay)位置 1, 同时将 EPC (The Exception Program Counter)指向前 缀指令, 例外服务程序完成后重新执行前缀指令。
一般地, EPC 寄存器存放的是当例外服务程序执行完成后处理器继续原 有操作的入口地址。
步骤 N233, 定点运算部件在前缀指令影响 n条指令时, 用前缀例外控制 寄存器 33记录发生例外的指令是否受所述前缀指令影响。 在出现异常而中断 进程的时候向前缀例外控制寄存器 33中存入当前指令的计数。 在异常结束返 回被中断进程时, 根据所述计数, 即根据之前前缀例外控制寄存器 33保存的 计数恢复被中断进程这个状态。
步骤 N234, 定点运算部件根据输入指令进行运算, 然后根据运算结果计 算相应的 EFLAG标志位输出。
下面以加法指令为例,以前缀指令的方式来具体本发明的 RISC处理器装 置多模式下数据处理方法:
首先, 一条前缀指令进入译码器;
然后, 译码器 2 通过译码识别前缀指令, 在译码器置一个标志位 X86mode2=l , 然后将前缀指令译码为内部的空操作 NOP, 执行后继的指令; 其后, 当前缀指令的下一条指令即加法指令进入译码器时, 判断前缀标 志位是否存在, .如果加法指令不在前缀指令的参数范围内, 译码器正常译码 出指令本身带有的源寄存器和目标寄存器以及内部操作的操作码 (op) ; 如 果这条加法指令处于前缀指令参数范围内, 即处于 X86模式下的加法指令, 则按照 X86虚拟机指令集模式, 根据计算结果修改 EFLAGS标志位, 因此译 码器会将 EFLAGS标志位译码为源寄存器中的一个, 同时将 EFLAGS标志位 •译码为目标寄存器, 然后同时将加法指令本身所带有的源寄存器和目标寄存 器以及内部操作的操作码 (op) 译码出来; 最后,定点运算部件将译码器的输出作为输入,如果是正常的 MIPS指令 集中的指令, 进行加法计算; 如果是受前缀指令影响的加法指令, 定点运算 部件会先进行加法计算, 然后根据加法运算的结果运算出新的 EFLAGS标志 位的值。
本发明的 RISC处理器装置及其多模式下数据处理方法, 在 RISC处理器 装置中,当将不同模式下的虚拟机指令翻译成 RISC处理器装置可以执行的指 令时, 直接译码并执行, 节约了大量的翻译时间, 处理器装置的运算速度得 到指数级提高, 从整体上提高处理器装置的性能。
N3 )源处理器到目标处理器的地址转换的査表支持
虚拟机种类繁多, 但其核心就是一个翻译或者解释的过程, 即从目标代 码翻译或者解释成本地代码, 而在本地处理器上可以执行的过程。 虚拟机在 执行本地码的过程中, 遇到跳转指令, 需要将 X86源程序的指令地址转换成 相对应的 PS目标程序的指令地址,然后根据目标程序的指令地址来实现跳 转。本发明在 RISC处理器中增加能够解决源指令地址(X86指令地址)到目 标指令地址(MIPS指令地址) 映射查找表的结构, 加速从源指令地址到目标 指令地址的转换, 从而提高虚拟机的性能。
本发明实施例的支持 X86虚拟机的 RISC处理器的査找表模块 23, 用于 利用査找表实现从 X86源指令地址到 MIPS目标指令地址的转换。
本发明在硬件上具有一个查找表,支持对 X86程序中的跳转地址到 MIPS 跳转地址的翻译进行快速査找, 提高虚拟机性能。
作为了一种可实施方式, 所述査找表可以是按内容寻址的查找表, 用内 容可寻址存储器 /随机存取存储器 ( Content-Addressable Memory/Random Access Memory, CAM/RAM)来实现, 其中, RAM是输入一个地址, 输出对 应地址中的数据; CAM是输入内容, 输出存储了这个内容的单元的索引号或 者是与这个索引号相关联的另一个单元的内容。
该查找表可以是按内容寻址的査找表, 实现 X86跳转地址到 MIPS调转 地址翻译, 即在 RISC处理器的 X86虚拟机中, 从 X86源指令地址到 MIPS 目标指令地址的转换。 其表项如表 1所示。 表 1査找表表项
ASID SPC TPC
如表 1所述, X86源指令(SPC) 到 MIPS目标指令地址(TPC) 转换使 用 3个域: ASID域、 SPC域和 TPC域。
其中, ASID域用于存放在操作系统上启动多个 X86虚拟机进程的 ID号。 这几个 X86虚拟机进程都需要使用査找表时,使用操作系统为其分配的 ID号 (ASID)作区分, 使之不会相互干扰;
SPC域用于存放 X86源指令地址;
TPC域用于存放 MIPS目标指令地址;
ASID和 SPC域位于查找表的地址部分(CAM) , TPC位于查找表的存 储部分(RAM) 。
査找表模块 23査找时, 当前 X86虛拟机进程的 ASID与査表指令给出的 SPC—起构成査找表的 "地址"部分, 送到所有表项, 每个表项将自己存储 的 ASID、 SPC与输入相比较, 如果匹配就将其中存储的 TPC输出。 因此, 就 RISC处理器的 X86虚拟机进程而言, 只要输入它想查找的 X86源指令地 址, 就可以从查找表 23中查找到相对应的 MIPS目标指令地址。
其中,查找表中的 SPC域和 TPC域的值由虚拟机在初始化时进行初始化 处理, 而 ASID域的值由本地操作系统给出。
作为一种可实施方式, 本发明实施例中, 通过四条访问或修改该査找表 结构的指令实现查找表模块 23。
指令一, CAMPV指令。 该指令査询查找表 RAM表项值;
该指令的格式如下所示:
CAMPV rd, rs
根据 GPR [rs]中的内容索引査找表, 得到 RAM中的内容。根据通用寄存 器 GPR [rs]中的内容索引査找表。 如果命中, 那么将相应的 RAM中的内容存 入目标寄存器 GPR [rd]中; 如果表项不命中, 将不命中服务程序的入口地址 存入目标寄存器 GPR [rd]中。 关于指令的执行过程, 则是整个处理器指令执行的流程, 包括取指译码 执行等, 它访问的部件就是上面所说的查找表。 指令二, CAMPI指令。 该指令查询査找表 RAM表项的索引 (index) 该指令的格式如下所示:
CAMPI rd, rs
根据 GPR [rs]中的内容索引査找表,得到该内容所在表项的索引(index)。 根据通用寄存器 GPR [rs]中的内容索引査找表。如果命中,那么将相应表项的 索引 (index)存入目标寄存器 GPR [rd]中; 如果表项不命中, 将目标寄存器 rd的最高位置 1。
关于指令的执行过程, 则是整个处理器指令执行的流程, 包括取指译码 执行等, 它访问的部件就是上面所说的査找表。 指令三, CAMWI指令。该指令根据查找表 RAM表项的索引 (index)填 写査找表, 该指令的格式如下所示:
CAMWI rd, rs, rt
根据 GPR [rd]的值填写查找表。根据通用寄存器 GPR [rd]中的 index值将 GPR [rs]和 GPR [rt]寄存器中的值分别写入查找表的 CAM表项和 RAM表项 中。
如果索引 (index) 的值超出查找表表项的范围, 则引发地址错例外。 关于指令的执行过程, 则是整个处理器指令执行的流程, 包括取指译码 执行等, 它访问的部件就是上面所说的查找表。 指令四, RAMRI指令。 该指令根据查找表 RAM表项的索引 (index)读 取査找表 RAM表项内容;
该指令的格式如下所示:
RAMRI rd, rs
根据 GPR [rs]的值读取查找表的 RAM的内容。 根据通用寄存器 GPR [rs] 中的 index值读取查找表的 RAM的内容, 并存入目标寄存器 GPR [rd]中。
如果 index的值超出査找表表项的范围, 则引发地址错例外。 下面详细说明查找不命中, 即査找表查找不成功时, 即查找表中并没有 相应进程期望的一对 SPC-TPC;, 相应的处理过程。
当查找不成功时, 即不命中时, 跳转到不命中服务程序入口地址, 由不 命中服务程序进行处理。
不命中服务程序是现有的一种例程, 是 MIPS指令集的 RISC处理器的一 种现有标准技术, 因此在本发明实施例中不再一一详细描述。
作为一种可实施方式, 所述不命中服务程序的入口地址利用一个 CP0寄 存器 CAM.default保存实现, 由虚拟机提供一个缺省值, 保存在 CP0寄存器 CAM.default中, 作为不命中服务程序的入口地址。
这是处理器的一个控制寄存器, 使用与其它控制寄存器相同的读写方式 (只是地址不同) , 由虚拟机提供一个缺省值, 为不命中服务程序的入口地 址。当査找表查表而不命中时,将所述保存在 CAM.default中的缺省值送到目 标寄存器, 这样査表程序可以在命中的情况下, 跳转到 MIPS指令地址执行; 而在不命中的情况下, 跳转到不命中服务程序的入口地址, 然后利用不命中 服务程序査找得到的相应的地址填入查找表中。 这样也可以避免查表后加入 转移指令判断是否命中。
由于此时目标地址已经存入目标寄存器中,所以利用现有的 MIPS64中的 直接跳转指令 JR rs即可实现跳转。
其中, rs就是放由目标地址的寄存器。 作为另一种可实施方式, 不命中服务程序的入口地址可以存放在查找表 表项的第 0项, 而不是实施例一中的一个控制寄存器中。
这种方法中又设置一条新指令 VJR, 缺省是用了第 31号通用寄存器的内 容作为 SPC查表, VJR的指令功能类似于第一种方法里的 CAMPV+JR两条 指令的功能。
该指令的格式如下所示:
VJR rt
根据 31号通用寄存器的值读取査找表的 RAM的内容。 根据通用寄存器 GPR [31]中的值读取査找表的 RAM的内容(也就是转化后的目标地址) 。如 果査找成功,则存入目标寄存器 GPR [rt]中。然后指令根据 rt寄存器的值跳转 到目标地址;否则将查找表中第 0项的 RAM内容存入目标寄存器 GPR [rt]中。 指令根据 rt寄存器的值跳转到不命中服务程序处理。
关于指令的执行过程, 则是整个处理器指令执行的流程, 包括取指译码 执行等, 它访问的部件就是上面所说的查找表。
当出现使用源指令地址的跳转指令时, 在该指令之前由一条指令将源指 令地址的值放入一固定的寄存器(如 31号寄存器) , 例如 X86中的 JMP mx 指令;
由两条 MIPS指令实现:
Addiu $31, r2, 0x0
VJR r4
跳转指令译码后, 由 VJ 指令根据这个固定的寄存器中的值査表后, 如 果命中, 就直接转换到目标指令地址指向的代码段执行; 如果不命中, 直接 跳转到査找表的第 0项, 然后跳转到不命中服务程序。 下面详细描述本发明的支持 X86虚拟机的 RISC处理器装置的指令地址 转换查找过程, 包括下列步骤:
步骤 N310, 在 RISC处理器的 X86虚拟机启动时, 初始化査找表, 用得 到的 X86虚拟机指令地址到 MIPS指令地址的内容来填写查找表;
在 RISC处理器的 X86虚拟机初始化时, 利用不命中服务程序, 根据不 命中服务程序所维护的哈希表的内容,通过 CAMPI指令和 CAMWI指令初始 化得到相应的 X86指令地址到 MIPS指令地址的查找表。 步骤 N320, RISC处理器的 X86虚拟机的跳转指令由于需要完成从 X86 源指令地址到目标指令地址的转换而访问查找表;
所述步骤 N320包括下列步骤:
步骤 N321, 使用查询査找表表项值的 CAMPV指令, 根据寄存器中的源 指令地址搜索查找表得到目标指令地址;
步骤 N322, 如果查找命中, 则将直接得到的目标指令地址的值存入目标 寄存器中, 程序由跳转指令跳转至该目标地址指向的代码段执行; 步骤 N323, 如果查找不命中, 则将得到不命中服务程序的地址, 该地址 由虚拟机给出, 存入目标寄存器, 程序跳转至不命中服务程序执行。 步骤 N330, 不命中服务程序根据虚拟机所维护的哈希表的内容而重新填 写查找表;
所述步骤 N330包括下列步骤:
步骤 N331 , 使用査询查找表表项的索引的 CAMPI指令, 根据源指令地 址的值得到该值所在表项的索引 (index) , 并将该索引存入目标寄存器中; 步骤 N332, 使用根据查找表表项的索引 (index)填写查找表的 CAMWI 指令, 将进程的 ASID、 源指令地址以及相对应的目标指令地址, 根据目标寄 存器中的索引值填表同时填入表中。 较佳地, 所述指令地址转换查找方法过程, 还包括下列步骤:
步骤 N340, 无效查找表中的一项内容; 或者读取查找表 RAM的内容。 使用根据查找表 RAM表项的索引 (index)填写查找表的 CAMWI指令, 向指定的索引 (index) 的该项, 填写固定的值, 所述的固定的值不能与程序 的源指令地址相匹配, 也就是无效掉了该项。
使用根据查找表 RAM表项的索引(index)读取查找表 RAM表项内容的 RAMRI指令, 读取指定的索引 (index)表项的査找表 RAM的值, 存入目标 寄存器中, 以方便调试。
本发明的 RISC处理器装置及其指令地址转换査找方法, 在 RISC处理器 中增加能够解决 X86源指令地址到 MIPS目标指令地址映射的査找表的结构, 在 RISC处理器的 X86虚拟机中, 加速从 X86源指令地址到 MIPS目标指令 地址的转换, 从而使用提高虚拟机的性能。
通过结合附图对本发明具体实施例的描述, 本发明的其它方面及特征对 本领域的技术人员而言是显而易见的。
以上对本发明的具体实施例进行了描述和说明, 这些实施例应被认为其 只是示例性的, 并不用于对本发明进行限制, 本发明应根据所附的权利要求 进行解释。 工业应用性
本发明的 RISC处理器及数据处理方法提供对使用 EFLAG指令的支持、 对 X86浮点格式和浮点桟的支持、 对 X86存储结构的支持、 对虚拟机制的支 持, 从而缩小了 X86和 RISC体系结构上的语义差距, 实现了在 RISC处理器 上对 X86虚拟机的支持, 提高了 RISC处理器中 X86虚拟机的处理速度, 提 升了 RISC处理器性能。

Claims

权利要求书
1、 一种支持 X86虚拟机的 RISC处理器, 其特征在于, 包括指令模块, 译码器, 查找表, 定点运算部件和浮点运算部件, 其中:
所述指令模块, 用于存储支持 X86虚拟机的虚拟机指令集;
所述译码器, 用于在该虚拟机指令集指令译码过程中, 区分出指令的虚 拟机指令集模式, 将指令按照所区分的虚拟机指令集模式, 进行译码后输出 给定点运算部件或者浮点运算部件;
所述査找表, 用于存储 X86程序中的跳转地址和 MIPS跳转地址, 并根 据所述译码器的输出支持对 X86程序中的跳转地址到 MIPS跳转地址的翻译 进行快速查找;
所述定点运算部件用于根据译码器的输出, 对虚拟机指令集的定点指令 进行处理, 输出执行结果;
所述浮点运算部件用于根据译码器的输出, 对虚拟机指令集的浮点指令 进行处理, 输出执行结果。
2、根据权利要求 1所述的支持 X86虚拟机的 RISC处理器,其特征在于, 还包括访存执行单元、 内存及数据通路;
所述访存执行单元根据译码器的输出, 通过数据通路完成寄存器与内存 之间的数据传输。
3、根据权利要求 2所述的支持 X86虚拟机的 RISC处理器,其特征在于, 还包括通用物理寄存器堆, 所述通用物理寄存器堆包括溢出检查寄存器, 上 界、 下界地址寄存器, 模拟标志寄存器, 和虚拟机模式控制寄存器;
所述溢出检査寄存器,用于存储在对 RISC处理器模拟的栈寄存器进行浮 点访问时栈溢出例外检查的结果;
所述上界、 下界地址寄存器, 用于模拟 X86处理器的有界访存机制时存 储作为上界、 下界的有效地址;
所述模拟标志寄存器, 用于模拟实现 X86处理器的标志寄存器标志位; 所述虚拟机模式控制寄存器包括一个控制位标志, 当该控制位标志为 1 时表示此时相应的指令运行在 X86虚拟机指令集模式下; 当该控制位标志为 0时表示此时相应的指令运行在非 X86虚拟机指令集模式下。
4、根据权利要求 3所述的支持 X86虚拟机的 RISC处理器,其特征在于, 还包括浮点寄存器堆;
所述浮点寄存器堆包括浮点控制寄存器, 浮点寄存器桟, 以及第 1 至 3 浮点寄存器。
5、 根据权利要求 4任一项所述的支持 X86虚拟机的 RISC处理器, 其特 征在于, 所述虚拟机指令集包括访存扩展指令、 前缀指令、 EFLAG标志位相 关指令、 浮点栈相关指令和查找表相关指令中的一种或者一种以上的组合。
6、根据权利要求 5所述的支持 X86虚拟机的 RISC处理器,其特征在于, 所述译码器包括指令处理模块, 和模式识别模块, 其中:
所述指令处理模块, 用于对虚拟机指令集的指令进行指令译码, 然后输 出给定点运算部件或者浮点运算部件;
所述模式识别模块, 用于在指令译码过程中, 区分出指令的虚拟机指令 集模式, 进行相应的处理。
7、根据权利要求 6所述的支持 X86虚拟机的 RISC处理器,其特征在于, 所述模式识别模块包括多倍存储译码模块和 /或多倍读取译码模块;
所述多倍存储译码模块, 用于在输入的指令是访存扩展指令中的存储操 作指令时, 将源寄存器由一个扩展成多个相邻的寄存器, 然后输出到访存执 行单元执行;
所述多倍读取译码模块, 用于在输入的指令是访存扩展指令中的读取操 作指令时, 将该读取操作指令译码为多条内部操作指令, 将目标寄存器由一 个扩展成多个相邻的寄存器, 然后分配到所述多条内部操作中, 输出到访存 执行单元执行。
8、根据权利要求 7所述的支持 X86虚拟机的 RISC处理器,其特征在于, 所述模式识别模块还包括前缀指令译码模块和标志位指令译码模块;
所述标志位指令译码模块, 用于对处于模拟 EFLAGS 工作模式下的
EFLAG标志位相关指令进行处理, 根据不同的 EFLAG标志位相关指令, 将 模拟标志寄存器译码为其指令的源寄存器和 /或目标寄存器;
所述前缀指令译码模块, 用于指示前缀指令后的多条指令处于 X86虚拟 机指令集模式下。
9、根据权利要求 8所述的支持 X86虚拟机的 RISC处理器,其特征在于, 当前缀指令的范围参数为 n时, 译码器还包括前缀指令计数器, 用于记录受 前缀指令影响且不出现转移指令的指令序列的指令数, 该指令数与所述范围 参数相等。
10、 根据权利要求 6所述的支持 X86虚拟机的 RISC处理器, 其特征在 于, 所述译码器还包括 TOP指针寄存器, 和查找表模块, 其中:
所述 TOP指针寄存器, 用于维护一浮点栈操作指针, 存储浮点栈桟操作 指针的值;
所述査找表模块, 用于根据査找表相关指令, 利用查找表实现从 X86源 指令地址到 MIPS目标指令地址的转换。
11、 根据权利要求 5所述的支持 X86虚拟机的 RISC处理器, 其特征在 于, 所述定点运算部件包括标志读写模块, 标志运算模块, 例外处理模块, 和前缀例外控制寄存器;
所述标志读写模块, 用于读写模拟标志寄存器标志位的值;
所述标志运算模块, 用于在运算过程中, 当 RISC处理器处于 X86虚拟 机工作模式时, 根据运算结果得到模拟标志寄存器标志位, 或根据模拟标志 寄存器标志位中的一位或者多位, 执行分支跳转指令;
所述例外处理模块, 用于在前缀指令只影响紧接其后的一条指令时, 如 果出现执行例外, 则采用与延迟槽例外相同的方法, 将 Cause寄存器的 bd位 置 1, 同时将 EPC指向前缀指令, 例外服务程序完成后重新执行前缀指令; 所述前缀例外控制寄存器, 用于记录发生例外的指令是否受所述前缀指 令影响; 在出现异常而中断进程的时候存入当前指令的计数, 在异常结束返 回被中断进程时, 根据所述计数恢复所述被中断进程。
12、 根据权利要求 10所述的支持 X86虚拟机的 RISC处理器, 其特征在 于, 所述浮点运算部件包括指针操作模块, 栈溢出判断模块, 和转换模块; 所述指针操作模块, 用于对所述 TOP指针寄存器进行操作, 在模拟所述 浮点寄存器栈操作时, 模拟所述栈操作指针的栈操作, 修改并监控桟操作指 针的状态;
所述栈溢出判断模块, 用于检查指定的浮点寄存器栈中的栈寄存器, 并 根据桟寄存器的值对所述溢出检査寄存器进行操作, 进行浮点访问时栈溢出 例外检査;
所述转换模块, 用于进行扩展双精度浮点数据和双精度浮点数据之间的 相互转换。
13、 一种 RISC处理器装置支持 X86虚拟机的数据处理方法, 其特征在 于, 包括下列步骤:
歩骤 A,在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机工 作模式;
步骤 B, 读取指令, 区分指令的虚拟机指令集模式; 在指令译码过程中, 根据区分出的指令的虚拟机指令集模式, 将指令按照所区分的虚拟机指令集 模式, 进行译码后输出;
步骤 c, 根据所述输出, 进行相应的计算或存取处理, 输出执行结果。
14、 根据权利要求 13所述的 RISC处理器装置支持 X86虚拟机的数据处 理方法, 其特征在于, 当 RISC处理器支持 X86虚拟机的数据处理过程为对 使用 EFLAG指令的支持时,
所述步骤 A具体为:
步骤 Al, 在 RISC处理器中设置 RISC处理器的工作模式为 X86虚拟机 工作模式, 表示模拟标志寄存器可用;
所述步骤 B具体为:
歩骤 Bl, 译码器识别出运算是处于模拟 EFLAGS工作模式下, 然后根据 不同的指令, 将模拟标志寄存器译码为源寄存器和 /或目标寄存器;
所述步骤 C具体为:
步骤 Cl, RISC处理器在运算过程中, 当 RISC处理器的工作模式为 X86 虚拟机工作模式时, 读 /写模拟标志寄存器标志位的值以实现运算状态的获取 / 存储, 和根据运算结果得到模拟标志寄存器标志位或根据模拟标志寄存器标 志位中的一位或者多位执行分支跳转指令。
15、 根据权利要求 13所述的 RISC处理器装置支持 X86虚拟机的数据处 理方法, 其特征在于, 当 RISC处理器支持 X86虚拟机的数据处理过程为对 X86浮点格式和浮点栈的支持时,
所述步骤 A具体为:
步骤 A2, 根据桟使能位, 决定是否选定浮点寄存器用于模拟浮点寄存器 栈操作; 或者设置一通用寄存器, 其低 8位由低到高分别表示浮点寄存器桟 的 0〜7号桟寄存器的状态; 或者选用任意三个通用寄存器, 作为第一浮点寄 存器, 第二浮点寄存器和第三浮点寄存器, 担任 64位浮点数和 80位浮点数 的格式转换工作;
所述步骤 B具体为:
步骤 B2,在译码器中 3位的 TOP指针寄存器中存放栈操作指针的值; 或 者对新增的栈溢出判断指令译码; 或者对扩展双精度浮点数据与双精度浮点 数据的转换指令译码;
所述步骤 C具体为:
步骤 C2, 在模拟浮点寄存器栈操作时, 对指针寄存器进行操作, 模拟栈 操作指针的栈操作, 修改并监控栈操作指针的状态; 或者检査指定的浮点 寄存器栈中的栈寄存器, 并根据栈寄存器的值对溢出检查寄存器进行操作, 进行浮点栈溢出检査; 或者执行扩展双精度浮点数据与双精度浮点数据之间 的数据转换。
16、 根据权利要求 13所述的 RISC处理器装置支持 X86虚拟机的数据处 理方法, 其特征在于, 当 RISC处理器支持 X86虚拟机的数据处理过程为对 X86存储结构的支持时,
所述步骤 A具体为:
步骤 A3, 在 RISC处理器的 X86虚拟机中, 设置物理寄存器堆中两个通 用寄存器分别为上界地址寄存器和下界地址寄存器;
所述步骤 B具体为:
步骤 B3, 在进行 X86虚拟机指令集到 MIPS指令集翻译时, 译码器将指 令进行译码, 得到能被 RISC处理器处理的二进制代码;
所述步骤 C具体为: ,
步骤 C3, 定点运算部件在译码后的访存指令中, 根据上界地址寄存器中 存储的上界地址和 /或下界地址寄存器中存储的下界地址, 判断指令操作数地 址和指令地址的有效性; 当指令操作数地址和指令地址皆为有效时, 执行访 存操作; 否则引发地址错例外。
17、 根据权利要求 13所述的 RISC处理器装置支持 X86虚拟机的数据处 理方法, 其特征在于, 当 RISC处理器支持 X86虚拟机的数据处理过程为对 虚拟机制的支持时,
所述步骤 A具体为:
步骤 A4, 读取前缀指令, 区分指令的虚拟机指令集模式; 或者处理器 取出多倍数据宽度指令输入到译码器; 或者在 RISC处理器的 X86虛拟机启 动时, 初始化查找表, 用得到的 X86虚拟机指令地址到 MIPS指令地址的内 容来填写査找表;
所述步骤 B具体为:
步骤 B4, 在指令译码过程中, 根据区分出的指令的虚拟机指令集模式, 将指令按照所区分的虚拟机指令集模式, 进行译码后输出; 或者译码器判断 指令类型,识别并译码多倍数据宽度指令; 或者译码器识别查找表相关指令 ·, 所述步骤 C具体为:
步骤 C4, 定点运算部件执行受前缀指令影响的指令, 并根据运算结果计 算相应的 EFLAG标志位;或者将译码后的多倍数据宽度指令发送到访存执行 单元执行操作; 或者执行查找表相关指令, 得到目标指令地址的值或者跳转 到目标地址执行。
PCT/CN2008/002023 2008-03-17 2008-12-17 一种支持x86虚拟机的risc处理器装置及方法 WO2009114961A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
JP2011500028A JP5501338B2 (ja) 2008-03-17 2008-12-17 X86の仮想機をサポートするriscプロセッサ装置及び方法
US12/922,949 US8949580B2 (en) 2008-03-17 2008-12-17 RISC processor apparatus and method for supporting X86 virtual machine
KR1020107020814A KR101232343B1 (ko) 2008-03-17 2008-12-17 X86 가상머신을 지원하는 risc 프로세서 장치 및 방법
EP08873507.1A EP2267598B1 (en) 2008-03-17 2008-12-17 Risc processor apparatus and method for supporting x86 virtual machine
CA2718724A CA2718724C (en) 2008-03-17 2008-12-17 Risc processor apparatus and method for supporting x86 virtual machine

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200810102086.3 2008-03-17
CN 200810102086 CN100555225C (zh) 2008-03-17 2008-03-17 一种支持x86虚拟机的risc处理器装置及方法

Publications (1)

Publication Number Publication Date
WO2009114961A1 true WO2009114961A1 (zh) 2009-09-24

Family

ID=39891348

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2008/002023 WO2009114961A1 (zh) 2008-03-17 2008-12-17 一种支持x86虚拟机的risc处理器装置及方法

Country Status (7)

Country Link
US (1) US8949580B2 (zh)
EP (1) EP2267598B1 (zh)
JP (1) JP5501338B2 (zh)
KR (1) KR101232343B1 (zh)
CN (1) CN100555225C (zh)
CA (1) CA2718724C (zh)
WO (1) WO2009114961A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101247259B1 (ko) 2009-12-17 2013-04-01 한국전자통신연구원 가상화 장치 및 그 처리 방법
CN108369508A (zh) * 2016-01-05 2018-08-03 英特尔公司 使用处理器指令前缀的二进制转换支持

Families Citing this family (53)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5193624B2 (ja) * 2008-02-19 2013-05-08 ルネサスエレクトロニクス株式会社 データプロセッサ
CN100555225C (zh) * 2008-03-17 2009-10-28 中国科学院计算技术研究所 一种支持x86虚拟机的risc处理器装置及方法
CN101819517B (zh) * 2009-05-19 2013-05-22 威盛电子股份有限公司 适用于微处理器的装置及方法
US9898291B2 (en) 2011-04-07 2018-02-20 Via Technologies, Inc. Microprocessor with arm and X86 instruction length decoders
US9645822B2 (en) 2011-04-07 2017-05-09 Via Technologies, Inc Conditional store instructions in an out-of-order execution microprocessor
US9292470B2 (en) 2011-04-07 2016-03-22 Via Technologies, Inc. Microprocessor that enables ARM ISA program to access 64-bit general purpose registers written by x86 ISA program
US8880851B2 (en) * 2011-04-07 2014-11-04 Via Technologies, Inc. Microprocessor that performs X86 ISA and arm ISA machine language program instructions by hardware translation into microinstructions executed by common execution pipeline
US9378019B2 (en) 2011-04-07 2016-06-28 Via Technologies, Inc. Conditional load instructions in an out-of-order execution microprocessor
US9336180B2 (en) * 2011-04-07 2016-05-10 Via Technologies, Inc. Microprocessor that makes 64-bit general purpose registers available in MSR address space while operating in non-64-bit mode
US9317288B2 (en) 2011-04-07 2016-04-19 Via Technologies, Inc. Multi-core microprocessor that performs x86 ISA and ARM ISA machine language program instructions by hardware translation into microinstructions executed by common execution pipeline
US20130086359A1 (en) * 2011-09-29 2013-04-04 Qualcomm Incorporated Processor Hardware Pipeline Configured for Single-Instruction Address Extraction and Memory Access Operation
CN102508635B (zh) * 2011-10-19 2014-10-08 中国科学院声学研究所 一种处理器装置及其循环处理方法
US9335993B2 (en) 2011-12-29 2016-05-10 International Business Machines Corporation Convert from zoned format to decimal floating point format
US9329861B2 (en) * 2011-12-29 2016-05-03 International Business Machines Corporation Convert to zoned format from decimal floating point format
CN103530089B (zh) * 2012-08-31 2018-06-15 威盛电子股份有限公司 微处理器及其操作方法
CN104598196A (zh) * 2014-12-30 2015-05-06 杭州中天微系统有限公司 一种浮点处理装置及方法
US9335982B1 (en) 2015-04-28 2016-05-10 Microsoft Technology Licensing, Llc Processor emulation using multiple translations
GB2546465B (en) * 2015-06-05 2018-02-28 Advanced Risc Mach Ltd Modal processing of program instructions
US9817642B2 (en) * 2015-06-25 2017-11-14 Intel Corporation Apparatus and method for efficient call/return emulation using a dual return stack buffer
CN105159651B (zh) * 2015-08-31 2017-11-07 中国航天科技集团公司第九研究院第七七一研究所 一种risc处理器的单/双/四精度浮点数据相关电路及操作数获取方法
US9870305B2 (en) 2015-09-30 2018-01-16 International Business Machines Corporation Debugging of prefixed code
US10877759B2 (en) 2015-09-30 2020-12-29 International Business Machines Corporation Managing the capture of information in applications with prefix instructions
US10761852B2 (en) 2015-09-30 2020-09-01 International Business Machines Corporation Extending data range addressing
US10394568B2 (en) 2015-09-30 2019-08-27 International Business Machines Corporation Exception handling for applications with prefix instructions
US10169043B2 (en) * 2015-11-17 2019-01-01 Microsoft Technology Licensing, Llc Efficient emulation of guest architecture instructions
CN105677298B (zh) * 2015-12-30 2018-03-27 李朝波 一种将计算机指令中立即数扩展的方法和装置
US9996329B2 (en) 2016-02-16 2018-06-12 Microsoft Technology Licensing, Llc Translating atomic read-modify-write accesses
US10514913B2 (en) 2017-06-23 2019-12-24 International Business Machines Corporation Compiler controls for program regions
US10740067B2 (en) 2017-06-23 2020-08-11 International Business Machines Corporation Selective updating of floating point controls
US10725739B2 (en) 2017-06-23 2020-07-28 International Business Machines Corporation Compiler controls for program language constructs
US10684852B2 (en) * 2017-06-23 2020-06-16 International Business Machines Corporation Employing prefixes to control floating point operations
CN107291425B (zh) * 2017-06-23 2020-11-24 上海兆芯集成电路有限公司 合并解决重命名尺寸问题的部分写入结果的系统和方法
US10310814B2 (en) 2017-06-23 2019-06-04 International Business Machines Corporation Read and set floating point control register instruction
US10379851B2 (en) 2017-06-23 2019-08-13 International Business Machines Corporation Fine-grained management of exception enablement of floating point controls
US10481908B2 (en) 2017-06-23 2019-11-19 International Business Machines Corporation Predicted null updated
US11762566B2 (en) 2018-01-22 2023-09-19 Arm Limited Programmable mapping of guard tag storage locations
GB2570326B (en) * 2018-01-22 2020-06-10 Advanced Risc Mach Ltd Multiple guard tag setting instruction
CN108415728B (zh) * 2018-03-01 2020-12-29 中国科学院计算技术研究所 一种用于处理器的扩展浮点运算指令执行方法及装置
CN110874259A (zh) * 2018-08-31 2020-03-10 龙芯中科技术有限公司 程序执行方法、装置、设备和存储介质
KR20200139829A (ko) 2018-10-18 2020-12-14 상하이 캠브리콘 인포메이션 테크놀로지 컴퍼니 리미티드 네트워크 온칩 데이터 처리 방법 및 장치
CN111210012B (zh) * 2018-11-21 2022-12-09 上海寒武纪信息科技有限公司 数据处理方法、装置及相关产品
CN109788352A (zh) * 2018-12-25 2019-05-21 深圳市纽格力科技有限公司 一种基于mips架构的机顶盒异常确认方法和系统
CN110362501B (zh) * 2019-07-05 2021-09-24 北京大学 一种执行饱和寻址加载和存储操作的设备和方法
CN110780925B (zh) * 2019-09-02 2021-11-16 芯创智(北京)微电子有限公司 一种指令流水线的预译码系统及方法
CN111090465B (zh) * 2019-12-19 2022-08-19 四川长虹电器股份有限公司 一种rv32ic指令集的译码系统及其译码方法
JP2021166010A (ja) * 2020-04-08 2021-10-14 富士通株式会社 演算処理装置
US11119777B1 (en) 2020-04-22 2021-09-14 International Business Machines Corporation Extended prefix including routing bit for extended instruction format
CN111782269B (zh) * 2020-06-04 2023-12-12 珠海格力电器股份有限公司 一种中断处理方法及中断处理设备
TWI764311B (zh) * 2020-10-08 2022-05-11 大陸商星宸科技股份有限公司 記憶體存取方法及智慧處理裝置
CN112860320A (zh) * 2021-02-09 2021-05-28 山东英信计算机技术有限公司 基于risc-v指令集进行数据处理的方法、系统、设备及介质
US11922055B2 (en) 2021-04-28 2024-03-05 Seagate Technology Llc Stack register having different ferroelectric memory element constructions
CN113220300A (zh) * 2021-04-29 2021-08-06 麒麟软件有限公司 一种应用于Android系统x86架构上的ARM指令集转换方法
CN116501451B (zh) * 2023-06-25 2023-10-17 中国科学院计算技术研究所 二进制翻译方法、翻译控制方法、指令执行方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6751737B1 (en) * 1999-10-07 2004-06-15 Advanced Micro Devices Multiple protected mode execution environments using multiple register sets and meta-protected instructions
CN1607503A (zh) * 2003-10-14 2005-04-20 微软公司 在虚拟机器中使用合成指令的系统和方法
US20060005200A1 (en) * 2004-06-30 2006-01-05 Microsoft Corporation Systems and methods for running a legacy 32-bit x86 virtual machine on a 64-bit x86 processor
CN101256504A (zh) * 2008-03-17 2008-09-03 中国科学院计算技术研究所 一种支持x86虚拟机的risc处理器装置及方法

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
IL84821A (en) 1986-12-15 1992-07-15 United Technologies Corp Reduced instruction set computing apparatus and methods
JPH03150633A (ja) * 1989-11-07 1991-06-27 Matsushita Electric Ind Co Ltd 命令解読装置
CA2045735A1 (en) * 1990-06-29 1991-12-30 Richard Lee Sites Computer performance by eliminating branches
JPH06131197A (ja) * 1992-10-21 1994-05-13 Toshiba Corp 最適化処理装置
JPH06202903A (ja) 1992-12-29 1994-07-22 Nec Corp Cpuシミュレーション方法およびcpuシミュレータ
JP2788839B2 (ja) * 1993-05-15 1998-08-20 日本電気株式会社 Cpuシミュレータ
US5450607A (en) * 1993-05-17 1995-09-12 Mips Technologies Inc. Unified floating point and integer datapath for a RISC processor
DE69427265T2 (de) * 1993-10-29 2002-05-02 Advanced Micro Devices Inc Superskalarbefehlsdekoder
US5574927A (en) * 1994-03-25 1996-11-12 International Meta Systems, Inc. RISC architecture computer configured for emulation of the instruction set of a target computer
US5685009A (en) * 1994-07-20 1997-11-04 Exponential Technology, Inc. Shared floating-point registers and register port-pairing in a dual-architecture CPU
JP3451595B2 (ja) * 1995-06-07 2003-09-29 インターナショナル・ビジネス・マシーンズ・コーポレーション 二つの別個の命令セット・アーキテクチャへの拡張をサポートすることができるアーキテクチャ・モード制御を備えたマイクロプロセッサ
US6076155A (en) * 1995-10-24 2000-06-13 S3 Incorporated Shared register architecture for a dual-instruction-set CPU to facilitate data exchange between the instruction sets
JP2000515270A (ja) * 1996-01-24 2000-11-14 サン・マイクロシステムズ・インコーポレイテッド ネットワークまたはローカルメモリから受け取った命令セットの実行のための二重命令セットプロセッサ
JP2002536712A (ja) * 1999-01-28 2002-10-29 エーティーアイ インターナショナル エスアールエル 第2のアーキテクチャのコンピュータにおける第1のコンピュータアーキテクチャ用プログラムの実行
GB0202728D0 (en) * 2002-02-06 2002-03-27 Transitive Technologies Ltd Condition code flag emulation for program code conversion

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6751737B1 (en) * 1999-10-07 2004-06-15 Advanced Micro Devices Multiple protected mode execution environments using multiple register sets and meta-protected instructions
CN1607503A (zh) * 2003-10-14 2005-04-20 微软公司 在虚拟机器中使用合成指令的系统和方法
US20060005200A1 (en) * 2004-06-30 2006-01-05 Microsoft Corporation Systems and methods for running a legacy 32-bit x86 virtual machine on a 64-bit x86 processor
CN101256504A (zh) * 2008-03-17 2008-09-03 中国科学院计算技术研究所 一种支持x86虚拟机的risc处理器装置及方法

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101247259B1 (ko) 2009-12-17 2013-04-01 한국전자통신연구원 가상화 장치 및 그 처리 방법
US8589143B2 (en) 2009-12-17 2013-11-19 Electronics And Telecommunications Research Institute Virtualization apparatus and processing method thereof
CN108369508A (zh) * 2016-01-05 2018-08-03 英特尔公司 使用处理器指令前缀的二进制转换支持

Also Published As

Publication number Publication date
JP2011515750A (ja) 2011-05-19
KR101232343B1 (ko) 2013-02-13
EP2267598A1 (en) 2010-12-29
KR20100125331A (ko) 2010-11-30
EP2267598B1 (en) 2018-07-18
EP2267598A4 (en) 2013-03-27
US20110035745A1 (en) 2011-02-10
CA2718724C (en) 2016-01-19
CN101256504A (zh) 2008-09-03
CN100555225C (zh) 2009-10-28
CA2718724A1 (en) 2009-09-24
US8949580B2 (en) 2015-02-03
JP5501338B2 (ja) 2014-05-21

Similar Documents

Publication Publication Date Title
WO2009114961A1 (zh) 一种支持x86虚拟机的risc处理器装置及方法
US10664269B2 (en) Function virtualization facility for function query of a processor
JP5357181B2 (ja) コンピュータ・システム、その動作方法、及び、コンピュータ・プログラム
US6898697B1 (en) Efficient method for mode change detection and synchronization
US9250904B2 (en) Modify and execute sequential instruction facility and instructions therefor
US11809870B2 (en) Function virtualization facility for blocking instruction function of a multi-function instruction of a virtual processor
JP5039905B2 (ja) 2つのオペランドに対して演算を行い、その後オペランドの元の値を格納するための命令
US7124286B2 (en) Establishing an operating mode in a processor
JP5052678B2 (ja) コンピュータを動作させる方法及びシステム
JP5657074B2 (ja) 命令が利用可能な汎用レジスタの数を拡張するための上位ワード・ファシリティ
US6965984B2 (en) Data processing using multiple instruction sets
KR101139395B1 (ko) Risc 프로세서 및 그의 레지스터 플래그 비트 처리방법
KR20120026104A (ko) 다수의 레인 내의 패킹된 데이터의 언패킹
JP2011509475A5 (zh)
US7089539B2 (en) Program instruction interpretation
JP2011509474A (ja) コンピュータを動作させる方法及びシステム
JP2004538556A (ja) 複数命令セットシステムにおける非処理操作処理

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 08873507

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 20107020814

Country of ref document: KR

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 2011500028

Country of ref document: JP

Ref document number: 2718724

Country of ref document: CA

WWE Wipo information: entry into national phase

Ref document number: 2008873507

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 12922949

Country of ref document: US