Lightweight Userspace Instruction Trapping and Emulation Engine for Missing Instruction Set Extensions (MOVBE, AES-NI, ADX, and BMI2) on Legacy x86 Microprocessors
Modern software compilers (such as GCC and LLVM) increasingly default to baseline architectures like x86-64-v2 that mandate hardware extensions, including Move Data After Swapping Bytes (MOVBE) and Advanced Encryption Standard New Instructions (AES-NI). On legacy processors, such as the 3rd Generation Intel Core architecture (Ivy Bridge 22nm), the physical omission of these instructions causes an Undefined Opcode (#UD) hardware exception. The Linux kernel delivers this exception as an Illegal Instruction signal (SIGILL, Signal 4), causing critical system binaries, such as the ChromeOS terminal (crosh) compiled in Rust, to terminate immediately. Conventional Dynamic Binary Translation (DBT) frameworks that rely on Just-In-Time (JIT) compilation (e.g., QEMU and Box64) incur substantial memory overhead (32 MB to 128 MB per process), making them impractical for resource-constrained systems. This paper presents a lightweight userspace instruction trapping and emulation engine implemented as a dynamic shared library (libaes_trap). By utilizing POSIX sigaction handlers with SA_SIGINFO flags and an alternate signal stack (sigaltstack), the engine intercepts SIGILL, decodes x86_64 machine code directly in user memory (including Operand-Size Prefixes, REX Prefixes, ModR/M Bytes, SIB Bytes, and displacement offsets), executes the intended semantics in software, and resumes execution seamlessly. Tested on an Intel Core i3 3110M processor (2.40 GHz) running ChromeOS M126 with Linux Kernel 6.6 LTS, the engine achieves 100% bitwise accuracy across 16-bit, 32-bit, and 64-bit operations, completely prevents SIGILL termination in crosh and Chromium WebApp renderers (YouTube, Gmail, Drive), requires approximately 1,800 CPU clock cycles (~0.75 microseconds) per trapped instruction, and consumes less than 64 KB of RAM per process without requiring application source code changes.
Authors
- Mochamad Syaiful Anwar (ORCID: https://orcid.org/0009-0000-1621-5418)
Institutions
- Universitas Siber Asia (ID)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-30
- DOI
- https://doi.org/10.5281/zenodo.24688427
- Primary Topic
- Security and Verification in Computing
- Type
- preprint