]>
Commit | Line | Data |
---|---|---|
8ec87d87 | 1 | diff -urN linux-2.4.15-pre9/arch/ppc/kernel/entry.S linuxppc_2_4/arch/ppc/kernel/entry.S |
2 | --- linux-2.4.15-pre9/arch/ppc/kernel/entry.S Mon Sep 24 09:31:16 2001 | |
3 | +++ linuxppc_2_4/arch/ppc/kernel/entry.S Sat Feb 23 16:40:48 2002 | |
4 | @@ -1,5 +1,5 @@ | |
5 | /* | |
6 | - * BK Id: SCCS/s.entry.S 1.22 08/15/01 22:43:06 paulus | |
7 | + * BK Id: SCCS/s.entry.S 1.24 11/23/01 16:38:29 paulus | |
8 | */ | |
9 | /* | |
10 | * PowerPC version | |
11 | @@ -216,6 +216,7 @@ | |
12 | SAVE_8GPRS(14, r1) | |
13 | SAVE_10GPRS(22, r1) | |
14 | mflr r20 /* Return to switch caller */ | |
15 | + stw r20,INT_FRAME_SIZE+4(r1) | |
16 | mfmsr r22 | |
17 | li r0,MSR_FP /* Disable floating-point */ | |
18 | #ifdef CONFIG_ALTIVEC | |
19 | @@ -223,10 +224,12 @@ | |
20 | oris r0,r0,MSR_VEC@h /* Disable altivec */ | |
21 | END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) | |
22 | #endif /* CONFIG_ALTIVEC */ | |
23 | + and. r0,r0,r22 /* FP or altivec enabled? */ | |
24 | + beq+ 1f | |
25 | andc r22,r22,r0 | |
26 | mtmsr r22 | |
27 | isync | |
28 | - stw r20,_NIP(r1) | |
29 | +1: stw r20,_NIP(r1) | |
30 | stw r22,_MSR(r1) | |
31 | stw r20,_LINK(r1) | |
32 | mfcr r20 | |
33 | @@ -391,9 +394,9 @@ | |
34 | mfmsr r9 | |
35 | stw r9,8(r1) | |
36 | li r0,0 | |
37 | - ori r0,r0,MSR_EE|MSR_SE|MSR_BE | |
38 | + ori r0,r0,MSR_EE|MSR_SE|MSR_BE|MSR_FE0|MSR_FE1 | |
39 | andc r0,r9,r0 | |
40 | - li r10,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP | |
41 | + li r10,MSR_IR|MSR_DR|MSR_FP | |
42 | andc r9,r0,r10 | |
43 | SYNC /* disable interrupts so SRR0/1 */ | |
44 | mtmsr r0 /* don't get trashed */ | |
45 | diff -urN linux-2.4.15-pre9/arch/ppc/kernel/misc.S linuxppc_2_4/arch/ppc/kernel/misc.S | |
46 | --- linux-2.4.15-pre9/arch/ppc/kernel/misc.S Tue Nov 6 18:21:29 2001 | |
47 | +++ linuxppc_2_4/arch/ppc/kernel/misc.S Sat Feb 23 16:40:48 2002 | |
48 | @@ -1,5 +1,5 @@ | |
49 | /* | |
50 | - * BK Id: SCCS/s.misc.S 1.32 10/18/01 17:29:53 trini | |
51 | + * BK Id: SCCS/s.misc.S 1.34 11/23/01 16:38:29 paulus | |
52 | */ | |
53 | /* | |
54 | * This file contains miscellaneous low-level functions. | |
55 | @@ -866,10 +866,8 @@ | |
56 | sc | |
57 | cmpi 0,r3,0 /* parent or child? */ | |
58 | bnelr /* return if parent */ | |
59 | - li r0,0 /* clear out p->thread.regs */ | |
60 | - stw r0,THREAD+PT_REGS(r2) /* since we don't have user ctx */ | |
61 | - addi r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD | |
62 | - stw r0,0(r1) | |
63 | + li r0,0 /* make top-level stack frame */ | |
64 | + stwu r0,-16(r1) | |
65 | mtlr r6 /* fn addr in lr */ | |
66 | mr r3,r4 /* load arg and call fn */ | |
67 | blrl | |
68 | diff -urN linux-2.4.15-pre9/arch/ppc/kernel/process.c linuxppc_2_4/arch/ppc/kernel/process.c | |
69 | --- linux-2.4.15-pre9/arch/ppc/kernel/process.c Wed Oct 10 12:38:52 2001 | |
70 | +++ linuxppc_2_4/arch/ppc/kernel/process.c Sat Feb 23 16:40:48 2002 | |
71 | @@ -1,5 +1,5 @@ | |
72 | /* | |
73 | - * BK Id: SCCS/s.process.c 1.31 10/02/01 09:51:41 paulus | |
74 | + * BK Id: SCCS/s.process.c 1.34 11/23/01 16:38:29 paulus | |
75 | */ | |
76 | /* | |
77 | * linux/arch/ppc/kernel/process.c | |
78 | @@ -336,9 +336,10 @@ | |
79 | /* for kernel thread, set `current' and stackptr in new task */ | |
80 | childregs->gpr[1] = sp + sizeof(struct pt_regs); | |
81 | childregs->gpr[2] = (unsigned long) p; | |
82 | - } | |
83 | + p->thread.regs = NULL; /* no user register state */ | |
84 | + } else | |
85 | + p->thread.regs = childregs; | |
86 | childregs->gpr[3] = 0; /* Result from fork() */ | |
87 | - p->thread.regs = childregs; | |
88 | sp -= STACK_FRAME_OVERHEAD; | |
89 | childframe = sp; | |
90 | ||
91 | @@ -463,6 +464,27 @@ | |
92 | break; | |
93 | } | |
94 | printk("\n"); | |
95 | +} | |
96 | + | |
97 | +void show_trace_task(struct task_struct *tsk) | |
98 | +{ | |
99 | + unsigned long stack_top = (unsigned long) tsk + THREAD_SIZE; | |
100 | + unsigned long sp, prev_sp; | |
101 | + int count = 0; | |
102 | + | |
103 | + if (tsk == NULL) | |
104 | + return; | |
105 | + sp = (unsigned long) &tsk->thread.ksp; | |
106 | + do { | |
107 | + prev_sp = sp; | |
108 | + sp = *(unsigned long *)sp; | |
109 | + if (sp <= prev_sp || sp >= stack_top || (sp & 3) != 0) | |
110 | + break; | |
111 | + if (count > 0) | |
112 | + printk("[%08lx] ", *(unsigned long *)(sp + 4)); | |
113 | + } while (++count < 16); | |
114 | + if (count > 1) | |
115 | + printk("\n"); | |
116 | } | |
117 | ||
118 | #if 0 | |
119 | diff -urN linux-2.4.15-pre9/arch/ppc/kernel/ptrace.c linuxppc_2_4/arch/ppc/kernel/ptrace.c | |
120 | --- linux-2.4.15-pre9/arch/ppc/kernel/ptrace.c Mon Sep 24 09:31:17 2001 | |
121 | +++ linuxppc_2_4/arch/ppc/kernel/ptrace.c Sat Feb 23 16:40:48 2002 | |
122 | @@ -1,5 +1,5 @@ | |
123 | /* | |
124 | - * BK Id: SCCS/s.ptrace.c 1.8 07/07/01 17:00:08 paulus | |
125 | + * BK Id: SCCS/s.ptrace.c 1.12 11/23/01 16:38:30 paulus | |
126 | */ | |
127 | /* | |
128 | * linux/arch/ppc/kernel/ptrace.c | |
129 | @@ -132,14 +132,9 @@ | |
130 | ret = ptrace_attach(child); | |
131 | goto out_tsk; | |
132 | } | |
133 | - ret = -ESRCH; | |
134 | - if (!(child->ptrace & PT_PTRACED)) | |
135 | - goto out_tsk; | |
136 | - if (child->state != TASK_STOPPED) { | |
137 | - if (request != PTRACE_KILL) | |
138 | - goto out_tsk; | |
139 | - } | |
140 | - if (child->p_pptr != current) | |
141 | + | |
142 | + ret = ptrace_check_attach(child, request == PTRACE_KILL); | |
143 | + if (ret < 0) | |
144 | goto out_tsk; | |
145 | ||
146 | switch (request) { | |
147 | diff -urN linux-2.4.15-pre9/arch/ppc/kernel/signal.c linuxppc_2_4/arch/ppc/kernel/signal.c | |
148 | --- linux-2.4.15-pre9/arch/ppc/kernel/signal.c Sat May 26 12:39:42 2001 | |
149 | +++ linuxppc_2_4/arch/ppc/kernel/signal.c Sat Feb 23 16:40:48 2002 | |
150 | @@ -1,5 +1,5 @@ | |
151 | /* | |
152 | - * BK Id: SCCS/s.signal.c 1.7 05/17/01 18:14:22 cort | |
153 | + * BK Id: SCCS/s.signal.c 1.10 11/23/01 16:38:30 paulus | |
154 | */ | |
155 | /* | |
156 | * linux/arch/ppc/kernel/signal.c | |
157 | @@ -180,7 +180,7 @@ | |
158 | siginitset(&new_ka.sa.sa_mask, mask); | |
159 | } | |
160 | ||
161 | - ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | |
162 | + ret = do_sigaction(sig, (act? &new_ka: NULL), (oact? &old_ka: NULL)); | |
163 | ||
164 | if (!ret && oact) { | |
165 | if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || | |
166 | @@ -254,6 +254,8 @@ | |
167 | current->blocked = set; | |
168 | recalc_sigpending(current); | |
169 | spin_unlock_irq(¤t->sigmask_lock); | |
170 | + if (regs->msr & MSR_FP) | |
171 | + giveup_fpu(current); | |
172 | ||
173 | rt_sf++; /* Look at next rt_sigframe */ | |
174 | if (rt_sf == (struct rt_sigframe *)(sigctx.regs)) { | |
175 | @@ -263,8 +265,6 @@ | |
176 | * see handle_signal() | |
177 | */ | |
178 | sr = (struct sigregs *) sigctx.regs; | |
179 | - if (regs->msr & MSR_FP ) | |
180 | - giveup_fpu(current); | |
181 | if (copy_from_user(saved_regs, &sr->gp_regs, | |
182 | sizeof(sr->gp_regs))) | |
183 | goto badframe; | |
184 | @@ -298,6 +298,7 @@ | |
185 | if (get_user(prevsp, &sr->gp_regs[PT_R1]) | |
186 | || put_user(prevsp, (unsigned long *) regs->gpr[1])) | |
187 | goto badframe; | |
188 | + current->thread.fpscr = 0; | |
189 | } | |
190 | return ret; | |
191 | ||
192 | @@ -328,6 +329,7 @@ | |
193 | goto badframe; | |
194 | flush_icache_range((unsigned long) &frame->tramp[0], | |
195 | (unsigned long) &frame->tramp[2]); | |
196 | + current->thread.fpscr = 0; /* turn off all fp exceptions */ | |
197 | ||
198 | /* Retrieve rt_sigframe from stack and | |
199 | set up registers for signal handler | |
200 | @@ -379,13 +381,13 @@ | |
201 | current->blocked = set; | |
202 | recalc_sigpending(current); | |
203 | spin_unlock_irq(¤t->sigmask_lock); | |
204 | + if (regs->msr & MSR_FP ) | |
205 | + giveup_fpu(current); | |
206 | ||
207 | sc++; /* Look at next sigcontext */ | |
208 | if (sc == (struct sigcontext_struct *)(sigctx.regs)) { | |
209 | /* Last stacked signal - restore registers */ | |
210 | sr = (struct sigregs *) sigctx.regs; | |
211 | - if (regs->msr & MSR_FP ) | |
212 | - giveup_fpu(current); | |
213 | if (copy_from_user(saved_regs, &sr->gp_regs, | |
214 | sizeof(sr->gp_regs))) | |
215 | goto badframe; | |
216 | @@ -413,6 +415,7 @@ | |
217 | if (get_user(prevsp, &sr->gp_regs[PT_R1]) | |
218 | || put_user(prevsp, (unsigned long *) regs->gpr[1])) | |
219 | goto badframe; | |
220 | + current->thread.fpscr = 0; | |
221 | } | |
222 | return ret; | |
223 | ||
224 | @@ -431,8 +434,8 @@ | |
225 | ||
226 | if (verify_area(VERIFY_WRITE, frame, sizeof(*frame))) | |
227 | goto badframe; | |
228 | - if (regs->msr & MSR_FP) | |
229 | - giveup_fpu(current); | |
230 | + if (regs->msr & MSR_FP) | |
231 | + giveup_fpu(current); | |
232 | if (__copy_to_user(&frame->gp_regs, regs, GP_REGS_SIZE) | |
233 | || __copy_to_user(&frame->fp_regs, current->thread.fpr, | |
234 | ELF_NFPREG * sizeof(double)) | |
235 | @@ -441,6 +444,7 @@ | |
236 | goto badframe; | |
237 | flush_icache_range((unsigned long) &frame->tramp[0], | |
238 | (unsigned long) &frame->tramp[2]); | |
239 | + current->thread.fpscr = 0; /* turn off all fp exceptions */ | |
240 | ||
241 | newsp -= __SIGNAL_FRAMESIZE; | |
242 | if (put_user(regs->gpr[1], (unsigned long *)newsp) | |
243 | diff -urN linux-2.4.15-pre9/arch/ppc/kernel/smp.c linuxppc_2_4/arch/ppc/kernel/smp.c | |
244 | --- linux-2.4.15-pre9/arch/ppc/kernel/smp.c Thu Nov 22 22:06:50 2001 | |
245 | +++ linuxppc_2_4/arch/ppc/kernel/smp.c Sat Feb 23 16:40:48 2002 | |
246 | @@ -1,5 +1,5 @@ | |
247 | /* | |
248 | - * BK Id: SCCS/s.smp.c 1.34 10/11/01 12:06:01 trini | |
249 | + * BK Id: SCCS/s.smp.c 1.37 11/23/01 16:38:30 paulus | |
250 | */ | |
251 | /* | |
252 | * Smp support for ppc. | |
253 | @@ -37,8 +37,6 @@ | |
254 | #include <asm/residual.h> | |
255 | #include <asm/time.h> | |
256 | ||
257 | -#include "open_pic.h" | |
258 | - | |
259 | int smp_threads_ready; | |
260 | volatile int smp_commenced; | |
261 | int smp_num_cpus = 1; | |
262 | @@ -324,21 +322,8 @@ | |
263 | struct pt_regs regs; | |
264 | ||
265 | /* create a process for the processor */ | |
266 | - /* we don't care about the values in regs since we'll | |
267 | - never reschedule the forked task. */ | |
268 | - /* We DO care about one bit in the pt_regs we | |
269 | - pass to do_fork. That is the MSR_FP bit in | |
270 | - regs.msr. If that bit is on, then do_fork | |
271 | - (via copy_thread) will call giveup_fpu. | |
272 | - giveup_fpu will get a pointer to our (current's) | |
273 | - last register savearea via current->thread.regs | |
274 | - and using that pointer will turn off the MSR_FP, | |
275 | - MSR_FE0 and MSR_FE1 bits. At this point, this | |
276 | - pointer is pointing to some arbitrary point within | |
277 | - our stack. */ | |
278 | - | |
279 | + /* only regs.msr is actually used, and 0 is OK for it */ | |
280 | memset(®s, 0, sizeof(struct pt_regs)); | |
281 | - | |
282 | if (do_fork(CLONE_VM|CLONE_PID, 0, ®s, 0) < 0) | |
283 | panic("failed fork for CPU %d", i); | |
284 | p = init_task.prev_task; | |
285 | @@ -505,8 +490,6 @@ | |
286 | cpu_callin_map[cpu] = 1; | |
287 | ||
288 | smp_ops->setup_cpu(cpu); | |
289 | - | |
290 | - init_idle(); | |
291 | ||
292 | /* | |
293 | * This cpu is now "online". Only set them online | |
294 | diff -urN linux-2.4.15-pre9/arch/ppc/mm/ppc_mmu.c linuxppc_2_4/arch/ppc/mm/ppc_mmu.c | |
295 | --- linux-2.4.15-pre9/arch/ppc/mm/ppc_mmu.c Mon Sep 24 09:31:17 2001 | |
296 | +++ linuxppc_2_4/arch/ppc/mm/ppc_mmu.c Sat Feb 23 16:40:48 2002 | |
297 | @@ -304,6 +304,9 @@ | |
298 | ||
299 | if (Hash == 0 || nopreload) | |
300 | return; | |
301 | + /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */ | |
302 | + if (!pte_young(pte)) | |
303 | + return; | |
304 | mm = (address < TASK_SIZE)? vma->vm_mm: &init_mm; | |
305 | pmd = pmd_offset(pgd_offset(mm, address), address); | |
306 | if (!pmd_none(*pmd)) { | |
307 |