On-demand emulation via user-level exception handling
AssigneeIntel Corporation
InventorsHo-Seop Kim, Mauricio Breternitz, Jr., Youfeng Wu
Life of this patent
Estimating the term…
Abstract
Methods and apparatuses enable on-demand instruction emulation via user-level exception handling. A non-supported instruction triggers an exception during runtime of a program. In response to the exception, a user-level or application-level exception handler is launched, instead of a kernel-level handler. Then the exception handler can execute at the application layer instead of the kernel level. The handler identifies the instruction and emulates the instruction, where emulation of the instruction is supported by the handler. Emulating the instructions enables the program to continue execution. Repeated instruction emulation is amortized via dynamic binary translation of hot code.
Claims15
A method comprising:
- detecting an exception during runtime of execution of a program, the exception triggered by an instruction not supported by a hardware platform of a computing system on which the program is executing, the instruction not having correct semantics to be executed by the hardware platform;
- executing a user-level exception handler instead of a kernel-level exception handler in response to detecting the exception including accessing an emulator as a subroutine of the user-level exception handler, wherein the user-level exception handler is implemented at an application layer, rather than within an operating system kernel;
- determining that the exception is supported by the emulator that is part of the user-level handler;
- identifying the instruction that triggered the exception in response to determining the exception can be supported by the emulator, wherein identifying the instruction that triggered the exception includes incrementing an exception trigger count for the instruction indicating a number of times the instruction has triggered the exception;
- and
- if the exception trigger count reaches a threshold number,
- generating a dynamic binary translation;
- passing the dynamic binary translation to a runtime of the program to enable the program to execute the dynamic binary translation without executing the instruction emulator of the user-level exception handler;
- and
- transferring control from the dynamic binary translation to the program;
- otherwise, emulating the instruction that triggered the exception from the user-level exception handler with instructions supported by the hardware platform to enable continued execution of the program.
An article of manufacture comprising a non-transitory machine readable storage medium having content stored thereon to provide instructions to cause a machine to perform operation including:
- detecting an exception during runtime of execution of a program, the exception triggered by an instruction not supported by a hardware platform of a computing system on which the program is executing, the instruction not having correct semantics to be executed by the hardware platform;
- executing a user-level exception handler instead of a kernel-level exception handler in response to detecting the exception including accessing an emulator as a subroutine of the user-level exception handler, wherein the user-level exception handler is implemented at an application layer, rather than within an operating system kernel;
- determining that the exception is supported by the emulator that is part of the user-level handler;
- identifying the instruction that triggered the exception in response to determining the exception can be supported by the emulator, wherein identifying the instruction that triggered the exception includes incrementing an exception trigger count for the instruction indicating a number of times the instruction has triggered the exception;
- and
- if the exception trigger count reaches a threshold number,
- generating a dynamic binary translation;
- passing the dynamic binary translation to a runtime of the program to enable the program to execute the dynamic binary translation without executing the instruction emulator of the user-level exception handler;
- and
- transferring control from the dynamic binary translation to the program;
- otherwise, emulating the instruction that triggered the exception from the user-level exception handler with instructions supported by the hardware platform to enable continued execution of the program.
A system comprising:
- a processor having an instruction set architecture (ISA) of supported instructions;
- a memory having an instruction not supported by the ISA, the instruction not supported by the ISA triggering an exception during runtime of execution of a program, the instruction not having correct semantics to be executed by the hardware platform;
- and
- a user-level exception handler to detect the exception and execute at an application layer of the system, rather than an operating system kernel layer, the user-level exception handler including an instruction emulator as a subroutine of the user-level exception handler having a mapper to emulate the instruction not supported by the ISA with instructions supported by the ISA the user-level exception handler to:
- determine that the exception is supported by the emulator that is part of the user-level handler;
- identify the instruction that triggered the exception, including incrementing an exception trigger count for the instruction indicating a number of times the instruction has triggered the exception:
- and
- if the exception trigger count reaches a threshold number, the user-level exception handler to:
- generate a dynamic binary translation;
- pass the dynamic binary translation to a runtime of the program to enable the program to execute the dynamic binary translation without executing the instruction emulator of the user-level exception handler;
- and
- transfer control from the dynamic binary translation to the program:
- otherwise, emulate the instruction that triggered the exception from the user-level exception handler with instructions supported by the hardware platform to enable continued execution of the program.
Dependencies are inferred from the claim text.