diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-05-19 00:40:12 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-07-28 05:10:28 -0400 |
commit | 3bc24a1a5441ef621daf737ec93b0a10e8999d59 (patch) | |
tree | 09e3e2e8eda617de72f643aa22ba86490b16cd17 /arch/sh/kernel/signal_32.c | |
parent | 9b14ec35f03d89c88cba225add8b6eca15203964 (diff) |
sh: Initial ELF FDPIC support.
This adds initial support for ELF FDPIC on MMU-less SH, as per version
0.2 of the ABI definition at:
http://www.codesourcery.com/public/docs/sh-fdpic/sh-fdpic-abi.txt
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/signal_32.c')
-rw-r--r-- | arch/sh/kernel/signal_32.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index f311551d9a05..46170a9a7221 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -33,6 +33,11 @@ | |||
33 | 33 | ||
34 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 34 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
35 | 35 | ||
36 | struct fdpic_func_descriptor { | ||
37 | unsigned long text; | ||
38 | unsigned long GOT; | ||
39 | }; | ||
40 | |||
36 | /* | 41 | /* |
37 | * Atomically swap in the new signal mask, and wait for a signal. | 42 | * Atomically swap in the new signal mask, and wait for a signal. |
38 | */ | 43 | */ |
@@ -378,7 +383,15 @@ static int setup_frame(int sig, struct k_sigaction *ka, | |||
378 | regs->regs[4] = signal; /* Arg for signal handler */ | 383 | regs->regs[4] = signal; /* Arg for signal handler */ |
379 | regs->regs[5] = 0; | 384 | regs->regs[5] = 0; |
380 | regs->regs[6] = (unsigned long) &frame->sc; | 385 | regs->regs[6] = (unsigned long) &frame->sc; |
381 | regs->pc = (unsigned long) ka->sa.sa_handler; | 386 | |
387 | if (current->personality & FDPIC_FUNCPTRS) { | ||
388 | struct fdpic_func_descriptor __user *funcptr = | ||
389 | (struct fdpic_func_descriptor __user *)ka->sa.sa_handler; | ||
390 | |||
391 | __get_user(regs->pc, &funcptr->text); | ||
392 | __get_user(regs->regs[12], &funcptr->GOT); | ||
393 | } else | ||
394 | regs->pc = (unsigned long)ka->sa.sa_handler; | ||
382 | 395 | ||
383 | set_fs(USER_DS); | 396 | set_fs(USER_DS); |
384 | 397 | ||
@@ -458,7 +471,15 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
458 | regs->regs[4] = signal; /* Arg for signal handler */ | 471 | regs->regs[4] = signal; /* Arg for signal handler */ |
459 | regs->regs[5] = (unsigned long) &frame->info; | 472 | regs->regs[5] = (unsigned long) &frame->info; |
460 | regs->regs[6] = (unsigned long) &frame->uc; | 473 | regs->regs[6] = (unsigned long) &frame->uc; |
461 | regs->pc = (unsigned long) ka->sa.sa_handler; | 474 | |
475 | if (current->personality & FDPIC_FUNCPTRS) { | ||
476 | struct fdpic_func_descriptor __user *funcptr = | ||
477 | (struct fdpic_func_descriptor __user *)ka->sa.sa_handler; | ||
478 | |||
479 | __get_user(regs->pc, &funcptr->text); | ||
480 | __get_user(regs->regs[12], &funcptr->GOT); | ||
481 | } else | ||
482 | regs->pc = (unsigned long)ka->sa.sa_handler; | ||
462 | 483 | ||
463 | set_fs(USER_DS); | 484 | set_fs(USER_DS); |
464 | 485 | ||