WO2016145498A1 - Method and system for instruction emulation and legacy code execution - Google Patents

Method and system for instruction emulation and legacy code execution Download PDF

Info

Publication number
WO2016145498A1
WO2016145498A1 PCT/BR2015/000181 BR2015000181W WO2016145498A1 WO 2016145498 A1 WO2016145498 A1 WO 2016145498A1 BR 2015000181 W BR2015000181 W BR 2015000181W WO 2016145498 A1 WO2016145498 A1 WO 2016145498A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
processor
instructions
uis
emulation
Prior art date
Application number
PCT/BR2015/000181
Other languages
French (fr)
Portuguese (pt)
Inventor
Bruno Cardoso LOPES
Rafael AULER
Edson Borin
Rodolfo Jardim AZEVEDO
Original Assignee
Universidade Estadual De Campinas - Unicamp
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
Priority claimed from BR102015005838-1A external-priority patent/BR102015005838B1/en
Application filed by Universidade Estadual De Campinas - Unicamp filed Critical Universidade Estadual De Campinas - Unicamp
Publication of WO2016145498A1 publication Critical patent/WO2016145498A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • 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/22Microcontrol or microprogram arrangements
    • 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
    • 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

Definitions

  • the present invention is in the field of information technology, more specifically the execution of instructions in computer architectures and the compatibility of legacy code, and relates to a method and system for removing instructions in computer architectures without break compatibility with legacy code.
  • the present invention relates to a method and system for the removal of instructions in computer architectures, which ensures compatibility of execution of legacy code.
  • instructional recycling means in computer architectures, which enable the execution of a processor routine capable of establishing an alternate sequence of existing instructions (emulation) upon request by the program to execute a previously removed instruction. .
  • a processor routine capable of establishing an alternate sequence of existing instructions (emulation) upon request by the program to execute a previously removed instruction.
  • the program is not prevented from running and legacy code compatibility is guaranteed.
  • Figure 1 - Shows the mechanism of outdating and recycling an instruction, and the problem of backwards compatibility.
  • FIG. 2 - Shows the UIS Revision (UR), which records instructions that were associated with a specific UIS in previous versions of a processor.
  • UR UIS Revision
  • FIG. 3 Shows an example of a TM (a, b) trap mask where an SRa program is running on a PRb processor.
  • Figure 4 - Shows an example of an Active Review Vector.
  • Figure 6 Indicates the length of the page table to indicate the revision of the software on each of the computer's memory pages.
  • Figure 7 Indicates the software development flow and how the software review process is noted in each phase, including the intermediate files, libraries, and the final executable. The figure also indicates a possible disposition of this file. executable in memory with attention to the fact that Software and Library 1 can coexist on the same page because they can have the same SR, library 2 has to be on a separate page.
  • the present invention relates to a method and system for removing instructions in computer architectures, which ensures compatibility of execution of legacy code.
  • instructional recycling means in computer architectures, which enable the execution of a processor routine capable of establishing an alternative sequence of existing instructions (emulation) upon request by the program to execute a previously removed instruction. .
  • the program is not prevented from running and legacy code compatibility is guaranteed.
  • SRi is running on a processor
  • the unique instruction signature is a unique instruction identifier. This identifier is usually associated with the same statement across different generations, from the same architecture to ensure compatibility with legacy code. The set of all valid UISs determines a UIS space and the insertion of new ' UISs may compromise the available space. A UIS can then be reused by disassociating from an old instruction and associating with a new instruction.
  • TUI may never have been used before (a previously ⁇ invalid instruction), or may have been recycled from another instruction (as stage of "outdated” below). Only after a long process of software evolution will this instruction actually be incorporated into user programs, as it may take time for this instruction to be adopted by compilers and libraries distributed to users.
  • a PR1 processor has at least one UIS recycled from PRO, and has different implementations.
  • Running an SRi on a PRj (i ⁇ j) will cause backward compatibility issues if the UIS (s) in question exist in the running software.
  • PRb's VADD instruction has the same opcode as PRa's AAA.
  • Each file that stores software has its SR annotated in the header to indicate the specific PR it was designed for, telling the Operating System how to configure the potential emulation routines needed if the software revision is different from the processor's.
  • each UIS since recycling and creation steps occur simultaneously in the same PR, each UIS must be endowed with its own UIS Revision Number (UR), which accompanies how many instructions have been associated. to this specific UIS in earlier versions of a processor, as shown in Figure 2.
  • UR UIS Revision Number
  • a change of at least one UR implies updating the PR, as a change in the association between a UIS and an instruction will change the processor revision. .
  • An exception occurs when a UIS is first associated, in which case that there is no modification of PR.
  • changing one UR never affects the other URs, which establishes an orthogonality to this approach.
  • An instruction can only be removed if it is possible to find among the remaining architecture instructions an alternative sequence of instructions that can perform the first behavior. This task is handled by processor designers, and alternate sequences should be distributed to Operating System developers as emulation routines of the removed instruction.
  • RV Review Vector
  • TM ⁇ x, y ⁇ indicates the list of all instructions that need to be emulated when running SRx software on the PRy processor.
  • the interrupt routine is responsible for providing the specific emulation routines. The better you choose which instructions to remove, the lower the overhead or extra cost of emulation routines. Figure 3 illustrates this process well.
  • ERI Effective Review Index
  • the processor will interrupt program execution by transferring control to the operating system, which will decode the instruction and, together with the corresponding SR, transfer control to " Emulation Instruction Sequence "for this instruction, as shown in Figure 5.
  • the processor hardware design must include enough information to decide when to emulate a no statement. For this, the processor must be aware of the currently running software version to compare against its own revision.
  • One of several ways to implement this functionality is to create a specific instruction that tells the processor the version of the next instructions (instruction granularity).
  • instruction granularity Another form is a virtual memory architecture that includes version information on each page (page granularity).
  • Statement granularity implies the use of an extra statement to indicate that new code is about to be executed. Page granularity avoids having to include this new instruction for linking distinct pieces of software. Your schematic can be better observed from Figure 6.
  • each page table entry must include the SR of its content in the form of ERI, along with the page protection bits.
  • TLB memory that stores a portion of the page table inside the processor to speed up program execution
  • the software tools needed to build a new program compiler, assembler, and linker should indicate to the operating system module responsible for loading the programs in memory that it should allocate code with different ERI to different pages.
  • Figure 7 illustrates software development flow and phases of the software review process.
  • Interrupt verification hardware should use the current ERI, read from TLB, and use the TM to identify instructions for which to generate interrupts.
  • Check interrupts can be accomplished in two ways: first â uses every bit of TM to enable / disable interruption 'to each affected instruction. This is the most flexible method and allows any kind of evolution, even non-sequential, of instruction generations, as currently occurs between Intel and AMD editions when creating new extensions. In the case of conflicting scenarios, both vendors can emulate each other's instructions through emulation mechanisms as described now. The second mechanism is more linear and considers only the values of the UR. Each UIS will have its URx: PRy to be compared with URx: SRy, generating an interrupt when the SR is older.
  • the software part consists of the emulation layer that allows execution of the removed instructions, as well as changes to the following components: linkers, loaders and system calls. All of these components need to be aware of the code version to correctly update page table entries.
  • the SR needs to be noted in the file containing the software, such as in the ELF or PE format header. All unnotated files should be considered SRO ( Figure 7).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The present invention pertains to the field of information technology and more specifically to the execution of instructions in computer architectures and legacy code compatibility, and relates to a method and system for removal of instructions in computer architectures without disrupting compatibility with legacy code. The method and system may be used to guarantee compatibility of execution of old programs on new generations of a specific processor that does not necessarily include the subset of instructions necessary to execute the code thereof.

Description

MÉTODO E SISTEMA PARA EMULAÇÃO DE INSTRUÇÕES E EXECUÇÃO  METHOD AND SYSTEM FOR EMULATING INSTRUCTIONS AND IMPLEMENTATION
DE CÓDIGO LEGADO LEGACY CODE
CAMPO DA INVENÇÃO FIELD OF INVENTION
[1] A presente invenção se insere no campo da tecnologia da informação, mais especificamente na execução de instruções em arquiteturas de computador e na compatibilidade do código legado, e refere-se a um método e sistema para remoção de instruções em arquiteturas de computador sem quebrar a compatibilidade com o código legado.  [1] The present invention is in the field of information technology, more specifically the execution of instructions in computer architectures and the compatibility of legacy code, and relates to a method and system for removing instructions in computer architectures without break compatibility with legacy code.
[2] Tem aplicação na garantia de compatibilidade de execução de programas antigos em novas gerações de um determinado processador, que não necessariamente inclui o subconjunto das instruções necessárias para se executar o seu código.  [2] Has an application in ensuring compatibility of execution of old programs in new generations of a given processor, which does not necessarily include the subset of the instructions necessary to execute its code.
FUNDAMENTOS DA INVENÇÃO  BACKGROUND OF THE INVENTION
[3] À medida que a arquitetura de um computador evolui, sucessivas gerações de novas instruções são adicionadas à mesma, o que causa um aumento da complexidade do conjunto de instruções e torna o projeto deste processador cada vez mais difícil. Mais especificamente, existe uma limitação quanto ao número de instruções que um processador suporta, que está relacionado à quantidade de bytes necessários para codificação do código de operação. No caso dos processadores RISC, onde a codificação das instruções possui tamanho fixo, este aumento do número de instruções pode até saturar o espaço de códigos de operações {opcodes) , inviabilizando a adição de novas instruções no futuro. [4] Atualmente, sempre que uma arquitetura tem seu conjunto de instruções sobrecarregado com o excesso de instruções não utilizadas, uma nova versão da arquitetura ou um novo modo de execução é criado. Se for optado por uma nova arquitetura, a mesma não será compatível com a anterior e todo o software terá que ser recompilado. Por outro lado, se optar-se pela criação de um novo modo de execução, este novo modo . de execução requererá suporte do sistema operacional para detectar e seiecionar o modo correto para cada programa. Além disso, a complexidade do processador é aumentada pela adição do novo modo e manutenção do modo anterior. [3] As a computer architecture evolves, successive generations of new instructions are added to it, which increases the complexity of the instruction set and makes the design of this processor increasingly difficult. More specifically, there is a limitation on the number of instructions a processor supports, which is related to the number of bytes required to encode the operation code. In the case of RISC processors, where instruction encoding is fixed in size, this increase in the number of instructions may even saturate the opcodes space, making it impossible to add new instructions in the future. [4] Currently, whenever an architecture has its instruction set overloaded with too many unused statements, a new version of the architecture or a new execution mode is created. If a new architecture is chosen, it will not be compatible with the previous one and all software will have to be recompiled. On the other hand, if you choose to create a new mode of execution, this new mode. execution will require operating system support to detect and know the correct mode for each program. In addition, processor complexity is increased by adding the new mode and maintaining the previous mode.
[5] Diversas outras propostas focaram neste problema ao tentar aumentar a eficiência da codificação ao utilizar de iniciativas que dão suporte à codificação compacta, permitindo um processador utilizar um número menor de instruções para funcionar. Em última instância, isto concede mais espaço para que novos conjuntos de instruções possam ser acrescentados ao mesmo, se necessário. Note que isto não resolve o problema de quando o número máximo de instruções suportadas for atingido, mas apenas faz com que este seja adiado por um tempo maior.  [5] Several other proposals have addressed this problem by trying to increase coding efficiency by using initiatives that support compact coding, allowing a processor to use fewer instructions to function. This ultimately gives more space so that new instruction sets can be added to it if necessary. Note that this does not solve the problem when the maximum number of supported statements is reached, but only causes it to be delayed for a longer time.
[6] Por fim, uma solução mais utilizada é simplesmente realizar a substituição de instruções ultrapassadas (pouco utilizadas por aplicações modernas) por instruções novas, resolvendo o problema de espaço. No entanto, essa técnica leva ao problema da compatibilidade de execução do código legado, ou seja, em programas compilados para uma versão de um determinado processador, este pode solicitar instruções que já não estão presentes na versão atual do mesmo, impedindo sua execução. [6] Finally, a commonly used solution is simply to replace outdated instructions (rarely used by modern applications) with new ones, solving the space problem. However, this technique leads to the problem of code execution compatibility. legacy, that is, in programs compiled for a version of a particular processor, the processor may request instructions that are no longer present in the current version of the same, preventing its execution.
[7] É. justamente sobre esta última técnica que a presente invenção propõe um método inédito de reciclagem de instruções ultrapassadas, ao propor a emulação destas instruções removidas a partir das ainda presentes no conjunto atual de instruções do processador. Sempre que uma instrução removida for requisitada pelo programa em execução, uma rotina estabelecida no processador é capaz de interpretar esta solicitação e estabelecer uma sequência alternativa de instruções existentes com o mesmo propósito (emulação) . Não foi encontrado no estado da técnica nenhum documento que demonstre métodos de reciclagem de instruções com emulação nem outra alternativa similar que garanta a compatibilidade de execução do código legado.  [7] It is. It is precisely on this latter technique that the present invention proposes an unprecedented method of recycling outdated instructions by proposing the emulation of these instructions removed from those still present in the current processor instruction set. Whenever a removed instruction is requested by the running program, a processor-established routine is able to interpret this request and establish an alternate sequence of existing statements with the same purpose (emulation). No document demonstrating emulation instruction recycling methods or any other similar alternative ensuring legacy code execution compatibility has been found in the prior art.
BREVE DESCRIÇÃO DA INVENÇÃO  BRIEF DESCRIPTION OF THE INVENTION
[8] A presente invenção se refere a um método e sistema para remoção d'e instruções em arquiteturas de computador, que garante a compatibilidade de execução do código legado.  [8] The present invention relates to a method and system for the removal of instructions in computer architectures, which ensures compatibility of execution of legacy code.
[9] Mais especificamente, compreende meios de reciclagem de instruções em arquiteturas de computador, que viabilizam a execução de uma rotina no processador capaz de estabelecer uma sequência alternativa de instruções existentes (emulação) ao ser solicitado pelo programa a execução de uma instrução previamente removida. Nesta situação, o programa não tem sua execução impedida e a compatibilidade do código legado é garantida. [9] More specifically, it comprises instructional recycling means in computer architectures, which enable the execution of a processor routine capable of establishing an alternate sequence of existing instructions (emulation) upon request by the program to execute a previously removed instruction. . In this In this situation, the program is not prevented from running and legacy code compatibility is guaranteed.
[10] O método pode ser descrito compreendendo as seguintes etapas:  [10] The method may be described comprising the following steps:
(a) Criação de uma nova instrução;  (a) creation of a new instruction;
- (b) Remoção de uma instrução antiga;  - (b) Removal of an old instruction;
(c) Reciclagem da UIS (unique instruction signature) correspondente;  (c) recycling of the corresponding unique instruction signature (UIS);
(d) Preparação para emulação da instrução removida em (b) .  (d) Preparation for emulation of instruction removed in (b).
(dl) Determinar um Número de Revisão "UR" para cada UIS, e atualizá-lo sempre que sua instrução correspondente for reciclada.  (dl) Determine a "UR" Revision Number for each UIS, and update it whenever its corresponding statement is recycled.
(d2) Estabelecer a sequência de instruções que executa operação equivalente à instrução removida .  (d2) Establish the sequence of instructions that performs operation equivalent to the removed statement.
(d3) Determinar o Vetor de Revisão "RV" para um PR.  (d3) Determine the "RV" Review Vector for a PR.
(d4) Determinar as máscaras de interrupção "TM" para as SR anteriores m um PR.  (d4) Determine the "TM" interrupt masks for previous SRs in a PR.
(d5) Determinar o índice de Revisão Efetiva "ERI".  (d5) Determine Effective Review Index "ERI".
(d'6) Determinar o Vetor de Revisão Ativa "ARV" . (d ' 6) Determine Active Review Vector "ARV".
(e) Emulação da instrução removida em (b) .  (e) Emulation of the statement removed in (b).
(el) Verificar se. um programa de computador SRí está sendo executado em um processador PRj , para i<j .  (el) Verify that. a SRi computer program is running on a PRj processor, for i <j.
(e2) Procurar no ERI a entrada correspondente à diferença entre os índices j e i. (e3) Identificar no ARV a TM correspondente ao índice calculado em (e2) . (e2) Look in the ERI for the entry corresponding to the difference between the indices je i. (e3) Identify in ARV the TM corresponding to the index calculated in (e2).
(e4) Verificar se determinada instrução executada pela SR está contemplada na TM selecionada .  (e4) Verify that a given instruction executed by the SR is included in the selected TM.
(e5) Executar a sequência alternativa de instruções equivalente à instrução identificada em' (e4). (e5) Execute the alternate sequence of instructions equivalent to the instruction identified in ' (e4).
BREVE DESCRIÇÃO DAS FIGURAS BRIEF DESCRIPTION OF THE FIGURES
Figura 1 - Mostra o mecanismo de desatualízação e reciclagem de uma instrução, e o problema da compatibilidade retroativa .  Figure 1 - Shows the mechanism of outdating and recycling an instruction, and the problem of backwards compatibility.
Figura 2 - Mostra a Revisão de UIS (UR) , que registra as instruções que estiveram associadas a um UIS específico nas versões anteriores de um processador.  Figure 2 - Shows the UIS Revision (UR), which records instructions that were associated with a specific UIS in previous versions of a processor.
Figura 3 - Mostra um exemplo de uma trap mask do tipo TM(a,b), em que um programa SRa está sendo executado em um processador PRb .  Figure 3 - Shows an example of a TM (a, b) trap mask where an SRa program is running on a PRb processor.
Figura 4 - Mostra um exemplo de um Vetor de Revisão At iva .  Figure 4 - Shows an example of an Active Review Vector.
Figura 5 - Emulação da instrução removida.  Figure 5 - Emulation of removed instruction.
Figura 6 - Indica a extensão da tabela de páginas para indicar a revisão do software existente em cada uma das páginas de memória do computador.  Figure 6 - Indicates the length of the page table to indicate the revision of the software on each of the computer's memory pages.
Figura 7 - Indica o fluxo de desenvolvimento de software e como o processo de revisão de software é anotado em cada uma das fases, incluindo os arquivos intermediários, bibliotecas e o executável final. A figura também indica uma possível disposição deste arquivo . executável em memória com atenção ao fato que o Software e a Biblioteca 1 podem coexistir na mesma página po terem a mesma SR, já a biblioteca 2 tem que ficar em uma página distinta. Figure 7 - Indicates the software development flow and how the software review process is noted in each phase, including the intermediate files, libraries, and the final executable. The figure also indicates a possible disposition of this file. executable in memory with attention to the fact that Software and Library 1 can coexist on the same page because they can have the same SR, library 2 has to be on a separate page.
DESCRIÇÃO DETALHADA DA INVENÇÃO  DETAILED DESCRIPTION OF THE INVENTION
[11] A presente invenção se refere a um método e sistema para remoção de instruções em arquiteturas de computador, que garante a compatibilidade de execução do código legado.  [11] The present invention relates to a method and system for removing instructions in computer architectures, which ensures compatibility of execution of legacy code.
[12] Mais especificamente, compreende meios de reciclagem de instruções em arquiteturas de computador, que viabilizam a execução de uma rotina no processador capaz de estabelecer uma sequência alternativa de instruções existentes (emulação) ao ser solicitado pelo programa a execução de uma instrução previamente xemovida. Nesta situação, o programa não tem sua execução impedida e a compatibilidade do código legado é garantida.  [12] More specifically, it comprises instructional recycling means in computer architectures, which enable the execution of a processor routine capable of establishing an alternative sequence of existing instructions (emulation) upon request by the program to execute a previously removed instruction. . In this situation, the program is not prevented from running and legacy code compatibility is guaranteed.
[13] 0 método pode ser descrito compreendendo as seguintes etapas:  [13] The method may be described comprising the following steps:
(a) Criação de uma nova instrução;  (a) creation of a new instruction;
(b) Remoção de uma instrução antiga;  (b) Removal of an old instruction;
(c) Reciclagem da UIS (unique instruction signature) correspondente;  (c) recycling of the corresponding unique instruction signature (UIS);
(d) Preparação para emulação da instrução removida em (b) .  (d) Preparation for emulation of instruction removed in (b).
(dl) Determinar um Número de Revisão "UR" para cada UIS, e atualizá-lo sempre que sua instrução correspondente for reciclada. (o!2) Estabelecer a sequência de instruções que executa operação equivalente à instrução removida . (dl) Determine a "UR" Revision Number for each UIS, and update it whenever its corresponding statement is recycled. (o! 2) Establish the sequence of instructions that performs operation equivalent to the removed statement.
(d3) Determinar o Vetor de Revisão "RV" para um PR.  (d3) Determine the "RV" Review Vector for a PR.
(d4) Determinar as Máscaras de Interrupção "TM" para as SR anteriores em um PR.  (d4) Determine "TM" Interrupt Masks for previous SRs in a PR.
(d5) Determinar o índice de Revisão Efetiva "ERI".  (d5) Determine Effective Review Index "ERI".
(d6) Determinar o Vetor de Revisão Ativa "ARV" .  (d6) Determine Active Review Vector "ARV".
(e) Emulação da instrução removida em (b) .  (e) Emulation of the statement removed in (b).
(el) Verificar se um programa de computador (el) Verify that a computer program
SRi está sendo executado em um processadorSRi is running on a processor
PRj , para i<j . PRj, for i <j.
(e2) Armazenar no ERI a diferença entre os (e2) Store in ERI the difference between the
Índices j e i. Indexes j and i.
(e3) Identificar no ARV a TM correspondente ao índice calculado em (e2) .  (e3) Identify in ARV the TM corresponding to the index calculated in (e2).
(e4) Verificar se determinada instrução chamada pela SR está contemplada na TM selecionada.  (e4) Verify that a given instruction called by the SR is included in the selected TM.
(e5) Executar a sequência alternativa de instruções equivalente à instrução identificada em (e4) .  (e5) Execute the alternate sequence of instructions equivalent to the instruction identified in (e4).
[14] Definindo o termo versão do processador, ou processor revision (PR), e versão do software, ou software revísion, (SR), pode-se dizer que "PR" identifica o conjunto de instruções implementado no processador enquanto "SR" indica a "PR" para o qual o software foi compilado. [15] A assinatura única de instruções, ou UI-S (do inglês unique instruction signature) , é um identificador único de instruções. Este identificador é geralmente associado à mesma instrução em diferentes gerações, de uma mesma arquitetura para garantir a compatibilidade com código legado. O conjunto de todos os UIS válidos determina um espaço UIS e a inserção de novas' UIS pode comprometer o espaço disponível. Uma UIS pode então ser reutilizada ao desassociar-se de uma instrução antiga e associar-se a uma nova instrução. reuso de' UIS implica em- revisões sequenciais de processadores.-' Este processo' pode continuar por mais de uma vez, com um UIS - cobrindo' a vida útil de várias instruções diferentes, e portanto, várias "PR" diferentes. Por exemplo, por toda sua história, o conjunto de instruções ou ISA (do inglês instruction set architecture) do x86 teve apenas um único PR, já que nunca teve um UIS reciclado. [14] By defining the term processor revision (PR) and software version, or software revision (SR), it can be said that "PR" identifies the instruction set implemented in the processor as "SR" indicates the "PR" for which the software was compiled. [15] The unique instruction signature (UI-S) is a unique instruction identifier. This identifier is usually associated with the same statement across different generations, from the same architecture to ensure compatibility with legacy code. The set of all valid UISs determines a UIS space and the insertion of new ' UISs may compromise the available space. A UIS can then be reused by disassociating from an old instruction and associating with a new instruction. reuse of ' UIS implies sequential processor revisions.- ' This process ' can continue for more than once, with one UIS - covering ' the useful life of several different instructions, and therefore several different 'PRs'. For example, throughout its history, the x86 instruction set architecture or ISA had only one PR, as it never had a recycled UIS.
[16] À medida, que a arquitetura do conjunto de instruções e os processadores" evoluem, a sua "PR" é incrementada, podendo existir, portanto, diversas versões do processador (i.e. PR1, PR2, PRN) e, consequentemente, diversas, versões do software (i.e. SRI, SR2, SR ) . Um software, com versão SRi é- totalmente compatível com um processador na versão PRj se i = j . [16] As that set architecture instructions and processors "evolve, their" PR "is incremented, and may therefore exist several versions of the processor (ie PR1, PR2, PRN) and therefore several , software versions (ie SRI, SR2, SR) Software with version SRi is fully compatible with a processor in version PRj if i = j.
[17] No entanto, sempre que surge uma PR , as SRi anteriores (i<j). não têm compatibilidade garantida, porque podem vir a requisitar uma instrução não disponível. :Nesta situação, o programa solicitará uma UIS que o levará a uma instrução completamente diferente da desejada, impedindo sua correta execução. [17] However, whenever a PR arises, the previous SRi (i <j). are not guaranteed compatible because they may request an unavailable instruction. : Nesta In this situation, the program will request a UIS that will take you to a completely different instruction than you want, preventing its correct execution.
[18] Quando uma determinada instrução for considerada obsoleta e sua UIS passível de ser reutilizada, geralmente é promovido um estágio de desatualização. Ele garante tempo suficiente aos times de desenvolvedores de compiladores e sistemas operacionais para atualizar seus produtos propriamente, e consiste nas etapas de Criação, Desatualização e Reciclagem (figura 1):  [18] When a particular statement is considered obsolete and its UIS is reusable, an outdated stage is usually promoted. It guarantees enough time for compiler and operating system developer teams to properly upgrade their products, and consists of the Creation, Downgrading, and Recycling steps (Figure 1):
Criação  Creation
[19] Inicialmente, uma nova instrução é criada e associada a uma UIS no PR . A UIS pode nunca ter sido usada antes (uma instrução previamente inválida ) , ou pode ter sido reciclada de outra instrução (conforme etapa de "desatualização" abaixo) . Apenas após um longo processo de evolução de software essa instrução será de fato incorporada em programas de usuários, pois pode levar tempo para que esta instrução seja adotada por compiladores e bibliotecas distribuídas aos usuários. [19] Initially, a new instruction is created and associated with a UIS in PR. TUI may never have been used before (a previously invalid instruction), or may have been recycled from another instruction (as stage of "outdated" below). Only after a long process of software evolution will this instruction actually be incorporated into user programs, as it may take time for this instruction to be adopted by compilers and libraries distributed to users.
Desatualização  Downgrading
[20] Avanços tecnológicos e novas demandas de mercado promovem a evolução de processadores, trazendo novidades no conjunto de instruções que podem sobrepor a funcionalidade de instruções mais velhas. Assim, funcionalidades muito específicas de um processador podem acabar ficando obsoletas. Após decidir obsolescer uma instrução, em algum momento entre duas PRs de um processador, o fabricante do processador deve anunciar este fato à comunidade. Em sequência, os fabricantes de compiladores removem suporte a esta instrução, e os fabricantes de sistemas operacionais começam a utilizar instruções alternativas àquela obsoleta. [20] Technological advances and new market demands drive the evolution of processors, bringing new instruction set that may override the functionality of older instructions. Thus, very processor-specific features may become obsolete. After deciding to obsolescer an instruction, in some At the moment between two PRs of a processor, the processor manufacturer must announce this fact to the community. As a result, compiler manufacturers remove support for this instruction, and operating system manufacturers begin using alternative instructions to the obsolete one.
Reciclagem  Recycling
[21] A desatualização de uma instrução disponibiliza uma UIS pára a PR seguinte e permite sua associação à nova instrução criada. Uma UIS deve ser associada a uma única instrução, e vice-versa.  [21] Downgrading an instruction makes a UIS available for the next PR and allows it to be associated with the newly created instruction. A UIS must be associated with a single statement, and vice versa.
Compatibilidade retroativa  Backward compatibility
[22] Por definição, um processador PR1 tem pelo menos uma UIS reciclada a partir de PRO, e tem implementações diferentes entre si. A execução de um SRi em um PRj (i<j) gerará problemas de compatibilidade retroativa se o(s) UIS em questão existir (em) no software em execução. Como demonstrado na Figura 1, a instrução VADD da PRb tem o mesmo opcode da AAA da PRa .  [22] By definition, a PR1 processor has at least one UIS recycled from PRO, and has different implementations. Running an SRi on a PRj (i <j) will cause backward compatibility issues if the UIS (s) in question exist in the running software. As shown in Figure 1, PRb's VADD instruction has the same opcode as PRa's AAA.
[23] Como pode ser observado, este estágio de desatualização requer um tempo considerável, e quase sempre implica na necessidade de recompilação de um programa de computador para a nova versão do processador (PR), afim de garantir seu correto funcionamento. Ainda, também apresenta um problema para o usuário final desta aplicação, que deverá adquirir versões mais recentes (ou atualizações ) deste programa de computador ou nunca atualizar o processador para um modelo mais novo. [24] Neste contexto considera-se a utilidade da presente invenção, que permite associar UIS antigos a novas instruções, ou instruções diferentes, sem quebrar a compatibilidade com código legado, através de um novo mecanismo de reciclagem. Com esta técnica, quando um programa SRi executado em um PRj (i<j) solicitar uma instrução previamente removida, uma rotina de emulação é estabelecida afim de encontrar um caminho alternativo utilizando as instruções existentes, permitindo sua correta execução. Mais especi icamente, fornece o comportamento da instrução antiga através de emulação em software através de interrupções da CPU. Cada arquivo que armazena um software tem seu SR anotado no cabeçalho de forma a indicar o PR especifico ao qual ele foi projetado, indicando ao Sistema Operacional como configurar as potenciais rotinas de emulação necessárias caso a revisão do software seja diferente da do processador. [23] As can be seen, this stage of downgrading requires considerable time, and almost always implies the need to recompile a computer program to the new processor (PR) version to ensure its proper functioning. Also, it presents a problem for the end user of this application, who should purchase newer versions (or updates) of this computer program or never upgrade the processor to a newer model. [24] In this context the usefulness of the present invention is considered, which allows to associate old UIS to new instructions, or different instructions, without breaking the compatibility with legacy code, through a new recycling mechanism. With this technique, when an SRi program executed in a PRj (i <j) requests a previously removed instruction, an emulation routine is established in order to find an alternative path using existing instructions, allowing its correct execution. More specifically, it provides the behavior of the old instruction through software emulation through CPU interrupts. Each file that stores software has its SR annotated in the header to indicate the specific PR it was designed for, telling the Operating System how to configure the potential emulation routines needed if the software revision is different from the processor's.
Revisão UIS  UIS Review
[25] Para a aplicação da presente invenção, tendo em vista que a reciclagem e os passos de criação ocorrem simultaneamente em um mesmo PR, cada UIS deve ser dotada de seu próprio número de Revisão UIS (UR) , que acompanha quantas instruções estiveram associadas a este UIS especifico nas versões anteriores de um processador, como mostra a Figura 2. Uma alteração de ao menos um UR implica na atualização do PR, já que uma mudança na associação entre um UIS e uma instrução irá mudar a revisão do processador. .Uma exceção ocorre quando um UIS é associado pela primeira vez, caso em que não há modificação do PR. Finalmente, alterar um UR nunca afeta os outros URs, o que estabelece uma ortogonalidade à esta abordagem. [25] For the application of the present invention, since recycling and creation steps occur simultaneously in the same PR, each UIS must be endowed with its own UIS Revision Number (UR), which accompanies how many instructions have been associated. to this specific UIS in earlier versions of a processor, as shown in Figure 2. A change of at least one UR implies updating the PR, as a change in the association between a UIS and an instruction will change the processor revision. . An exception occurs when a UIS is first associated, in which case that there is no modification of PR. Finally, changing one UR never affects the other URs, which establishes an orthogonality to this approach.
Sequência de instruções de emulação  Emulation Instruction Sequence
Uma instrução só pode ser removida se for possível encontrar, entre as instruções restantes da arquitetura, uma sequência alternativa de instruções, que consiga realizar o comportamento- da primeira. Esta tarefa fica a cargo dos projetistas de processadores e as sequências alternativas devem ser distribuídas aos desenvolvedores de Sistemas Operacionais como rotinas de emulação da instrução removida.  An instruction can only be removed if it is possible to find among the remaining architecture instructions an alternative sequence of instructions that can perform the first behavior. This task is handled by processor designers, and alternate sequences should be distributed to Operating System developers as emulation routines of the removed instruction.
Vetores de Revisões e Máscara de Interrupção  Revision Vectors and Interrupt Mask
[26] Seja o operador um "OU exclusivo" definido da forma abaixo:  [26] Let the operator be an "exclusive OR" defined as follows:
A θ B = 0, se A = B  A θ B = 0, if A = B
A θ B - 1, se A ≠ B (equação 1) A θ B - 1, if A ≠ B (equation 1)
[27] E seja o operador ® definido como um "OU exclusivo" entre elementos de mesma posição em diferentes conjuntos na forma abaixo: [27] And let the operator be defined as an "exclusive OR" between elements of the same position in different sets as follows:
X ® Y = {χθ,.,.,χη} ®{yO,...,yn}  X ® Y = {χθ,.,., Χη} ® {yO, ..., yn}
X ® Y = (xO Θ yO, ... ,χη Θ yn} (equação 2)X ® Y = (xO Θ yO, ..., χ η Θ yn} (equation 2)
[28] Definindo-se um Vetor de Revisão (RV) como o conjunto das UR que identificam unicamente um PR, para um dado PRx, sua RVx é definida como: [28] Defining a Review Vector (RV) as the set of UR that uniquely identifies a PR, for a given PRx, its RVx is defined as:
RVx = {URO, URn}' (equação 3)RVx = {URO, URn} ' (equation 3)
[29] Aplicando o operador (g) entre dois RVs, temos como resultado a diferença entre cada elemento. O resultado é chamado de Máscara de Interrupção, ou trap mask (TM) : [29] Applying the operator (g) between two RVs results in the difference between each element. The result is called an Interrupt mask, or trap mask (TM):
TM{x,y} = RVx <¾ RVy  TM {x, y} = RVx <¾ RVy
= {UR{x,0}, UR{x,n}} <g) {UR{y,0}, UR{y,n}} = {UR {x, 0}, UR {x, n}} <g) {UR {y, 0}, UR {y, n}}
= {UR{x,0} Θ UR{y,0}, {UR{x,n} Θ UR{y,n}} = {UR {x, 0} Θ UR {y, 0}, {UR {x, n} Θ UR {y, n}}
(equação 4) (equation 4)
[30] Desta forma, TM{x,y} indica a lista de todas as instruções que precisam ser emuladas quando um software SRx é executado no processador PRy. A rotina de interrupção é responsável por fornecer as rotinas de emulação especificas. Quanto melhor for a escolha das instruções a serem removidas, menor será o overhead ou o custo extra das rotinas de emulação. A figura 3 ilustra bem este processo. [30] Thus, TM {x, y} indicates the list of all instructions that need to be emulated when running SRx software on the PRy processor. The interrupt routine is responsible for providing the specific emulation routines. The better you choose which instructions to remove, the lower the overhead or extra cost of emulation routines. Figure 3 illustrates this process well.
Definições adicionais  Additional Settings
[31] O operador "+" (mais) é definido como um "OU" lógico entre dois bits. Dadas duas revisões sucessivas mas não sequenciais de PRs, como PRa e PRe, supondo PRb, PRc e PRd como as revisões, intermediárias, definimos o operador Pack como:  [31] The "+" (plus) operator is defined as a logical "OR" between two bits. Given two successive but non-sequential reviews of PRs, such as PRa and PRe, assuming PRb, PRc and PRd as the intermediate revisions, we define the Pack operator as:
Pack(PRa, PRe) - TM{a,e} + TB{b,e} + TM{c,e} + TM{d,e}  Pack (PRa, PRe) - TM {a, e} + TB {b, e} + TM {c, e} + TM {d, e}
(equação 5) (equation 5)
[32] O operador módulo do conjunto S, denotado por \S\ indica quantos elementos com valor não zero existem no conjunto S. [32] The modulo operator of set S, denoted by \ S \ indicates how many nonzero elements exist in set S.
Implementação - Vetor de Revisão Ativa  Implementation - Active Review Vector
[33] Para uma revisão do processador PRi, todos os softwares SRj com j < i precisarão de suporte de emulação. Uma implementação factível envolve o suporte eficiente às SRs mais recentes e um suporte mais custoso às revisões antigas. Para isto, é proposto o índice de Revisão Efetiva (ERI), com 4 bits, que codifica todas as revisões suportadas: a atual, 14 anteriores e todas as demais colapsadas com o operador Pack. Um ERI é um índice para o Vetor de Revisão Ativa (ARV) , onde cada elemento contém uma conexão direta com o PR e o RV. Assim, usando um ERI para indexar um elemento da ARV, seleciona-se a TM à qual o processador utilizará para gerar as interrupções. Todos os ERI com revisões antigas são mapeados num único elemento da ARV e o TM é calculado via operador Pack. Como este TM é a união de todas as revisões antigas e |Pack| é grande (mais instruções para emular), esta emulação será mais cara. Destaca-se que indexar as últimas 14 revisões . sempre reduz 1 TM 1 já que apenas o PR e SR atuais são relevantes para o cálculo e menos instruções precisarão de emulação. [33] For a PRi processor revision, all SRj software with j <i will require emulation support. A feasible implementation involves efficient support for Newer SRs and more costly support for older revisions. For this, the 4-bit Effective Review Index (ERI) is proposed, which encodes all supported revisions: current, previous 14, and all other collapses with the Pack operator. An ERI is an index for the Active Review Vector (ARV), where each element contains a direct connection to PR and RV. Thus, using an ERI to index an ARV element, we select the TM that the processor will use to generate the interrupts. All ERIs with older revisions are mapped to a single ARV element and the TM is calculated via the Pack operator. How this TM is the union of all old revisions and | Pack | is large (more instructions to emulate), this emulation will be more expensive. It is noteworthy that index the last 14 reviews. always reduces 1 TM 1 since only current PR and SR are relevant to the calculation and fewer instructions will need emulation.
[34] Um exemplo desta configuração é mostrado na Figura 4, em que um programa SR5O executado em um processador PR60 implica em uma ERI = 60 - 50 = 10, ou seja, a posição 10 de indexação no ARV: ARV[10], que corresponde à máscara TM50,60. Se uma versão SR40 de um programa for executada neste processador, a ERI calculada será de ERI = 60 - 40 = 20. Como o limite da ARV são 16 posições apenas, o resultado efetivo será ERI = 15, que corresponde à última entrada do ARV: ARV[15]. A trap masJf resultante para ARV[15] serão todas as anteriores colapsadas com o operador Pack: ΤΜ^ο,εο = Pack(PRo, PReo-i5=45) , ou seja, consolida as primeiras revisões em uma só . [34] An example of this configuration is shown in Figure 4, where an SR5O program running on a PR60 processor implies an ERI = 60 - 50 = 10, ie the ARV indexing position 10: ARV [10], which corresponds to the mask TM50,60. If an SR40 version of a program runs on this processor, the calculated ERI will be ERI = 60 - 40 = 20. Since the ARV limit is 16 positions only, the effective result will be ERI = 15, which corresponds to the last ARV entry. : ARV [15]. The resulting masJf trap for ARV [15] will all be collapsed with the Pack operator: ΤΜ ^ ο, εο = Pack (PRo, PReo-i5 = 45), ie consolidate first revisions in one.
Emulação da instrução removida  Statement emulation removed
[35] Uma vez que uma instrução não implementada precise ser executada, o processador gerará uma interrupção na execução do programa, transferindo o controle para o sistema operacional, que decodificará a instrução e, junto com a SR correspondente, transferirá o controle para a "Sequência de Instruções de Emulação" referente a esta instrução, conforme Figura 5.  [35] Once an unimplemented instruction needs to be executed, the processor will interrupt program execution by transferring control to the operating system, which will decode the instruction and, together with the corresponding SR, transfer control to " Emulation Instruction Sequence "for this instruction, as shown in Figure 5.
Hardware  Hardware
[36] 0 projeto de hardware dò processador deve incluir informações suficiente para decidir quando emular uma instrução ao não. Para isto, o processador deve estar ciente da versão do software atualmente em execução para comparar com sua própria revisão. Uma dentre as várias formas de implementar esta funcionalidade consiste na criação de uma instrução especifica, que informa ao processador a versão das próximas instruções (granularidade de instrução) . Outra forma é uma arquitetura de memória virtual que inclua as informações sobre versão em cada página (granularidade de página) . A granularidade de instrução implica no uso de uma instrução extra para indicar que um novo código está prestes a ser executado. A granularidade de página evita que se tenha que incluir esta nova instrução para ligar pedaços distintos de software. Seu esquema pode ser melhor observado a partir da Figura 6.  [36] The processor hardware design must include enough information to decide when to emulate a no statement. For this, the processor must be aware of the currently running software version to compare against its own revision. One of several ways to implement this functionality is to create a specific instruction that tells the processor the version of the next instructions (instruction granularity). Another form is a virtual memory architecture that includes version information on each page (page granularity). Statement granularity implies the use of an extra statement to indicate that new code is about to be executed. Page granularity avoids having to include this new instruction for linking distinct pieces of software. Your schematic can be better observed from Figure 6.
Extensão da Tabela de Página [37] Para dar suporte à granularidade de páginas, cada entrada na tabela de páginas precisa incluir o SR do seu conteúdo na forma de ERI, junto com os bits de proteção de página. A TLB (memória que armazena uma parte da tabela de páginas dentro do processador, para acelerar a execução do programa) também precisa armazenar estas informações. Desta forma, as ferramentas de software necessárias para construir um novo programa: compilador, montador e ligador devem indicar ao módulo do sistema operacional responsável pelo carregamento dos programas em memória que ele deve alocar código com diferentes ERI para páginas distintas. A Figura 7 ilustra fluxo de desenvolvimento de software e as fases do processo de revisão de software. Page Table Extension [37] To support page granularity, each page table entry must include the SR of its content in the form of ERI, along with the page protection bits. TLB (memory that stores a portion of the page table inside the processor to speed up program execution) also needs to store this information. Thus, the software tools needed to build a new program: compiler, assembler, and linker should indicate to the operating system module responsible for loading the programs in memory that it should allocate code with different ERI to different pages. Figure 7 illustrates software development flow and phases of the software review process.
Implementação nos estágios iniciais do processador  Implementation in early processor stages
[38] O hardware de verificação de interrupção deve usar o ERI atual, lido da TLB e usar a TM para identificar instruções para as quais deve gerar interrupções. A verificação de interrupções pode ser realizada de duas formas distintas: â primeira utiliza cada bit da TM para habilitar/desabilitar a interrupção ' para cada instrução afetada. Este é o método mais flexível e permite qualquer tipo de evolução, mesmo não sequencial, de gerações de instruções, como ocorre atualmente entre as edições Intel e AMD durante a criação de novas extensões. No caso -de cenários conflitantes, ambos vendedores podem emular as instruções do outro através de mecanismos de emulação como o descrito agora. O segundo mecanismo é mais linear e considera apenas os valores do UR. Cada UIS terá seu URx:PRy a serem comparados com o URx:SRy, gerando uma interrupção quando o SR é mais antigo. [38] Interrupt verification hardware should use the current ERI, read from TLB, and use the TM to identify instructions for which to generate interrupts. Check interrupts can be accomplished in two ways: first â uses every bit of TM to enable / disable interruption 'to each affected instruction. This is the most flexible method and allows any kind of evolution, even non-sequential, of instruction generations, as currently occurs between Intel and AMD editions when creating new extensions. In the case of conflicting scenarios, both vendors can emulate each other's instructions through emulation mechanisms as described now. The second mechanism is more linear and considers only the values of the UR. Each UIS will have its URx: PRy to be compared with URx: SRy, generating an interrupt when the SR is older.
[39] Em ambos os casos, o hardware extra é proporcional ao número de UIS reciclados em todas as revisões suportadas. Nenhum dos mecanismos torna o decodificador menor pois ele ainda terá que "reconhecer instruções antigas e gerar uma interrupção, em vez de transferir o controle para a ROM de microcódigo. Mesmo assim, ainda é uma vantagem considerável o fato de reduzir a ROM de microcódigo removendo implementações de instruções do hardware e transferindo elas para software. [39] In both cases, the extra hardware is proportional to the number of recycled UIS in all supported revisions. Neither mechanism makes the decoder smaller as it will still have to " recognize old instructions and generate an interrupt instead of transferring control to the microcode ROM. Still, it is still a considerable advantage to reduce the microcode ROM by removing implementations of hardware instructions and transferring them to software.
[40] No caso de pipelines com execução fora de ordem, um mecanismo alternativo é checar pelas interrupções apenas no momento de encerramento (commit) da instrução. Neste caso, apesar do atraso da interrupção, o processo de verificação sairá do caminho critico do processador, permitindo decodificadores mais simples. Em ambos os casos, reciclar instruções antigas em hardware gerará benefícios como a redução da ROM de microcódigo, compactação de código e redução do número de misses na cache de instruções que superam o custo do hardware adicional para torna-lo possível .  [40] In the case of out-of-order pipelines, an alternative mechanism is to check for interrupts only at statement commit time. In this case, despite the interruption delay, the verification process will go out of the critical processor path, allowing for simpler decoders. In either case, recycling old hardware instructions will yield benefits such as reducing microcode ROM, code compression, and reducing the number of misses in the instruction cache that outweigh the cost of additional hardware to make it possible.
Especialização do Conjunto de Instruções para Aplicações Específicas  Instruction Set Specialization for Specific Applications
[41] Ao escolher cuidadosamente um subconjunto de instruções para criar uma nova revisão, é possível reduzir drasticamente o conjunto suportado pelo processador, permitindo a entrada do processador em mercados onde a complexidade atual do mesmo é muito alta. De forma alternativa, também é possível . adicionar instruções para domínios específicos, como instruções criptográficas , sem ter que incluí-las em todos os processadores da família, simplesmente fornecendo bibliotecas de emulação para os provedores de Sistema Operacional. [41] By carefully choosing a subset of instructions to create a new revision, you can dramatically reduce the processor-supported set, allowing the processor to enter markets where its current complexity is very high. Alternatively, it is also possible. add statements for specific domains, such as cryptographic statements, without having to include them in all family processors, simply by providing emulation libraries for OS providers.
Software  Software
[42] A parte de software é composta pela camada de emulação que permite a execução das instruções removidas, além de alterações nos seguintes componentes: Ligadores (linkers) , carregadores (loaders) e chamadas de sistema. Todos estes componentes precisam estar cientes da versão do código para atualizar corretamente as entradas nas tabelas de página. O SR precisa ser anotado no arquivo que contém o software, como no cabeçalho dos formatos ELF ou PE. Todos os arquivos não anotados devem ser considerados SRO (Figura 7).  [42] The software part consists of the emulation layer that allows execution of the removed instructions, as well as changes to the following components: linkers, loaders and system calls. All of these components need to be aware of the code version to correctly update page table entries. The SR needs to be noted in the file containing the software, such as in the ELF or PE format header. All unnotated files should be considered SRO (Figure 7).
Ligadores  Connectors
[43] É preciso garantir que cada módulo carregue, sua versão até o arquivo executável final. Se houver uma diferença entre SR de dois módulos diferentes, o ligador precisará indicar que eles devem ser alocados em páginas diferentes, cada uma com seu respectivo SR. Nenhum módulo com SR diferente deve ser colocado junto numa mesma página. Para facilitar este processo, os arquivos intermediários devem também conter os seus SR gerados pelos montadores ( Figura 7 ) . Sistema operacional e carregador [43] You must ensure that each module loads its version to the final executable file. If there is a difference between SR from two different modules, the linker needs to indicate that they should be allocated on different pages, each with its own SR. No different SR module should be placed together on the same page. To facilitate this process, intermediate files should also contain their assembler-generated SRs (Figure 7). Operating system and charger
[44] Reconhece as informações do SR para cada segmento carregável presente no arquivo executável e aloca páginas de memória com seus respectivos SR. Neste momento, as rotinas de alocação de páginas de memória do sistema operacional devem ser ampliadas para conter o SR da nova página pois a aplicação pode necessitar criar .novas páginas de código ao invés de páginas de dados. Finalmente, sempre que necessário um SR e não houver um disponível, o sistema operacional deve supor o mesmo da versão atual em execução (Figura 7).  [44] Recognizes SR information for each loadable segment present in the executable file and allocates memory pages with their respective SR. At this time, operating system memory page allocation routines should be expanded to contain the SR of the new page as the application may need to create new code pages instead of data pages. Finally, whenever an SR is required and one is not available, the operating system should assume the same as the current running version (Figure 7).
Rotinas de emulação  Emulation Routines
[45] As rotinas de emulação fornecem o comportamento de instruções removidas com algumas poucas restrições. Rotinas de emulação não podem utilizar instruções removidas e não podem emular instruções que alterem o estado interno do processador, nem características especiais como atomicidade, que não podem ser reproduzidas em software. A quantidade destas instruções especiais é limitada nos conjuntos de instruções atuais. Utilizando como exemplo as instruções da Figura 2 para o UIS 14h, supondo um software com UR(14h) = 2, indicando a implementação da instrução VADD256 que realiza a soma de dois vetores de 256 bits, sendo executado num processador com UR(14h) = 3, indicando a implementação VADD512 que realiza a soma de dois vetores de 512 bits, a rotina de emulação da instrução VADD256 pode ser implementada utilizando-se a própria instrução VADD512 deixando os 256 bits superiores com valor zero, gerando um resultado equivalente. Note que pode ser necessário utilizar mais de uma instrução para complementar o comportamento correto da instrução removida. [45] Emulation routines provide the behavior of removed statements with a few restrictions. Emulation routines cannot use removed instructions and cannot emulate instructions that change the internal state of the processor or special characteristics such as atomicity that cannot be reproduced in software. The amount of these special instructions is limited in current instruction sets. Using as an example the instructions of Figure 2 for UIS 14h, assuming a software with UR (14h) = 2, indicating the implementation of the instruction VADD256 that performs the sum of two 256-bit vectors, running on a processor with UR (14h). = 3, indicating the VADD512 implementation that sums two 512-bit vectors, the VADD256 instruction emulation routine can be implemented using the VADD512 instruction itself leaving the upper 256 bits zero-value, yielding a result equivalent. Note that you may need to use more than one statement to supplement the correct behavior of the removed statement.

Claims

REIVINDICAÇÕES
1. Método de remoção de instruções em um processador e execução do código legado caracterizado por compreender as etapas de:  1. Method of removing instructions in a processor and executing legacy code comprising the steps of:
(a) Criação de uma nova instrução;  (a) creation of a new instruction;
(b) Remoção de uma instrução antiga;  (b) Removal of an old instruction;
(c) Reciclagem da UIS (unique instruction signature) correspondente ;  (c) recycling of the corresponding unique instruction signature (UIS);
(d) Preparação para emulação da instrução removida em (b) .  (d) Preparation for emulation of instruction removed in (b).
(e) Emulação da instrução removida em (b) .  (e) Emulation of the statement removed in (b).
2. Método, de acordo com a reivindicação 1, caracterizado por a etapa, de preparação da emulação (d) compreender as seguintes subetapas:  Method according to claim 1, characterized in that the step of preparing the emulation (d) comprises the following substeps:
(dl) Determinar um Número de Revisão "UR" para cada UIS, e atualizá-lo sempre que sua instrução correspondente for reciclada.  (dl) Determine a "UR" Revision Number for each UIS, and update it whenever its corresponding statement is recycled.
(d2) Estabelecer a sequência de instruções que executa operação equivalente à instrução removida.  (d2) Establish the sequence of instructions that performs operation equivalent to the removed statement.
(d3) Determinar o Vetor de Revisão (RV) para um PR. (d3) Determine the Review Vector (RV) for a PR.
(d4) Determinar as máscaras de interrupção (TM) para as SR anteriores em um PR. (d4) Determine interrupt masks (TM) for previous SRs in a PR.
(d5) Determinar o índice de Revisão Efetiva (ERI).  (d5) Determine Effective Review Index (ERI).
(d6) Determinar o Vetor de Revisão Ativa (ARV) .  (d6) Determine Active Review Vector (ARV).
3. Método, de acordo com a reivindicação 1, caracterizado por a etapa de emulação (e) compreender as seguintes subetapas :  Method according to claim 1, characterized in that the emulation step (e) comprises the following substeps:
(el) Verificar se um programa de computador SRi está sendo executado em um processador PR , para i<j .  (el) Verify that an SRi computer program is running on a PR processor, for i <j.
(e2) Procurar no ERI a entrada correspondente à diferença entre os índices j e i. (e3) Identificar no ARV a TM correspondente ao índice calculado em (e2). (e2) Look in the ERI for the entry corresponding to the difference between the indices je i. (e3) Identify in ARV the TM corresponding to the index calculated in (e2).
(e4) Verificar se determinada instrução chamada pela SR está contemplada na TM selecionada.  (e4) Verify that a given instruction called by the SR is included in the selected TM.
(e5) Executar a sequência alternativa de instruções equivalente à instrução identificada em (e4).  (e5) Execute the alternate sequence of instructions equivalent to the instruction identified in (e4).
4. Método, de acordo com a reivindicação 1, caracterizado pelo fato de que ao menos uma UIS reciclada em (c) implica na atualização do PR correspondente.  Method according to claim 1, characterized in that at least one UIS recycled in (c) implies updating the corresponding PR.
5. Método, de acordo com a reivindicação 1, caracterizado por a Revisão de UIS "UR" (dl) indicar quantas instruções estiveram associadas à UIS reciclada nas versões anteriores de um processador.  Method according to claim 1, characterized in that the "UR" UIS Revision (dl) indicates how many instructions were associated with the recycled UIS in previous versions of a processor.
6. Método, de acordo com a reivindicação 1, caracterizado por um UR de uma UIS nunca afetar um UR de outra UIS.  Method according to claim 1, characterized in that an UR of one UIS never affects an UR of another UIS.
7. Método, de acordo com a reivindicação 1, caracterizado por o Vetor de Revisão "RV" (d3) ser determinado pelo conjunto das UR que identificam unicamente um PR (equação 3) .  Method according to claim 1, characterized in that the "RV" Revision Vector (d3) is determined by the set of RUs that uniquely identify a PR (equation 3).
8. Método, de acordo com a reivindicação 1, caracterizado por a Máscara de Interrupção "TM{x,y}" (d4) ser determinada através da operação ® entre dois Vetores de Revisão RVx e RVy (equação' 4 ) .  Method according to claim 1, characterized in that the "TM {x, y}" Interruption Mask (d4) is determined by the operation ® between two RVx and RVy Revision Vectors (equation '4).
9. Método, de acordo com a reivindicação 1, caracterizado por TM{x,y} indicar a lista de todas as instruções que precisam ser emuladas quando um software SRx é executado no processador PRy.  Method according to claim 1, characterized in that TM {x, y} indicates the list of all instructions that need to be emulated when SRx software is executed on the PRy processor.
10. Método, de acordo com a reivindicação 1, caracterizado por o operador Pack consistir na operação de "OU" lógico entre duas revisões sucessivas e não sequenciais, inclusive as revisões intermediárias (equação 5). Method according to claim 1, characterized in that the Pack operator consists of the logical "OR" operation between two successive and non-sequential revisions, including intermediate revisions (equation 5).
11. Método, de acordo com a reivindicação 1, caracterizado por o índice de Revisão Efetiva "ERI" (d5). codificar todas as revisões suportadas em um determinado processador PR.Method according to claim 1, characterized in that the Effective Review Index "ERI" (d5) . code all supported revisions on a given PR processor.
12. Método, de acordo com a reivindicação 1, caracterizado por um ERI de "n" bits consistir em um indice para o Vetor de Revisão Ativa "ÁRV" com 2n elementos. 12. Method according to claim 1, characterized by an ERI "n" bits consist of an index for the active review vector "ARV" 2 n elements.
13. Método, de acordo com a reivindicação 1, caracterizado por os elementos do ARV (d6) consistirem no conjunto das TM de um processador PR, sendo 1 a revisão atual, (2n-2) revisões anteriores, e o último elemento as demais revisões anteriores colapsadas com o operador Pack. Method according to claim 1, characterized in that the ARV elements (d6) consist of the TM set of a PR processor, 1 being the current revision, (2 n -2) previous revisions, and the last element being other previous revisions collapsed with the Pack operator.
14. Método, de acordo com a reivindicação 1, caracterizado por a subetapa (e5) da emulação ocorrer em software através de interrupções da CPU na execução do programa, e transferir o controle para o sistema operacional.  Method according to claim 1, characterized in that the substep (e5) of the emulation occurs in software through CPU interrupts in the execution of the program, and transfers control to the operating system.
15. Método, de acordo com a reivindicação 14, caracterizado pelo fato de o sistema operacional decodificar a instrução e, junto com a SR correspondente, transferir o controle para a "Sequência de Instruções de Emulação" referente a esta instrução .  Method according to claim 14, characterized in that the operating system decodes the instruction and, together with the corresponding SR, transfers control to the "Emulation Instruction Sequence" for that instruction.
16. Sistema.de remoção de instruções em um processador e execução do código legado, caracterizado por compreender:  16. A system for removing instructions in a processor and executing legacy code, comprising:
(a) Método de acordo com qualquer uma das reivindicações de 1 a 15;  (a) Method according to any one of claims 1 to 15;
(b) Processador dotado de estrutura para emulação de uma instrução.  (b) Processor with structure for emulating an instruction.
17. Sistema, de acordo com a reivindicação 16, caracterizado por o processador identificar a versão do software SR em execução e comparar à sua própria revisão PR. System according to claim 16, characterized in that the processor identifies the version of the SR software running and compares it to its own revision PR.
18. Sistema, de acordo com a reivindicação 17, caracterizado pela identificação da SR ser realizada por uma arquitetura de memória virtual que inclua as informações sobre a versão em cada página ou alternativamente, via instrução especifica. System according to claim 17, characterized in that the identification of the SR is carried out by a virtual memory architecture that includes version information on each page or alternatively via specific instruction.
19. Sistema, de acordo com a reivindicação 18, caracterizado pelo fato de cada entrada na tabela de páginas e a TLB incluir o SR do seu conteúdo na forma de ERI, junto com os bits de proteção de página.  System according to claim 18, characterized in that each entry in the page table and the TLB includes the SR of its content in the form of ERI, together with the page protection bits.
20. Sistema, de acordo com a reivindicação 16, caracterizado por o hardware de verificação de interrupção utilizar o ERI atual e usar a TM para identificar instruções para as quais devem ser geradas interrupções.  System according to claim 16, characterized in that the interrupt checking hardware uses the current ERI and uses the TM to identify instructions for which interrupts are to be generated.
21. Sistema, de acordo com a reivindicação 17, caracterizado por a habilitação/desabilitação da interrupção ser realizada por cada bit da TM selecionada.  System according to claim 17, characterized in that the interrupt enable / disable is performed by each bit of the selected TM.
22. Uso do sistema conforme definido nas reivindicações de 15 a 21, caracterizado por ser para emulação de instruções removidas em versões de um processador.  Use of the system as defined in claims 15 to 21, characterized in that it is for emulating instructions removed in versions of a processor.
23. Uso do sistema conforme definido nas reivindicações de 15 a 21/ caracterizado por ser para reduzir o conjunto de instruções suportadas por um processador.  Use of the system as defined in claims 15 to 21, characterized in that it is for reducing the instruction set supported by a processor.
24. Uso do sistema conforme definido nas reivindicações de 15 a 21, caracterizado por ser para emular instruções de aplicação especifica.  Use of the system as defined in claims 15 to 21, characterized in that it is for emulating specific application instructions.
PCT/BR2015/000181 2015-03-13 2015-12-04 Method and system for instruction emulation and legacy code execution WO2016145498A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
BR102015005838-1A BR102015005838B1 (en) 2015-03-13 METHOD AND SYSTEM FOR INSTRUCTION EMULATION AND LEGACY CODE EXECUTION
BRBR1020150058381 2015-03-13

Publications (1)

Publication Number Publication Date
WO2016145498A1 true WO2016145498A1 (en) 2016-09-22

Family

ID=56888792

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/BR2015/000181 WO2016145498A1 (en) 2015-03-13 2015-12-04 Method and system for instruction emulation and legacy code execution

Country Status (1)

Country Link
WO (1) WO2016145498A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032015A (en) * 2019-12-24 2021-06-25 中国科学院沈阳自动化研究所 Communication method for precision motion control

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020188826A1 (en) * 2001-05-31 2002-12-12 Rose Andrew Christopher Unhandled operation handling in multiple instruction set systems
US20100257338A1 (en) * 2009-04-07 2010-10-07 Spracklen Lawrence A Methods and mechanisms to support multiple features for a number of opcodes
US20130198458A1 (en) * 2009-12-23 2013-08-01 Sebastian Winkel Transitioning from source instruction set architecture (isa) code to translated code in a partial emulation environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020188826A1 (en) * 2001-05-31 2002-12-12 Rose Andrew Christopher Unhandled operation handling in multiple instruction set systems
US20100257338A1 (en) * 2009-04-07 2010-10-07 Spracklen Lawrence A Methods and mechanisms to support multiple features for a number of opcodes
US20130198458A1 (en) * 2009-12-23 2013-08-01 Sebastian Winkel Transitioning from source instruction set architecture (isa) code to translated code in a partial emulation environment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032015A (en) * 2019-12-24 2021-06-25 中国科学院沈阳自动化研究所 Communication method for precision motion control
CN113032015B (en) * 2019-12-24 2022-02-18 中国科学院沈阳自动化研究所 Communication method for precision motion control

Also Published As

Publication number Publication date
BR102015005838A2 (en) 2016-09-13

Similar Documents

Publication Publication Date Title
Matz et al. System v application binary interface
US8428930B2 (en) Page mapped spatially aware emulation of a computer instruction set
KR101464808B1 (en) High-word facility for extending the number of general purpose registers available to instructions
US9158566B2 (en) Page mapped spatially aware emulation of computer instruction set
US8447583B2 (en) Self initialized host cell spatially aware emulation of a computer instruction set
US8954711B2 (en) Address generation in a data processing apparatus
US8301434B2 (en) Host cell spatially aware emulation of a guest wild branch
EP2430532B1 (en) Function virtualization facility for blocking instruction function of a multi-function instruction of a virtual processor
JP2008536240A (en) Microprocessor access using native instructions to the operand stack as a register file
BR102014005800A2 (en) Fuse and logic instructions for providing test-or and / or functionality test-and using various test sources
Paul et al. Completing the automated verification of a small hypervisor–assembler code verification
US20180364991A1 (en) Method and system for preparing code to be executed by programmable control devices
WO2016145498A1 (en) Method and system for instruction emulation and legacy code execution
US8438549B1 (en) Data processing with microcode designed with source coding
CN114116003A (en) Program operation method, computer equipment and system supporting multi-instruction-set architecture
US10175966B2 (en) Linker rewriting to eliminate TOC pointer references
Mortimer Removing ROP gadgets from OpenBSD
BR102015005838B1 (en) METHOD AND SYSTEM FOR INSTRUCTION EMULATION AND LEGACY CODE EXECUTION
US9208112B1 (en) Permanent allocation of a large host memory
Markstedter Blue Fox: Arm Assembly Internals and Reverse Engineering
Bamsch et al. Porting OpenBSD to RISC-V ISA
Sombert Development of a Multiboot-compatible bootloader for EFI-based x86 systems
CN116257173A (en) Data processing method, device, system, computing equipment and storage medium
Kaufmann Automated Verification of RISC-V Kernel Code
Saiu GNU Jitter

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: 15884924

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15884924

Country of ref document: EP

Kind code of ref document: A1