Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp)

From: Linus Torvalds
Date: Mon Mar 09 2015 - 12:08:19 EST

On Mon, Mar 9, 2015 at 7:05 AM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
> New:
> 1e6: 0f ba 64 24 38 11 btl $0x11,0x38(%esp)

btl? Really?

Why isn't that just

testb $2,0x3a(%esp)

which is both smaller and quite a bit faster on older machines.

Sure, the btl is easier to explain in the source code, but instead of this:

> + btl $X86_EFLAGS_VM_BIT,PT_EFLAGS(%esp)

you'd have to add a comment, like

testb $2, PT_EFLAGS+2(%esp) # X86_EFLAGS_VM_BIT

or something.

Or just at least *partially* do what we used to do, and make it all be

movb PT_EFLAGS+2(%esp),%al
andb $2,%al
orb PT_CS(%esp),%al
testb $3,%al
je restore_nocheck
jne ldt_ss

which still avoids looking at SS unless needed, and is smaller and
faster than the btl, afaik.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at