* [GIT PULL] x86/asm changes for v2.6.37
@ 2010-10-21 13:21 Ingo Molnar
2010-10-21 20:16 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2010-10-21 13:21 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, H. Peter Anvin, Thomas Gleixner, Andrew Morton
Linus,
Please pull the latest x86-asm-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-asm-for-linus
Thanks,
Ingo
------------------>
H. Peter Anvin (1):
x86-64, asm: If the assembler supports fxsave64, use it
Jan Beulich (1):
i386: Make kernel_execve() suitable for stack unwinding
arch/x86/Makefile | 8 ++++++--
arch/x86/include/asm/i387.h | 2 +-
arch/x86/kernel/sys_i386_32.c | 4 ++--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 8aa1b59..40668a9 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -96,8 +96,12 @@ cfi := $(call as-instr,.cfi_startproc\n.cfi_rel_offset $(sp-y)$(comma)0\n.cfi_en
# is .cfi_signal_frame supported too?
cfi-sigframe := $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1)
cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTIONS=1)
-KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections)
-KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections)
+
+# does binutils support specific instructions?
+asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1)
+
+KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr)
+KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr)
LDFLAGS := -m elf_$(UTS_MACHINE)
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index a73a8d5..70f105b 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -175,7 +175,7 @@ static inline void fpu_fxsave(struct fpu *fpu)
uses any extended registers for addressing, a second REX prefix
will be generated (to the assembler, rex64 followed by semicolon
is a separate instruction), and hence the 64-bitness is lost. */
-#if 0
+#ifdef CONFIG_AS_FXSAVEQ
/* Using "fxsaveq %0" would be the ideal choice, but is only supported
starting with gas 2.16. */
__asm__ __volatile__("fxsaveq %0"
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index d5e0662..0b0cb5f 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -33,8 +33,8 @@ int kernel_execve(const char *filename,
const char *const envp[])
{
long __res;
- asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
+ asm volatile ("int $0x80"
: "=a" (__res)
- : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
+ : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
return __res;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [GIT PULL] x86/asm changes for v2.6.37
2010-10-21 13:21 [GIT PULL] x86/asm changes for v2.6.37 Ingo Molnar
@ 2010-10-21 20:16 ` Linus Torvalds
2010-10-21 20:22 ` H. Peter Anvin
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2010-10-21 20:16 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel, H. Peter Anvin, Thomas Gleixner, Andrew Morton
On Thu, Oct 21, 2010 at 6:21 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> Jan Beulich (1):
> i386: Make kernel_execve() suitable for stack unwinding
>
> long __res;
> - asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
> + asm volatile ("int $0x80"
> : "=a" (__res)
> - : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
> + : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
> return __res;
> }
I pulled this, but there's a reason we used to do it that way - gcc
has had bugs with inline asm changing %ebx due to some bad interaction
with using it as the GOT base register for position-independent code
or something.
So I hope those are all solved, and I guess we use -fPIC only for some
early boot code. But in case this is ever used in some environment
that is PIC (the vsyscall page?) we need to worry about gcc
interactions.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [GIT PULL] x86/asm changes for v2.6.37
2010-10-21 20:16 ` Linus Torvalds
@ 2010-10-21 20:22 ` H. Peter Anvin
0 siblings, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2010-10-21 20:22 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Ingo Molnar, linux-kernel, Thomas Gleixner, Andrew Morton
On 10/21/2010 01:16 PM, Linus Torvalds wrote:
> On Thu, Oct 21, 2010 at 6:21 AM, Ingo Molnar <mingo@elte.hu> wrote:
>>
>> Jan Beulich (1):
>> i386: Make kernel_execve() suitable for stack unwinding
>>
>> long __res;
>> - asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
>> + asm volatile ("int $0x80"
>> : "=a" (__res)
>> - : "0" (__NR_execve), "ri" (filename), "c" (argv), "d" (envp) : "memory");
>> + : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
>> return __res;
>> }
>
> I pulled this, but there's a reason we used to do it that way - gcc
> has had bugs with inline asm changing %ebx due to some bad interaction
> with using it as the GOT base register for position-independent code
> or something.
>
> So I hope those are all solved, and I guess we use -fPIC only for some
> early boot code. But in case this is ever used in some environment
> that is PIC (the vsyscall page?) we need to worry about gcc
> interactions.
>
We used to allow these macros to be used from user space; we don't
anymore. The vsyscall page is PIC, but we wouldn't be calling
kernel_execve() from there.
The good part is that gcc will fail to compile if we ever violate the
assumptions; we won't see quiet failures.
-hpa
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-21 20:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 13:21 [GIT PULL] x86/asm changes for v2.6.37 Ingo Molnar
2010-10-21 20:16 ` Linus Torvalds
2010-10-21 20:22 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox