signal.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /*
  2. * Copyright (C) 2003, Axis Communications AB.
  3. */
  4. #include <linux/sched.h>
  5. #include <linux/mm.h>
  6. #include <linux/kernel.h>
  7. #include <linux/signal.h>
  8. #include <linux/errno.h>
  9. #include <linux/wait.h>
  10. #include <linux/ptrace.h>
  11. #include <linux/unistd.h>
  12. #include <linux/stddef.h>
  13. #include <linux/syscalls.h>
  14. #include <linux/vmalloc.h>
  15. #include <asm/io.h>
  16. #include <asm/processor.h>
  17. #include <asm/ucontext.h>
  18. #include <asm/uaccess.h>
  19. #include <asm/arch/ptrace.h>
  20. #include <asm/arch/hwregs/cpu_vect.h>
  21. extern unsigned long cris_signal_return_page;
  22. /* Flag to check if a signal is blockable. */
  23. #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
  24. /*
  25. * A syscall in CRIS is really a "break 13" instruction, which is 2
  26. * bytes. The registers is manipulated so upon return the instruction
  27. * will be executed again.
  28. *
  29. * This relies on that PC points to the instruction after the break call.
  30. */
  31. #define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->erp -= 2;
  32. /* Signal frames. */
  33. struct signal_frame {
  34. struct sigcontext sc;
  35. unsigned long extramask[_NSIG_WORDS - 1];
  36. unsigned char retcode[8]; /* Trampoline code. */
  37. };
  38. struct rt_signal_frame {
  39. struct siginfo *pinfo;
  40. void *puc;
  41. struct siginfo info;
  42. struct ucontext uc;
  43. unsigned char retcode[8]; /* Trampoline code. */
  44. };
  45. void do_signal(int restart, struct pt_regs *regs);
  46. void keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
  47. struct pt_regs *regs);
  48. /*
  49. * Swap in the new signal mask, and wait for a signal. Define some
  50. * dummy arguments to be able to reach the regs argument.
  51. */
  52. int
  53. sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof,
  54. long srp, struct pt_regs *regs)
  55. {
  56. mask &= _BLOCKABLE;
  57. spin_lock_irq(&current->sighand->siglock);
  58. current->saved_sigmask = current->blocked;
  59. siginitset(&current->blocked, mask);
  60. recalc_sigpending();
  61. spin_unlock_irq(&current->sighand->siglock);
  62. current->state = TASK_INTERRUPTIBLE;
  63. schedule();
  64. set_thread_flag(TIF_RESTORE_SIGMASK);
  65. return -ERESTARTNOHAND;
  66. }
  67. int
  68. sys_sigaction(int signal, const struct old_sigaction *act,
  69. struct old_sigaction *oact)
  70. {
  71. int retval;
  72. struct k_sigaction newk;
  73. struct k_sigaction oldk;
  74. if (act) {
  75. old_sigset_t mask;
  76. if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
  77. __get_user(newk.sa.sa_handler, &act->sa_handler) ||
  78. __get_user(newk.sa.sa_restorer, &act->sa_restorer))
  79. return -EFAULT;
  80. __get_user(newk.sa.sa_flags, &act->sa_flags);
  81. __get_user(mask, &act->sa_mask);
  82. siginitset(&newk.sa.sa_mask, mask);
  83. }
  84. retval = do_sigaction(signal, act ? &newk : NULL, oact ? &oldk : NULL);
  85. if (!retval && oact) {
  86. if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
  87. __put_user(oldk.sa.sa_handler, &oact->sa_handler) ||
  88. __put_user(oldk.sa.sa_restorer, &oact->sa_restorer))
  89. return -EFAULT;
  90. __put_user(oldk.sa.sa_flags, &oact->sa_flags);
  91. __put_user(oldk.sa.sa_mask.sig[0], &oact->sa_mask);
  92. }
  93. return retval;
  94. }
  95. int
  96. sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
  97. {
  98. return do_sigaltstack(uss, uoss, rdusp());
  99. }
  100. static int
  101. restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
  102. {
  103. unsigned int err = 0;
  104. unsigned long old_usp;
  105. /* Always make any pending restarted system calls return -EINTR */
  106. current_thread_info()->restart_block.fn = do_no_restart_syscall;
  107. /*
  108. * Restore the registers from &sc->regs. sc is already checked
  109. * for VERIFY_READ since the signal_frame was previously
  110. * checked in sys_sigreturn().
  111. */
  112. if (__copy_from_user(regs, sc, sizeof(struct pt_regs)))
  113. goto badframe;
  114. /* Make that the user-mode flag is set. */
  115. regs->ccs |= (1 << (U_CCS_BITNR + CCS_SHIFT));
  116. /* Restore the old USP. */
  117. err |= __get_user(old_usp, &sc->usp);
  118. wrusp(old_usp);
  119. return err;
  120. badframe:
  121. return 1;
  122. }
  123. /* Define some dummy arguments to be able to reach the regs argument. */
  124. asmlinkage int
  125. sys_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
  126. struct pt_regs *regs)
  127. {
  128. sigset_t set;
  129. struct signal_frame __user *frame;
  130. unsigned long oldspc = regs->spc;
  131. unsigned long oldccs = regs->ccs;
  132. frame = (struct signal_frame *) rdusp();
  133. /*
  134. * Since the signal is stacked on a dword boundary, the frame
  135. * should be dword aligned here as well. It it's not, then the
  136. * user is trying some funny business.
  137. */
  138. if (((long)frame) & 3)
  139. goto badframe;
  140. if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
  141. goto badframe;
  142. if (__get_user(set.sig[0], &frame->sc.oldmask) ||
  143. (_NSIG_WORDS > 1 && __copy_from_user(&set.sig[1],
  144. frame->extramask,
  145. sizeof(frame->extramask))))
  146. goto badframe;
  147. sigdelsetmask(&set, ~_BLOCKABLE);
  148. spin_lock_irq(&current->sighand->siglock);
  149. current->blocked = set;
  150. recalc_sigpending();
  151. spin_unlock_irq(&current->sighand->siglock);
  152. if (restore_sigcontext(regs, &frame->sc))
  153. goto badframe;
  154. keep_debug_flags(oldccs, oldspc, regs);
  155. return regs->r10;
  156. badframe:
  157. force_sig(SIGSEGV, current);
  158. return 0;
  159. }
  160. /* Define some dummy variables to be able to reach the regs argument. */
  161. asmlinkage int
  162. sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
  163. struct pt_regs *regs)
  164. {
  165. sigset_t set;
  166. struct rt_signal_frame __user *frame;
  167. unsigned long oldspc = regs->spc;
  168. unsigned long oldccs = regs->ccs;
  169. frame = (struct rt_signal_frame *) rdusp();
  170. /*
  171. * Since the signal is stacked on a dword boundary, the frame
  172. * should be dword aligned here as well. It it's not, then the
  173. * user is trying some funny business.
  174. */
  175. if (((long)frame) & 3)
  176. goto badframe;
  177. if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
  178. goto badframe;
  179. if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
  180. goto badframe;
  181. sigdelsetmask(&set, ~_BLOCKABLE);
  182. spin_lock_irq(&current->sighand->siglock);
  183. current->blocked = set;
  184. recalc_sigpending();
  185. spin_unlock_irq(&current->sighand->siglock);
  186. if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
  187. goto badframe;
  188. if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT)
  189. goto badframe;
  190. keep_debug_flags(oldccs, oldspc, regs);
  191. return regs->r10;
  192. badframe:
  193. force_sig(SIGSEGV, current);
  194. return 0;
  195. }
  196. /* Setup a signal frame. */
  197. static int
  198. setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
  199. unsigned long mask)
  200. {
  201. int err;
  202. unsigned long usp;
  203. err = 0;
  204. usp = rdusp();
  205. /*
  206. * Copy the registers. They are located first in sc, so it's
  207. * possible to use sc directly.
  208. */
  209. err |= __copy_to_user(sc, regs, sizeof(struct pt_regs));
  210. err |= __put_user(mask, &sc->oldmask);
  211. err |= __put_user(usp, &sc->usp);
  212. return err;
  213. }
  214. /* Figure out where to put the new signal frame - usually on the stack. */
  215. static inline void __user *
  216. get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
  217. {
  218. unsigned long sp;
  219. sp = rdusp();
  220. /* This is the X/Open sanctioned signal stack switching. */
  221. if (ka->sa.sa_flags & SA_ONSTACK) {
  222. if (!on_sig_stack(sp))
  223. sp = current->sas_ss_sp + current->sas_ss_size;
  224. }
  225. /* Make sure the frame is dword-aligned. */
  226. sp &= ~3;
  227. return (void __user *)(sp - frame_size);
  228. }
  229. /* Grab and setup a signal frame.
  230. *
  231. * Basically a lot of state-info is stacked, and arranged for the
  232. * user-mode program to return to the kernel using either a trampiline
  233. * which performs the syscall sigreturn(), or a provided user-mode
  234. * trampoline.
  235. */
  236. static int
  237. setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
  238. struct pt_regs * regs)
  239. {
  240. int err;
  241. unsigned long return_ip;
  242. struct signal_frame __user *frame;
  243. err = 0;
  244. frame = get_sigframe(ka, regs, sizeof(*frame));
  245. if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
  246. goto give_sigsegv;
  247. err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
  248. if (err)
  249. goto give_sigsegv;
  250. if (_NSIG_WORDS > 1) {
  251. err |= __copy_to_user(frame->extramask, &set->sig[1],
  252. sizeof(frame->extramask));
  253. }
  254. if (err)
  255. goto give_sigsegv;
  256. /*
  257. * Set up to return from user-space. If provided, use a stub
  258. * already located in user-space.
  259. */
  260. if (ka->sa.sa_flags & SA_RESTORER) {
  261. return_ip = (unsigned long)ka->sa.sa_restorer;
  262. } else {
  263. /* Trampoline - the desired return ip is in the signal return page. */
  264. return_ip = cris_signal_return_page;
  265. /*
  266. * This is movu.w __NR_sigreturn, r9; break 13;
  267. *
  268. * WE DO NOT USE IT ANY MORE! It's only left here for historical
  269. * reasons and because gdb uses it as a signature to notice
  270. * signal handler stack frames.
  271. */
  272. err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0));
  273. err |= __put_user(__NR_sigreturn, (short __user*)(frame->retcode+2));
  274. err |= __put_user(0xe93d, (short __user*)(frame->retcode+4));
  275. }
  276. if (err)
  277. goto give_sigsegv;
  278. /*
  279. * Set up registers for signal handler.
  280. *
  281. * Where the code enters now.
  282. * Where the code enter later.
  283. * First argument, signo.
  284. */
  285. regs->erp = (unsigned long) ka->sa.sa_handler;
  286. regs->srp = return_ip;
  287. regs->r10 = sig;
  288. /* Actually move the USP to reflect the stacked frame. */
  289. wrusp((unsigned long)frame);
  290. return 0;
  291. give_sigsegv:
  292. if (sig == SIGSEGV)
  293. ka->sa.sa_handler = SIG_DFL;
  294. force_sig(SIGSEGV, current);
  295. return -EFAULT;
  296. }
  297. static int
  298. setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
  299. sigset_t *set, struct pt_regs * regs)
  300. {
  301. int err;
  302. unsigned long return_ip;
  303. struct rt_signal_frame __user *frame;
  304. err = 0;
  305. frame = get_sigframe(ka, regs, sizeof(*frame));
  306. if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
  307. goto give_sigsegv;
  308. /* TODO: what is the current->exec_domain stuff and invmap ? */
  309. err |= __put_user(&frame->info, &frame->pinfo);
  310. err |= __put_user(&frame->uc, &frame->puc);
  311. err |= copy_siginfo_to_user(&frame->info, info);
  312. if (err)
  313. goto give_sigsegv;
  314. /* Clear all the bits of the ucontext we don't use. */
  315. err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
  316. err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
  317. err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
  318. if (err)
  319. goto give_sigsegv;
  320. /*
  321. * Set up to return from user-space. If provided, use a stub
  322. * already located in user-space.
  323. */
  324. if (ka->sa.sa_flags & SA_RESTORER) {
  325. return_ip = (unsigned long) ka->sa.sa_restorer;
  326. } else {
  327. /* Trampoline - the desired return ip is in the signal return page. */
  328. return_ip = cris_signal_return_page + 6;
  329. /*
  330. * This is movu.w __NR_rt_sigreturn, r9; break 13;
  331. *
  332. * WE DO NOT USE IT ANY MORE! It's only left here for historical
  333. * reasons and because gdb uses it as a signature to notice
  334. * signal handler stack frames.
  335. */
  336. err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0));
  337. err |= __put_user(__NR_rt_sigreturn,
  338. (short __user*)(frame->retcode+2));
  339. err |= __put_user(0xe93d, (short __user*)(frame->retcode+4));
  340. }
  341. if (err)
  342. goto give_sigsegv;
  343. /*
  344. * Set up registers for signal handler.
  345. *
  346. * Where the code enters now.
  347. * Where the code enters later.
  348. * First argument is signo.
  349. * Second argument is (siginfo_t *).
  350. * Third argument is unused.
  351. */
  352. regs->erp = (unsigned long) ka->sa.sa_handler;
  353. regs->srp = return_ip;
  354. regs->r10 = sig;
  355. regs->r11 = (unsigned long) &frame->info;
  356. regs->r12 = 0;
  357. /* Actually move the usp to reflect the stacked frame. */
  358. wrusp((unsigned long)frame);
  359. return 0;
  360. give_sigsegv:
  361. if (sig == SIGSEGV)
  362. ka->sa.sa_handler = SIG_DFL;
  363. force_sig(SIGSEGV, current);
  364. return -EFAULT;
  365. }
  366. /* Invoke a singal handler to, well, handle the signal. */
  367. static inline int
  368. handle_signal(int canrestart, unsigned long sig,
  369. siginfo_t *info, struct k_sigaction *ka,
  370. sigset_t *oldset, struct pt_regs * regs)
  371. {
  372. int ret;
  373. /* Check if this got called from a system call. */
  374. if (canrestart) {
  375. /* If so, check system call restarting. */
  376. switch (regs->r10) {
  377. case -ERESTART_RESTARTBLOCK:
  378. case -ERESTARTNOHAND:
  379. /*
  380. * This means that the syscall should
  381. * only be restarted if there was no
  382. * handler for the signal, and since
  383. * this point isn't reached unless
  384. * there is a handler, there's no need
  385. * to restart.
  386. */
  387. regs->r10 = -EINTR;
  388. break;
  389. case -ERESTARTSYS:
  390. /*
  391. * This means restart the syscall if
  392. * there is no handler, or the handler
  393. * was registered with SA_RESTART.
  394. */
  395. if (!(ka->sa.sa_flags & SA_RESTART)) {
  396. regs->r10 = -EINTR;
  397. break;
  398. }
  399. /* Fall through. */
  400. case -ERESTARTNOINTR:
  401. /*
  402. * This means that the syscall should
  403. * be called again after the signal
  404. * handler returns.
  405. */
  406. RESTART_CRIS_SYS(regs);
  407. break;
  408. }
  409. }
  410. /* Set up the stack frame. */
  411. if (ka->sa.sa_flags & SA_SIGINFO)
  412. ret = setup_rt_frame(sig, ka, info, oldset, regs);
  413. else
  414. ret = setup_frame(sig, ka, oldset, regs);
  415. if (ka->sa.sa_flags & SA_ONESHOT)
  416. ka->sa.sa_handler = SIG_DFL;
  417. if (ret == 0) {
  418. spin_lock_irq(&current->sighand->siglock);
  419. sigorsets(&current->blocked, &current->blocked,
  420. &ka->sa.sa_mask);
  421. if (!(ka->sa.sa_flags & SA_NODEFER))
  422. sigaddset(&current->blocked, sig);
  423. recalc_sigpending();
  424. spin_unlock_irq(&current->sighand->siglock);
  425. }
  426. return ret;
  427. }
  428. /*
  429. * Note that 'init' is a special process: it doesn't get signals it doesn't
  430. * want to handle. Thus you cannot kill init even with a SIGKILL even by
  431. * mistake.
  432. *
  433. * Also note that the regs structure given here as an argument, is the latest
  434. * pushed pt_regs. It may or may not be the same as the first pushed registers
  435. * when the initial usermode->kernelmode transition took place. Therefore
  436. * we can use user_mode(regs) to see if we came directly from kernel or user
  437. * mode below.
  438. */
  439. void
  440. do_signal(int canrestart, struct pt_regs *regs)
  441. {
  442. int signr;
  443. siginfo_t info;
  444. struct k_sigaction ka;
  445. sigset_t *oldset;
  446. /*
  447. * The common case should go fast, which is why this point is
  448. * reached from kernel-mode. If that's the case, just return
  449. * without doing anything.
  450. */
  451. if (!user_mode(regs))
  452. return;
  453. if (test_thread_flag(TIF_RESTORE_SIGMASK))
  454. oldset = &current->saved_sigmask;
  455. else
  456. oldset = &current->blocked;
  457. signr = get_signal_to_deliver(&info, &ka, regs, NULL);
  458. if (signr > 0) {
  459. /* Whee! Actually deliver the signal. */
  460. if (handle_signal(canrestart, signr, &info, &ka,
  461. oldset, regs)) {
  462. /* a signal was successfully delivered; the saved
  463. * sigmask will have been stored in the signal frame,
  464. * and will be restored by sigreturn, so we can simply
  465. * clear the TIF_RESTORE_SIGMASK flag */
  466. if (test_thread_flag(TIF_RESTORE_SIGMASK))
  467. clear_thread_flag(TIF_RESTORE_SIGMASK);
  468. }
  469. return;
  470. }
  471. /* Got here from a system call? */
  472. if (canrestart) {
  473. /* Restart the system call - no handlers present. */
  474. if (regs->r10 == -ERESTARTNOHAND ||
  475. regs->r10 == -ERESTARTSYS ||
  476. regs->r10 == -ERESTARTNOINTR) {
  477. RESTART_CRIS_SYS(regs);
  478. }
  479. if (regs->r10 == -ERESTART_RESTARTBLOCK){
  480. regs->r10 = __NR_restart_syscall;
  481. regs->erp -= 2;
  482. }
  483. }
  484. /* if there's no signal to deliver, we just put the saved sigmask
  485. * back */
  486. if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
  487. clear_thread_flag(TIF_RESTORE_SIGMASK);
  488. sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
  489. }
  490. }
  491. asmlinkage void
  492. ugdb_trap_user(struct thread_info *ti, int sig)
  493. {
  494. if (((user_regs(ti)->exs & 0xff00) >> 8) != SINGLE_STEP_INTR_VECT) {
  495. /* Zero single-step PC if the reason we stopped wasn't a single
  496. step exception. This is to avoid relying on it when it isn't
  497. reliable. */
  498. user_regs(ti)->spc = 0;
  499. }
  500. /* FIXME: Filter out false h/w breakpoint hits (i.e. EDA
  501. not withing any configured h/w breakpoint range). Synchronize with
  502. what already exists for kernel debugging. */
  503. if (((user_regs(ti)->exs & 0xff00) >> 8) == BREAK_8_INTR_VECT) {
  504. /* Break 8: subtract 2 from ERP unless in a delay slot. */
  505. if (!(user_regs(ti)->erp & 0x1))
  506. user_regs(ti)->erp -= 2;
  507. }
  508. sys_kill(ti->task->pid, sig);
  509. }
  510. void
  511. keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
  512. struct pt_regs *regs)
  513. {
  514. if (oldccs & (1 << Q_CCS_BITNR)) {
  515. /* Pending single step due to single-stepping the break 13
  516. in the signal trampoline: keep the Q flag. */
  517. regs->ccs |= (1 << Q_CCS_BITNR);
  518. /* S flag should be set - complain if it's not. */
  519. if (!(oldccs & (1 << (S_CCS_BITNR + CCS_SHIFT)))) {
  520. printk("Q flag but no S flag?");
  521. }
  522. regs->ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
  523. /* Assume the SPC is valid and interesting. */
  524. regs->spc = oldspc;
  525. } else if (oldccs & (1 << (S_CCS_BITNR + CCS_SHIFT))) {
  526. /* If a h/w bp was set in the signal handler we need
  527. to keep the S flag. */
  528. regs->ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
  529. /* Don't keep the old SPC though; if we got here due to
  530. a single-step, the Q flag should have been set. */
  531. } else if (regs->spc) {
  532. /* If we were single-stepping *before* the signal was taken,
  533. we don't want to restore that state now, because GDB will
  534. have forgotten all about it. */
  535. regs->spc = 0;
  536. regs->ccs &= ~(1 << (S_CCS_BITNR + CCS_SHIFT));
  537. }
  538. }
  539. /* Set up the trampolines on the signal return page. */
  540. int __init
  541. cris_init_signal(void)
  542. {
  543. u16* data = kmalloc(PAGE_SIZE, GFP_KERNEL);
  544. /* This is movu.w __NR_sigreturn, r9; break 13; */
  545. data[0] = 0x9c5f;
  546. data[1] = __NR_sigreturn;
  547. data[2] = 0xe93d;
  548. /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
  549. data[3] = 0x9c5f;
  550. data[4] = __NR_rt_sigreturn;
  551. data[5] = 0xe93d;
  552. /* Map to userspace with appropriate permissions (no write access...) */
  553. cris_signal_return_page = (unsigned long)
  554. __ioremap_prot(virt_to_phys(data), PAGE_SIZE, PAGE_SIGNAL_TRAMPOLINE);
  555. return 0;
  556. }
  557. __initcall(cris_init_signal);