lkml.org 
[lkml]   [2018]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 7/7] x86/speculation: Add basic IBPB (Indirect Branch Prediction Barrier) support
From
Date
On Thu, 2018-01-25 at 12:50 +0100, Borislav Petkov wrote:
> On Thu, Jan 25, 2018 at 11:47:35AM +0000, David Woodhouse wrote:
> > I did already do the explicit clobbers now you reminded me how to do
> > them, but I elected not to use ASM_NO_INPUT_CLOBBER() because on
> > balance, losing the MSR_IA32_PRED_CMD / PRED_CMD_IBPB definitions and
> > having to hard-code the numbers was not so much of a win.
>
> and I'm thinking exactly the opposite: if an alternative can lose a
> bunch of inputs which don't change, then that's a good thing.

They're immediates, not registers. So it's like the first example in...

void foo(void)
{
asm volatile ("alternative me away; my numbers are %0 and %1\n"
      :: "i" (3456), "i" (1234));

asm volatile ("alternative me away; GCC already loaded regs %0 and %1\n"
      :: "c" (3456), "a" (1234));
}

... which gives you...

foo:
.LFB0:
.cfi_startproc
#APP
# 4 "foo.c" 1
alternative me away; my numbers are $3456 and $1234

# 0 "" 2
#NO_APP
movl $1234, %eax
movl $3456, %ecx
#APP
# 7 "foo.c" 1
alternative me away; GCC already loaded regs %ecx and %eax

# 0 "" 2
#NO_APP
ret
.cfi_endproc
[unhandled content-type:application/x-pkcs7-signature]
\
 
 \ /
  Last update: 2018-01-25 12:58    [W:0.072 / U:2.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site