• Borislav Petkov's avatar
    x86/asm: Cleanup prefetch primitives · a930dc45
    Borislav Petkov authored
    This is based on a patch originally by hpa.
    
    With the current improvements to the alternatives, we can simply use %P1
    as a mem8 operand constraint and rely on the toolchain to generate the
    proper instruction sizes. For example, on 32-bit, where we use an empty
    old instruction we get:
    
      apply_alternatives: feat: 6*32+8, old: (c104648b, len: 4), repl: (c195566c, len: 4)
      c104648b: alt_insn: 90 90 90 90
      c195566c: rpl_insn: 0f 0d 4b 5c
    
      ...
    
      apply_alternatives: feat: 6*32+8, old: (c18e09b4, len: 3), repl: (c1955948, len: 3)
      c18e09b4: alt_insn: 90 90 90
      c1955948: rpl_insn: 0f 0d 08
    
      ...
    
      apply_alternatives: feat: 6*32+8, old: (c1190cf9, len: 7), repl: (c1955a79, len: 7)
      c1190cf9: alt_insn: 90 90 90 90 90 90 90
      c1955a79: rpl_insn: 0f 0d 0d a0 d4 85 c1
    
    all with the proper padding done depending on the size of the
    replacement instruction the compiler generates.
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: H. Peter Anvin <hpa@linux.intel.com>
    a930dc45
apic.h 15.6 KB