[PATCH] D97268: [X86] Use correct padding when in 16-bit mode

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 18:18:05 PST 2021


MaskRay added a comment.

In D97268#2583455 <https://reviews.llvm.org/D97268#2583455>, @nickdesaulniers wrote:

> FWIW: I recall there being a header in the Linux kernel for various nop sleds: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/nops.h.  I don't recall the context for why these different sequences exist.  There seems to be commit messages about whether certain sequences are atomic or not. (Perhaps longer sequences are not interruptable by faults, for instance).

The kernel uses at least 5-byte nop and 3-byte nop for code patching. Using long nops is just for performance reasons (better for the decoder). Using 1-byte nops is no worse than using long nops if performance is not a concern, as here we do for the 16-bit code.
(For code patching, atomics matter for the leading jmp/call instruction.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97268/new/

https://reviews.llvm.org/D97268



More information about the llvm-commits mailing list