Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 1 | /* |
Jeff Dike | ee3d9bd | 2008-02-04 22:30:56 -0800 | [diff] [blame] | 2 | * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
Jeff Dike | 17d4697 | 2005-11-21 21:32:09 -0800 | [diff] [blame] | 6 | #include <signal.h> |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 7 | #include "as-layout.h" |
Jeff Dike | 17d4697 | 2005-11-21 21:32:09 -0800 | [diff] [blame] | 8 | #include "sysdep/stub.h" |
Jeff Dike | ee3d9bd | 2008-02-04 22:30:56 -0800 | [diff] [blame] | 9 | #include "sysdep/faultinfo.h" |
| 10 | #include "sysdep/sigcontext.h" |
Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 11 | |
| 12 | void __attribute__ ((__section__ (".__syscall_stub"))) |
| 13 | stub_segv_handler(int sig) |
| 14 | { |
| 15 | struct ucontext *uc; |
| 16 | |
Jeff Dike | fb30d64 | 2006-04-18 22:21:44 -0700 | [diff] [blame] | 17 | __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); |
Jeff Dike | 54ae36f | 2007-10-16 01:27:33 -0700 | [diff] [blame] | 18 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA), |
Jeff Dike | 50f72b5 | 2005-10-09 16:11:44 -0400 | [diff] [blame] | 19 | &uc->uc_mcontext); |
Jeff Dike | ee3d9bd | 2008-02-04 22:30:56 -0800 | [diff] [blame] | 20 | trap_myself(); |
Jeff Dike | d67b569 | 2005-07-07 17:56:49 -0700 | [diff] [blame] | 21 | } |
Jeff Dike | ee3d9bd | 2008-02-04 22:30:56 -0800 | [diff] [blame] | 22 | |