signal.c 17 KB

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