From: Paolo 'Blaisorblade' Giarrusso <[email protected]>
Even here, we reuse values from one asm statement to the next without telling
this to GCC - so fix this.
While at it, a bit of improvements to the generated asm code, with better use of
constraints. Still TODO: convert all this to the syscall_stub macros we already
have.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[email protected]>
---
arch/um/sys-i386/stub_segv.c | 10 ++++++----
arch/um/sys-x86_64/stub_segv.c | 18 ++++++++++--------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
--- a/arch/um/sys-i386/stub_segv.c
+++ b/arch/um/sys-i386/stub_segv.c
@@ -13,17 +13,19 @@ void __attribute__ ((__section__ (".__sy
stub_segv_handler(int sig)
{
struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
+ long pid;
GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
sc);
- __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid));
- __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;"
- "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1));
+ __asm__("movl %1, %%eax ; int $0x80": "=&a" (pid): "i" (__NR_getpid));
+ __asm__("movl %0, %%eax ; movl %1, %%ecx ;"
+ "int $0x80": : "i" (__NR_kill), "i" (SIGUSR1), "b" (pid)
+ : "eax", "ecx");
/* Load pointer to sigcontext into esp, since we need to leave
* the stack in its original form when we do the sigreturn here, by
* hand.
*/
__asm__("mov %0,%%esp ; movl %1, %%eax ; "
- "int $0x80" : : "a" (sc), "g" (__NR_sigreturn));
+ "int $0x80" : : "r" (sc), "i" (__NR_sigreturn));
}
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
--- a/arch/um/sys-x86_64/stub_segv.c
+++ b/arch/um/sys-x86_64/stub_segv.c
@@ -31,21 +31,23 @@ void __attribute__ ((__section__ (".__sy
stub_segv_handler(int sig)
{
struct ucontext *uc;
+ long pid;
- __asm__("movq %%rdx, %0" : "=g" (uc) :);
+ __asm__("movq %%rdx, %0" : "=g" (uc) : );
GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
&uc->uc_mcontext);
- __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid));
- __asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;"
- "syscall": : "g" (__NR_kill), "g" (SIGUSR1) :
- "%rdi", "%rax", "%rsi");
+ __asm__("movq %0, %%rax ; syscall": "=&a" (pid) : "g" (__NR_getpid)
+ : "rax", __syscall_clobber);
+ __asm__("movq %0, %%rax ; movq %1, %%rsi ;"
+ "syscall": : "i" (__NR_kill), "i" (SIGUSR1), "D" (pid) :
+ "rdi", "rax", "rsi", __syscall_clobber);
/* sys_sigreturn expects that the stack pointer will be 8 bytes into
* the signal frame. So, we use the ucontext pointer, which we know
* already, to get the signal frame pointer, and add 8 to that.
*/
- __asm__("movq %0, %%rsp": :
- "g" ((unsigned long) container_of(uc, struct rt_sigframe,
+ __asm__("movq %0, %%rsp": :
+ "g" ((unsigned long) container_of(uc, struct rt_sigframe,
uc) + 8));
- __asm__("movq %0, %%rax ; syscall" : : "g" (__NR_rt_sigreturn));
+ __asm__("movq %0, %%rax ; syscall" : : "g" (__NR_rt_sigreturn) : "rax");
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]