提交 1f6ef234 编写于 作者: L Linus Torvalds

[watchdog] hpwdt: fix use of inline assembly

The inline assembly in drivers/watchdog/hpwdt.c was incredibly broken,
and included all the function prologue and epilogue stuff, even though
it was itself then inside a C function where the compiler would add its
own prologue and epilogue on top of it all.

This then just _happened_ to work if you had exactly the right compiler
version and exactly the right compiler flags, so that gcc just happened
to not create any prologue at all (the gcc-generated epilogue wouldn't
matter, since it would never be reached).

But the more proper way to fix it is to simply not do this.  Move the
inline asm to the top level, with no surrounding function at all (the
better alternative would be to remove the prologue and make it actually
use proper description of the arguments to the inline asm, but that's a
bigger change than the one I'm willing to make right now).
Tested-by: NS.Çağlar Onur <caglar@pardus.org.tr>
Acked-by: NThomas Mingarelli <Thomas.Mingarelli@hp.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 89f5b7da
......@@ -140,15 +140,17 @@ static struct pci_device_id hpwdt_devices[] = {
};
MODULE_DEVICE_TABLE(pci, hpwdt_devices);
extern asmlinkage void asminline_call(struct cmn_registers *pi86Regs, unsigned long *pRomEntry);
#ifndef CONFIG_X86_64
/* --32 Bit Bios------------------------------------------------------------ */
#define HPWDT_ARCH 32
asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
unsigned long *pRomEntry)
{
asm("pushl %ebp \n\t"
asm(".text \n\t"
".align 4 \n"
"asminline_call: \n\t"
"pushl %ebp \n\t"
"movl %esp, %ebp \n\t"
"pusha \n\t"
"pushf \n\t"
......@@ -181,8 +183,10 @@ asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
"pop %es \n\t"
"popf \n\t"
"popa \n\t"
"leave \n\t" "ret");
}
"leave \n\t"
"ret \n\t"
".previous");
/*
* cru_detect
......@@ -333,10 +337,10 @@ static int __devinit detect_cru_service(void)
#define HPWDT_ARCH 64
asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
unsigned long *pRomEntry)
{
asm("pushq %rbp \n\t"
asm(".text \n\t"
".align 4 \n"
"asminline_call: \n\t"
"pushq %rbp \n\t"
"movq %rsp, %rbp \n\t"
"pushq %rax \n\t"
"pushq %rbx \n\t"
......@@ -368,8 +372,9 @@ asmlinkage void asminline_call(struct cmn_registers *pi86Regs,
"popq %rdx \n\t"
"popq %rbx \n\t"
"popq %rax \n\t"
"leave \n\t" "ret");
}
"leave \n\t"
"ret \n\t"
".previous");
/*
* dmi_find_cru
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册