x86/lib/clear_page_64.S: Convert to ALTERNATIVE_2 macro
authorBorislav Petkov <bp@suse.de>
Sun, 18 Jan 2015 11:57:41 +0000 (12:57 +0100)
committerBorislav Petkov <bp@suse.de>
Mon, 23 Feb 2015 12:44:16 +0000 (13:44 +0100)
commit6620ef28c812b4782b10adb676580c2847d2bec8
treea3244d1713210f4ad45eb90825ae89d7a8dd62d4
parent8e65f6e03a90927b8de16c15da976baa6c3fff69
x86/lib/clear_page_64.S: Convert to ALTERNATIVE_2 macro

Move clear_page() up so that we can get 2-byte forward JMPs when
patching:

  apply_alternatives: feat: 3*32+16, old: (ffffffff8130adb0, len: 5), repl: (ffffffff81d0b859, len: 5)
  ffffffff8130adb0: alt_insn: 90 90 90 90 90
  recompute_jump: new_displ: 0x0000003e
  ffffffff81d0b859: rpl_insn: eb 3e 66 66 90

even though the compiler generated 5-byte JMPs which we padded with 5
NOPs.

Also, make the REP_GOOD version be the default as the majority of
machines set REP_GOOD. This way we get to save ourselves the JMP:

  old insn VA: 0xffffffff813038b0, CPU feat: X86_FEATURE_REP_GOOD, size: 5, padlen: 0
  clear_page:

  ffffffff813038b0 <clear_page>:
  ffffffff813038b0:       e9 0b 00 00 00          jmpq ffffffff813038c0
  repl insn: 0xffffffff81cf0e92, size: 0

  old insn VA: 0xffffffff813038b0, CPU feat: X86_FEATURE_ERMS, size: 5, padlen: 0
  clear_page:

  ffffffff813038b0 <clear_page>:
  ffffffff813038b0:       e9 0b 00 00 00          jmpq ffffffff813038c0
  repl insn: 0xffffffff81cf0e92, size: 5
   ffffffff81cf0e92:      e9 69 2a 61 ff          jmpq ffffffff81303900

  ffffffff813038b0 <clear_page>:
  ffffffff813038b0:       e9 69 2a 61 ff          jmpq ffffffff8091631e

Signed-off-by: Borislav Petkov <bp@suse.de>
arch/x86/lib/clear_page_64.S
This page took 0.029491 seconds and 5 git commands to generate.