diff options
author | Franck Bui-Huu <fbuihuu@gmail.com> | 2007-02-05 09:24:20 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-02-10 17:38:45 -0500 |
commit | c3fc4ab36d495f50ccc89986fe32eeabc2549fa1 (patch) | |
tree | c83a3a56c8a04bb06fc96932b6edba5b54143c89 /arch/mips/kernel/signal-common.h | |
parent | a007b1f1c764c08896bc574fbd33e19ce898a188 (diff) |
[MIPS] signal: do not inline functions in signal-common.h
These functions are quite big and there are no points to make
them inlined. So this patch moves the functions implementation
in signal.c and make them available for others source files
which need them.
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/signal-common.h')
-rw-r--r-- | arch/mips/kernel/signal-common.h | 150 |
1 files changed, 14 insertions, 136 deletions
diff --git a/arch/mips/kernel/signal-common.h b/arch/mips/kernel/signal-common.h index bb3c631b808e..03d2b603fb84 100644 --- a/arch/mips/kernel/signal-common.h +++ b/arch/mips/kernel/signal-common.h | |||
@@ -8,145 +8,23 @@ | |||
8 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | 8 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __SIGNAL_COMMON_H | ||
12 | #define __SIGNAL_COMMON_H | ||
11 | 13 | ||
12 | static inline int | 14 | /* |
13 | setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | 15 | * handle hardware context |
14 | { | 16 | */ |
15 | int err = 0; | 17 | extern int setup_sigcontext(struct pt_regs *, struct sigcontext __user *); |
16 | int i; | 18 | extern int restore_sigcontext(struct pt_regs *, struct sigcontext __user *); |
17 | |||
18 | err |= __put_user(regs->cp0_epc, &sc->sc_pc); | ||
19 | |||
20 | err |= __put_user(0, &sc->sc_regs[0]); | ||
21 | for (i = 1; i < 32; i++) | ||
22 | err |= __put_user(regs->regs[i], &sc->sc_regs[i]); | ||
23 | |||
24 | err |= __put_user(regs->hi, &sc->sc_mdhi); | ||
25 | err |= __put_user(regs->lo, &sc->sc_mdlo); | ||
26 | if (cpu_has_dsp) { | ||
27 | err |= __put_user(mfhi1(), &sc->sc_hi1); | ||
28 | err |= __put_user(mflo1(), &sc->sc_lo1); | ||
29 | err |= __put_user(mfhi2(), &sc->sc_hi2); | ||
30 | err |= __put_user(mflo2(), &sc->sc_lo2); | ||
31 | err |= __put_user(mfhi3(), &sc->sc_hi3); | ||
32 | err |= __put_user(mflo3(), &sc->sc_lo3); | ||
33 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); | ||
34 | } | ||
35 | |||
36 | err |= __put_user(!!used_math(), &sc->sc_used_math); | ||
37 | |||
38 | if (used_math()) { | ||
39 | /* | ||
40 | * Save FPU state to signal context. Signal handler | ||
41 | * will "inherit" current FPU state. | ||
42 | */ | ||
43 | preempt_disable(); | ||
44 | |||
45 | if (!is_fpu_owner()) { | ||
46 | own_fpu(); | ||
47 | restore_fp(current); | ||
48 | } | ||
49 | err |= save_fp_context(sc); | ||
50 | |||
51 | preempt_enable(); | ||
52 | } | ||
53 | return err; | ||
54 | } | ||
55 | |||
56 | static inline int | ||
57 | restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | ||
58 | { | ||
59 | unsigned int used_math; | ||
60 | unsigned long treg; | ||
61 | int err = 0; | ||
62 | int i; | ||
63 | |||
64 | /* Always make any pending restarted system calls return -EINTR */ | ||
65 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
66 | |||
67 | err |= __get_user(regs->cp0_epc, &sc->sc_pc); | ||
68 | err |= __get_user(regs->hi, &sc->sc_mdhi); | ||
69 | err |= __get_user(regs->lo, &sc->sc_mdlo); | ||
70 | if (cpu_has_dsp) { | ||
71 | err |= __get_user(treg, &sc->sc_hi1); mthi1(treg); | ||
72 | err |= __get_user(treg, &sc->sc_lo1); mtlo1(treg); | ||
73 | err |= __get_user(treg, &sc->sc_hi2); mthi2(treg); | ||
74 | err |= __get_user(treg, &sc->sc_lo2); mtlo2(treg); | ||
75 | err |= __get_user(treg, &sc->sc_hi3); mthi3(treg); | ||
76 | err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg); | ||
77 | err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK); | ||
78 | } | ||
79 | |||
80 | for (i = 1; i < 32; i++) | ||
81 | err |= __get_user(regs->regs[i], &sc->sc_regs[i]); | ||
82 | |||
83 | err |= __get_user(used_math, &sc->sc_used_math); | ||
84 | conditional_used_math(used_math); | ||
85 | |||
86 | preempt_disable(); | ||
87 | |||
88 | if (used_math()) { | ||
89 | /* restore fpu context if we have used it before */ | ||
90 | own_fpu(); | ||
91 | err |= restore_fp_context(sc); | ||
92 | } else { | ||
93 | /* signal handler may have used FPU. Give it up. */ | ||
94 | lose_fpu(); | ||
95 | } | ||
96 | |||
97 | preempt_enable(); | ||
98 | |||
99 | return err; | ||
100 | } | ||
101 | 19 | ||
102 | /* | 20 | /* |
103 | * Determine which stack to use.. | 21 | * Determine which stack to use.. |
104 | */ | 22 | */ |
105 | static inline void __user * | 23 | extern void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, |
106 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | 24 | size_t frame_size); |
107 | { | 25 | /* |
108 | unsigned long sp; | 26 | * install trampoline code to get back from the sig handler |
109 | 27 | */ | |
110 | /* Default to using normal stack */ | 28 | extern int install_sigtramp(unsigned int __user *tramp, unsigned int syscall); |
111 | sp = regs->regs[29]; | ||
112 | |||
113 | /* | ||
114 | * FPU emulator may have it's own trampoline active just | ||
115 | * above the user stack, 16-bytes before the next lowest | ||
116 | * 16 byte boundary. Try to avoid trashing it. | ||
117 | */ | ||
118 | sp -= 32; | ||
119 | |||
120 | /* This is the X/Open sanctioned signal stack switching. */ | ||
121 | if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0)) | ||
122 | sp = current->sas_ss_sp + current->sas_ss_size; | ||
123 | |||
124 | return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK)); | ||
125 | } | ||
126 | |||
127 | static inline int install_sigtramp(unsigned int __user *tramp, | ||
128 | unsigned int syscall) | ||
129 | { | ||
130 | int err; | ||
131 | |||
132 | /* | ||
133 | * Set up the return code ... | ||
134 | * | ||
135 | * li v0, __NR__foo_sigreturn | ||
136 | * syscall | ||
137 | */ | ||
138 | |||
139 | err = __put_user(0x24020000 + syscall, tramp + 0); | ||
140 | err |= __put_user(0x0000000c , tramp + 1); | ||
141 | if (ICACHE_REFILLS_WORKAROUND_WAR) { | ||
142 | err |= __put_user(0, tramp + 2); | ||
143 | err |= __put_user(0, tramp + 3); | ||
144 | err |= __put_user(0, tramp + 4); | ||
145 | err |= __put_user(0, tramp + 5); | ||
146 | err |= __put_user(0, tramp + 6); | ||
147 | err |= __put_user(0, tramp + 7); | ||
148 | } | ||
149 | flush_cache_sigtramp((unsigned long) tramp); | ||
150 | 29 | ||
151 | return err; | 30 | #endif /* __SIGNAL_COMMON_H */ |
152 | } | ||