signal.c (e77bc7dc9af0ec53996367b2053dfafee83b7edb) signal.c (66fc6a6254c7a138aef7806bd933c218e1aefcfc)
1/*
2 * Signal handling
3 *
4 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2008-2009 PetaLogix
6 * Copyright (C) 2003,2004 John Williams <jwilliams@itee.uq.edu.au>
7 * Copyright (C) 2001 NEC Corporation
8 * Copyright (C) 2001 Miles Bader <miles@gnu.org>

--- 143 unchanged lines hidden (view full) ---

152}
153
154static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
155 struct pt_regs *regs)
156{
157 struct rt_sigframe __user *frame;
158 int err = 0, sig = ksig->sig;
159 unsigned long address = 0;
1/*
2 * Signal handling
3 *
4 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2008-2009 PetaLogix
6 * Copyright (C) 2003,2004 John Williams <jwilliams@itee.uq.edu.au>
7 * Copyright (C) 2001 NEC Corporation
8 * Copyright (C) 2001 Miles Bader <miles@gnu.org>

--- 143 unchanged lines hidden (view full) ---

152}
153
154static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
155 struct pt_regs *regs)
156{
157 struct rt_sigframe __user *frame;
158 int err = 0, sig = ksig->sig;
159 unsigned long address = 0;
160#ifdef CONFIG_MMU
161 pmd_t *pmdp;
162 pte_t *ptep;
160 pmd_t *pmdp;
161 pte_t *ptep;
163#endif
164
165 frame = get_sigframe(ksig, regs, sizeof(*frame));
166
167 if (!access_ok(frame, sizeof(*frame)))
168 return -EFAULT;
169
170 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
171 err |= copy_siginfo_to_user(&frame->info, &ksig->info);

--- 15 unchanged lines hidden (view full) ---

187 /* brki r14, 0x8 */
188 err |= __put_user(0xb9cc0008, frame->tramp + 1);
189
190 /* Return from sighandler will jump to the tramp.
191 Negative 8 offset because return is rtsd r15, 8 */
192 regs->r15 = ((unsigned long)frame->tramp)-8;
193
194 address = ((unsigned long)frame->tramp);
162
163 frame = get_sigframe(ksig, regs, sizeof(*frame));
164
165 if (!access_ok(frame, sizeof(*frame)))
166 return -EFAULT;
167
168 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
169 err |= copy_siginfo_to_user(&frame->info, &ksig->info);

--- 15 unchanged lines hidden (view full) ---

185 /* brki r14, 0x8 */
186 err |= __put_user(0xb9cc0008, frame->tramp + 1);
187
188 /* Return from sighandler will jump to the tramp.
189 Negative 8 offset because return is rtsd r15, 8 */
190 regs->r15 = ((unsigned long)frame->tramp)-8;
191
192 address = ((unsigned long)frame->tramp);
195#ifdef CONFIG_MMU
196 pmdp = pmd_off(current->mm, address);
197
198 preempt_disable();
199 ptep = pte_offset_map(pmdp, address);
200 if (pte_present(*ptep)) {
201 address = (unsigned long) page_address(pte_page(*ptep));
202 /* MS: I need add offset in page */
203 address += ((unsigned long)frame->tramp) & ~PAGE_MASK;
204 /* MS address is virtual */
205 address = __virt_to_phys(address);
206 invalidate_icache_range(address, address + 8);
207 flush_dcache_range(address, address + 8);
208 }
209 pte_unmap(ptep);
210 preempt_enable();
193 pmdp = pmd_off(current->mm, address);
194
195 preempt_disable();
196 ptep = pte_offset_map(pmdp, address);
197 if (pte_present(*ptep)) {
198 address = (unsigned long) page_address(pte_page(*ptep));
199 /* MS: I need add offset in page */
200 address += ((unsigned long)frame->tramp) & ~PAGE_MASK;
201 /* MS address is virtual */
202 address = __virt_to_phys(address);
203 invalidate_icache_range(address, address + 8);
204 flush_dcache_range(address, address + 8);
205 }
206 pte_unmap(ptep);
207 preempt_enable();
211#else
212 flush_icache_range(address, address + 8);
213 flush_dcache_range(address, address + 8);
214#endif
215 if (err)
216 return -EFAULT;
217
218 /* Set up registers for signal handler */
219 regs->r1 = (unsigned long) frame;
220
221 /* Signal handler args: */
222 regs->r5 = sig; /* arg 0: signum */

--- 85 unchanged lines hidden (view full) ---

308 * If there's no signal to deliver, we just put the saved sigmask
309 * back.
310 */
311 restore_saved_sigmask();
312}
313
314asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall)
315{
208 if (err)
209 return -EFAULT;
210
211 /* Set up registers for signal handler */
212 regs->r1 = (unsigned long) frame;
213
214 /* Signal handler args: */
215 regs->r5 = sig; /* arg 0: signum */

--- 85 unchanged lines hidden (view full) ---

301 * If there's no signal to deliver, we just put the saved sigmask
302 * back.
303 */
304 restore_saved_sigmask();
305}
306
307asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall)
308{
316 if (test_thread_flag(TIF_SIGPENDING))
309 if (test_thread_flag(TIF_SIGPENDING) ||
310 test_thread_flag(TIF_NOTIFY_SIGNAL))
317 do_signal(regs, in_syscall);
318
319 if (test_thread_flag(TIF_NOTIFY_RESUME))
320 tracehook_notify_resume(regs);
321}
311 do_signal(regs, in_syscall);
312
313 if (test_thread_flag(TIF_NOTIFY_RESUME))
314 tracehook_notify_resume(regs);
315}