Runtime Call Instruction Reduces Code Bloat and Performance Overheads
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing software instrumentation methods for memory safety enforcement and control flow integrity checking lead to substantial code bloat and performance overheads due to the use of CALL instructions with relative offsets, which are limited in encoding distance and cannot be efficiently disabled, preventing statistical sampling and increasing memory access overheads.
Innovation Solution
The introduction of a Runtime Call (RTCALL) operation that unconditionally calls an instrumentation handler at a predefined address, saving the subsequent instruction address in a register instead of the stack, and allows for rapid enabling or disabling via a user mode model-specific register, enabling statistical checks and reducing memory access performance overheads.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If CALL instructions with relative offsets are used for instrumentation, then memory safety enforcement and control flow integrity checking can be implemented, but code bloat and performance overheads occur
Solution Approach 1:
The patent segments the instrumentation system into two parts: (1) compact CALL instructions with embedded handler identifiers in the code stream, and (2) a runtime resolution mechanism that maps identifiers to actual handler addresses. This segmentation eliminates the need for large relative offsets in the CALL instructions themselves, reducing code bloat while maintaining the ability to call distant handlers.
Solution Approach 2:
The patent introduces an intermediary runtime resolution mechanism that acts as a mediator between the compact CALL instructions and the actual instrumentation handlers. The handler identifier in the CALL instruction serves as an intermediary key that the runtime system uses to look up the corresponding handler address, enabling indirect calling without requiring large immediate offsets.
2Reliability
If CALL instructions with relative offsets are used for instrumentation, then instrumentation can be implemented, but performance overheads increase due to distant calls using four-byte offsets
Solution Approach 1:
The patent segments the call instruction into a compact form with a small identifier field and a separate runtime resolution phase. This allows the instruction encoding to remain small (avoiding four-byte offsets) while still enabling calls to distant handlers through the runtime identifier-to-address mapping mechanism.
Solution Approach 2:
The patent performs preliminary setup by establishing the runtime resolution mechanism before instrumentation calls are executed. The system pre-configures the mapping between handler identifiers and handler addresses, allowing subsequent CALL instructions to use compact encodings without incurring the overhead of large immediate offsets or complex address calculation at call sites.
3Reliability
If CALL instructions are used for instrumentation, then instrumentation handler functions can be invoked, but the instructions cannot be disabled which prevents statistical sampling
Solution Approach 1:
The patent makes the instrumentation system dynamic by introducing a runtime control mechanism that can enable or disable instrumentation handlers based on the handler identifier. The system can dynamically adjust which handlers are active and respond to CALL instructions, allowing statistical sampling and selective instrumentation without modifying the CALL instruction stream itself.
4Ease of operation
If relative code offsets are used in CALL instructions, then the instruction encoding is limited to 2 gigabytes distance, but this restriction prevents calling distant instrumentation handlers
Solution Approach 1:
The patent segments the addressing mechanism into (1) a compact identifier field in the CALL instruction that maintains encoding simplicity, and (2) a runtime address resolution component that translates the identifier to the actual handler address. This segmentation removes the 2GB distance limitation while keeping the instruction encoding simple.
Solution Approach 2:
The patent introduces an intermediary identifier-to-address mapping mechanism that mediates between the compact CALL instruction encoding and the actual handler address. This intermediary layer enables distant calls by resolving the compact identifier to a full address at runtime, removing the encoding distance restriction while maintaining instruction simplicity.
Data Source
AI summary
Techniques for an instruction for a Runtime Call operation are described. An example apparatus comprises decoder circuitry to decode a single instruction, the single instruction to include a field for an identifier of an opcode, the opcode to indicate execution circuitry is to execute a no operation when a runtime call destination equals a predetermined value; and execute an indirect call with the runtime call destination as a destination address when the runtime call destination does not equal the predetermined value. Other examples are described and claimed.


