aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/signal.c
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2011-08-18 15:05:09 -0400
committerRichard Weinberger <richard@nod.at>2011-11-02 09:14:59 -0400
commit248b74c79ebb9fb55e146797a808836d90418c4b (patch)
tree2d043bee58d2d8995ca4ccedf9d00513a13297cb /arch/um/os-Linux/signal.c
parent05c46db4d7d51af969e09f9f1adbff66ee2e84b4 (diff)
um: start switching the references to host mcontext_t to its userland type
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/os-Linux/signal.c')
-rw-r--r--arch/um/os-Linux/signal.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 08d306176995..07d9905e44ef 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -26,7 +26,7 @@ void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
26 [SIGIO] = sigio_handler, 26 [SIGIO] = sigio_handler,
27 [SIGVTALRM] = timer_handler }; 27 [SIGVTALRM] = timer_handler };
28 28
29static void sig_handler_common(int sig, struct sigcontext *sc) 29static void sig_handler_common(int sig, mcontext_t *mc)
30{ 30{
31 struct uml_pt_regs r; 31 struct uml_pt_regs r;
32 int save_errno = errno; 32 int save_errno = errno;
@@ -34,8 +34,8 @@ static void sig_handler_common(int sig, struct sigcontext *sc)
34 r.is_user = 0; 34 r.is_user = 0;
35 if (sig == SIGSEGV) { 35 if (sig == SIGSEGV) {
36 /* For segfaults, we want the data from the sigcontext. */ 36 /* For segfaults, we want the data from the sigcontext. */
37 copy_sc(&r, sc); 37 copy_sc(&r, (struct sigcontext *)mc);
38 GET_FAULTINFO_FROM_SC(r.faultinfo, sc); 38 GET_FAULTINFO_FROM_MC(r.faultinfo, mc);
39 } 39 }
40 40
41 /* enable signals if sig isn't IRQ signal */ 41 /* enable signals if sig isn't IRQ signal */
@@ -62,7 +62,7 @@ static void sig_handler_common(int sig, struct sigcontext *sc)
62static int signals_enabled; 62static int signals_enabled;
63static unsigned int signals_pending; 63static unsigned int signals_pending;
64 64
65void sig_handler(int sig, struct sigcontext *sc) 65void sig_handler(int sig, mcontext_t *mc)
66{ 66{
67 int enabled; 67 int enabled;
68 68
@@ -74,23 +74,23 @@ void sig_handler(int sig, struct sigcontext *sc)
74 74
75 block_signals(); 75 block_signals();
76 76
77 sig_handler_common(sig, sc); 77 sig_handler_common(sig, mc);
78 78
79 set_signals(enabled); 79 set_signals(enabled);
80} 80}
81 81
82static void real_alarm_handler(struct sigcontext *sc) 82static void real_alarm_handler(mcontext_t *mc)
83{ 83{
84 struct uml_pt_regs regs; 84 struct uml_pt_regs regs;
85 85
86 if (sc != NULL) 86 if (mc != NULL)
87 copy_sc(&regs, sc); 87 copy_sc(&regs, (struct sigcontext *)mc);
88 regs.is_user = 0; 88 regs.is_user = 0;
89 unblock_signals(); 89 unblock_signals();
90 timer_handler(SIGVTALRM, &regs); 90 timer_handler(SIGVTALRM, &regs);
91} 91}
92 92
93void alarm_handler(int sig, struct sigcontext *sc) 93void alarm_handler(int sig, mcontext_t *mc)
94{ 94{
95 int enabled; 95 int enabled;
96 96
@@ -102,7 +102,7 @@ void alarm_handler(int sig, struct sigcontext *sc)
102 102
103 block_signals(); 103 block_signals();
104 104
105 real_alarm_handler(sc); 105 real_alarm_handler(mc);
106 set_signals(enabled); 106 set_signals(enabled);
107} 107}
108 108
@@ -121,7 +121,7 @@ void set_sigstack(void *sig_stack, int size)
121 panic("enabling signal stack failed, errno = %d\n", errno); 121 panic("enabling signal stack failed, errno = %d\n", errno);
122} 122}
123 123
124static void (*handlers[_NSIG])(int sig, struct sigcontext *sc) = { 124static void (*handlers[_NSIG])(int sig, mcontext_t *mc) = {
125 [SIGSEGV] = sig_handler, 125 [SIGSEGV] = sig_handler,
126 [SIGBUS] = sig_handler, 126 [SIGBUS] = sig_handler,
127 [SIGILL] = sig_handler, 127 [SIGILL] = sig_handler,
@@ -133,8 +133,11 @@ static void (*handlers[_NSIG])(int sig, struct sigcontext *sc) = {
133 [SIGVTALRM] = alarm_handler 133 [SIGVTALRM] = alarm_handler
134}; 134};
135 135
136static void handle_signal(int sig, struct sigcontext *sc) 136
137static void hard_handler(int sig, siginfo_t *info, void *p)
137{ 138{
139 struct ucontext *uc = p;
140 mcontext_t *mc = &uc->uc_mcontext;
138 unsigned long pending = 1UL << sig; 141 unsigned long pending = 1UL << sig;
139 142
140 do { 143 do {
@@ -160,7 +163,7 @@ static void handle_signal(int sig, struct sigcontext *sc)
160 while ((sig = ffs(pending)) != 0){ 163 while ((sig = ffs(pending)) != 0){
161 sig--; 164 sig--;
162 pending &= ~(1 << sig); 165 pending &= ~(1 << sig);
163 (*handlers[sig])(sig, sc); 166 (*handlers[sig])(sig, mc);
164 } 167 }
165 168
166 /* 169 /*
@@ -174,12 +177,6 @@ static void handle_signal(int sig, struct sigcontext *sc)
174 } while (pending); 177 } while (pending);
175} 178}
176 179
177static void hard_handler(int sig, siginfo_t *info, void *p)
178{
179 struct ucontext *uc = p;
180 handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
181}
182
183void set_handler(int sig) 180void set_handler(int sig)
184{ 181{
185 struct sigaction action; 182 struct sigaction action;