Commit fb30d645 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: add missing __volatile__

We were missing __volatile__ on some bits of asm in the segfault handlers.
On x86_64, this was messing up the move from %rdx to uc because that was
moved to after the GET_FAULTINFO_FROM_SC, which changed %rdx.

Also changed the other bit of asm and the one in the i386 handler to
prevent any similar occurrences.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 966a082f
...@@ -27,6 +27,6 @@ stub_segv_handler(int sig) ...@@ -27,6 +27,6 @@ stub_segv_handler(int sig)
* the stack in its original form when we do the sigreturn here, by * the stack in its original form when we do the sigreturn here, by
* hand. * hand.
*/ */
__asm__("mov %0,%%esp ; movl %1, %%eax ; " __asm__ __volatile__("mov %0,%%esp ; movl %1, %%eax ; "
"int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); "int $0x80" : : "a" (sc), "g" (__NR_sigreturn));
} }
...@@ -33,7 +33,7 @@ stub_segv_handler(int sig) ...@@ -33,7 +33,7 @@ stub_segv_handler(int sig)
struct ucontext *uc; struct ucontext *uc;
int pid; int pid;
__asm__("movq %%rdx, %0" : "=g" (uc) :); __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :);
GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
&uc->uc_mcontext); &uc->uc_mcontext);
...@@ -44,8 +44,8 @@ stub_segv_handler(int sig) ...@@ -44,8 +44,8 @@ stub_segv_handler(int sig)
* the signal frame. So, we use the ucontext pointer, which we know * the signal frame. So, we use the ucontext pointer, which we know
* already, to get the signal frame pointer, and add 8 to that. * already, to get the signal frame pointer, and add 8 to that.
*/ */
__asm__("movq %0, %%rsp; movq %1, %%rax ; syscall": : __asm__ __volatile__("movq %0, %%rsp; movq %1, %%rax ; syscall": :
"g" ((unsigned long) container_of(uc, struct rt_sigframe, "g" ((unsigned long)
uc) + 8), container_of(uc, struct rt_sigframe, uc) + 8),
"g" (__NR_rt_sigreturn)); "g" (__NR_rt_sigreturn));
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment