a33448c2bd916de78f251ed7be9ea1d9973c3b5f
[powerpc.git] / arch / ppc64 / kernel / misc.S
1 /*
2  *  arch/ppc/kernel/misc.S
3  *
4  *  
5  *
6  * This file contains miscellaneous low-level functions.
7  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8  *
9  * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
10  * and Paul Mackerras.
11  * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
12  * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) 
13  * 
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version
17  * 2 of the License, or (at your option) any later version.
18  *
19  */
20
21 #include <linux/config.h>
22 #include <linux/sys.h>
23 #include <asm/unistd.h>
24 #include <asm/errno.h>
25 #include <asm/processor.h>
26 #include <asm/page.h>
27 #include <asm/cache.h>
28 #include <asm/ppc_asm.h>
29 #include <asm/asm-offsets.h>
30 #include <asm/cputable.h>
31 #include <asm/thread_info.h>
32
33         .text
34
35 /*
36  * Returns (address we were linked at) - (address we are running at)
37  * for use before the text and data are mapped to KERNELBASE.
38  */
39
40 _GLOBAL(reloc_offset)
41         mflr    r0
42         bl      1f
43 1:      mflr    r3
44         LOADADDR(r4,1b)
45         sub     r3,r4,r3
46         mtlr    r0
47         blr
48
49 _GLOBAL(get_msr)
50         mfmsr   r3
51         blr
52
53 _GLOBAL(get_dar)
54         mfdar   r3
55         blr
56
57 _GLOBAL(get_srr0)
58         mfsrr0  r3
59         blr
60
61 _GLOBAL(get_srr1)
62         mfsrr1  r3
63         blr
64         
65 _GLOBAL(get_sp)
66         mr      r3,r1
67         blr
68
69 #ifdef CONFIG_IRQSTACKS
70 _GLOBAL(call_do_softirq)
71         mflr    r0
72         std     r0,16(r1)
73         stdu    r1,THREAD_SIZE-112(r3)
74         mr      r1,r3
75         bl      .__do_softirq
76         ld      r1,0(r1)
77         ld      r0,16(r1)
78         mtlr    r0
79         blr
80
81 _GLOBAL(call_handle_IRQ_event)
82         mflr    r0
83         std     r0,16(r1)
84         stdu    r1,THREAD_SIZE-112(r6)
85         mr      r1,r6
86         bl      .handle_IRQ_event
87         ld      r1,0(r1)
88         ld      r0,16(r1)
89         mtlr    r0
90         blr
91 #endif /* CONFIG_IRQSTACKS */
92
93         /*
94  * To be called by C code which needs to do some operations with MMU
95  * disabled. Note that interrupts have to be disabled by the caller
96  * prior to calling us. The code called _MUST_ be in the RMO of course
97  * and part of the linear mapping as we don't attempt to translate the
98  * stack pointer at all. The function is called with the stack switched
99  * to this CPU emergency stack
100  *
101  * prototype is void *call_with_mmu_off(void *func, void *data);
102  *
103  * the called function is expected to be of the form
104  *
105  * void *called(void *data); 
106  */
107 _GLOBAL(call_with_mmu_off)
108         mflr    r0                      /* get link, save it on stackframe */
109         std     r0,16(r1)
110         mr      r1,r5                   /* save old stack ptr */
111         ld      r1,PACAEMERGSP(r13)     /* get emerg. stack */
112         subi    r1,r1,STACK_FRAME_OVERHEAD
113         std     r0,16(r1)               /* save link on emerg. stack */
114         std     r5,0(r1)                /* save old stack ptr in backchain */
115         ld      r3,0(r3)                /* get to real function ptr (assume same TOC) */
116         bl      2f                      /* we need LR to return, continue at label 2 */
117
118         ld      r0,16(r1)               /* we return here from the call, get LR and */
119         ld      r1,0(r1)                /* .. old stack ptr */
120         mtspr   SPRN_SRR0,r0            /* and get back to virtual mode with these */
121         mfmsr   r4
122         ori     r4,r4,MSR_IR|MSR_DR
123         mtspr   SPRN_SRR1,r4
124         rfid
125
126 2:      mtspr   SPRN_SRR0,r3            /* coming from above, enter real mode */
127         mr      r3,r4                   /* get parameter */
128         mfmsr   r0
129         ori     r0,r0,MSR_IR|MSR_DR
130         xori    r0,r0,MSR_IR|MSR_DR
131         mtspr   SPRN_SRR1,r0
132         rfid
133
134
135         .section        ".toc","aw"
136 PPC64_CACHES:
137         .tc             ppc64_caches[TC],ppc64_caches
138         .section        ".text"
139
140 /*
141  * Write any modified data cache blocks out to memory
142  * and invalidate the corresponding instruction cache blocks.
143  *
144  * flush_icache_range(unsigned long start, unsigned long stop)
145  *
146  *   flush all bytes from start through stop-1 inclusive
147  */
148
149 _KPROBE(__flush_icache_range)
150
151 /*
152  * Flush the data cache to memory 
153  * 
154  * Different systems have different cache line sizes
155  * and in some cases i-cache and d-cache line sizes differ from
156  * each other.
157  */
158         ld      r10,PPC64_CACHES@toc(r2)
159         lwz     r7,DCACHEL1LINESIZE(r10)/* Get cache line size */
160         addi    r5,r7,-1
161         andc    r6,r3,r5                /* round low to line bdy */
162         subf    r8,r6,r4                /* compute length */
163         add     r8,r8,r5                /* ensure we get enough */
164         lwz     r9,DCACHEL1LOGLINESIZE(r10)     /* Get log-2 of cache line size */
165         srw.    r8,r8,r9                /* compute line count */
166         beqlr                           /* nothing to do? */
167         mtctr   r8
168 1:      dcbst   0,r6
169         add     r6,r6,r7
170         bdnz    1b
171         sync
172
173 /* Now invalidate the instruction cache */
174         
175         lwz     r7,ICACHEL1LINESIZE(r10)        /* Get Icache line size */
176         addi    r5,r7,-1
177         andc    r6,r3,r5                /* round low to line bdy */
178         subf    r8,r6,r4                /* compute length */
179         add     r8,r8,r5
180         lwz     r9,ICACHEL1LOGLINESIZE(r10)     /* Get log-2 of Icache line size */
181         srw.    r8,r8,r9                /* compute line count */
182         beqlr                           /* nothing to do? */
183         mtctr   r8
184 2:      icbi    0,r6
185         add     r6,r6,r7
186         bdnz    2b
187         isync
188         blr
189         .previous .text
190 /*
191  * Like above, but only do the D-cache.
192  *
193  * flush_dcache_range(unsigned long start, unsigned long stop)
194  *
195  *    flush all bytes from start to stop-1 inclusive
196  */
197 _GLOBAL(flush_dcache_range)
198
199 /*
200  * Flush the data cache to memory 
201  * 
202  * Different systems have different cache line sizes
203  */
204         ld      r10,PPC64_CACHES@toc(r2)
205         lwz     r7,DCACHEL1LINESIZE(r10)        /* Get dcache line size */
206         addi    r5,r7,-1
207         andc    r6,r3,r5                /* round low to line bdy */
208         subf    r8,r6,r4                /* compute length */
209         add     r8,r8,r5                /* ensure we get enough */
210         lwz     r9,DCACHEL1LOGLINESIZE(r10)     /* Get log-2 of dcache line size */
211         srw.    r8,r8,r9                /* compute line count */
212         beqlr                           /* nothing to do? */
213         mtctr   r8
214 0:      dcbst   0,r6
215         add     r6,r6,r7
216         bdnz    0b
217         sync
218         blr
219
220 /*
221  * Like above, but works on non-mapped physical addresses.
222  * Use only for non-LPAR setups ! It also assumes real mode
223  * is cacheable. Used for flushing out the DART before using
224  * it as uncacheable memory 
225  *
226  * flush_dcache_phys_range(unsigned long start, unsigned long stop)
227  *
228  *    flush all bytes from start to stop-1 inclusive
229  */
230 _GLOBAL(flush_dcache_phys_range)
231         ld      r10,PPC64_CACHES@toc(r2)
232         lwz     r7,DCACHEL1LINESIZE(r10)        /* Get dcache line size */
233         addi    r5,r7,-1
234         andc    r6,r3,r5                /* round low to line bdy */
235         subf    r8,r6,r4                /* compute length */
236         add     r8,r8,r5                /* ensure we get enough */
237         lwz     r9,DCACHEL1LOGLINESIZE(r10)     /* Get log-2 of dcache line size */
238         srw.    r8,r8,r9                /* compute line count */
239         beqlr                           /* nothing to do? */
240         mfmsr   r5                      /* Disable MMU Data Relocation */
241         ori     r0,r5,MSR_DR
242         xori    r0,r0,MSR_DR
243         sync
244         mtmsr   r0
245         sync
246         isync
247         mtctr   r8
248 0:      dcbst   0,r6
249         add     r6,r6,r7
250         bdnz    0b
251         sync
252         isync
253         mtmsr   r5                      /* Re-enable MMU Data Relocation */
254         sync
255         isync
256         blr
257
258 _GLOBAL(flush_inval_dcache_range)
259         ld      r10,PPC64_CACHES@toc(r2)
260         lwz     r7,DCACHEL1LINESIZE(r10)        /* Get dcache line size */
261         addi    r5,r7,-1
262         andc    r6,r3,r5                /* round low to line bdy */
263         subf    r8,r6,r4                /* compute length */
264         add     r8,r8,r5                /* ensure we get enough */
265         lwz     r9,DCACHEL1LOGLINESIZE(r10)/* Get log-2 of dcache line size */
266         srw.    r8,r8,r9                /* compute line count */
267         beqlr                           /* nothing to do? */
268         sync
269         isync
270         mtctr   r8
271 0:      dcbf    0,r6
272         add     r6,r6,r7
273         bdnz    0b
274         sync
275         isync
276         blr
277
278
279 /*
280  * Flush a particular page from the data cache to RAM.
281  * Note: this is necessary because the instruction cache does *not*
282  * snoop from the data cache.
283  *
284  *      void __flush_dcache_icache(void *page)
285  */
286 _GLOBAL(__flush_dcache_icache)
287 /*
288  * Flush the data cache to memory 
289  * 
290  * Different systems have different cache line sizes
291  */
292
293 /* Flush the dcache */
294         ld      r7,PPC64_CACHES@toc(r2)
295         clrrdi  r3,r3,PAGE_SHIFT                    /* Page align */
296         lwz     r4,DCACHEL1LINESPERPAGE(r7)     /* Get # dcache lines per page */
297         lwz     r5,DCACHEL1LINESIZE(r7)         /* Get dcache line size */
298         mr      r6,r3
299         mtctr   r4
300 0:      dcbst   0,r6
301         add     r6,r6,r5
302         bdnz    0b
303         sync
304
305 /* Now invalidate the icache */ 
306
307         lwz     r4,ICACHEL1LINESPERPAGE(r7)     /* Get # icache lines per page */
308         lwz     r5,ICACHEL1LINESIZE(r7)         /* Get icache line size */
309         mtctr   r4
310 1:      icbi    0,r3
311         add     r3,r3,r5
312         bdnz    1b
313         isync
314         blr
315         
316 /*
317  * I/O string operations
318  *
319  * insb(port, buf, len)
320  * outsb(port, buf, len)
321  * insw(port, buf, len)
322  * outsw(port, buf, len)
323  * insl(port, buf, len)
324  * outsl(port, buf, len)
325  * insw_ns(port, buf, len)
326  * outsw_ns(port, buf, len)
327  * insl_ns(port, buf, len)
328  * outsl_ns(port, buf, len)
329  *
330  * The *_ns versions don't do byte-swapping.
331  */
332 _GLOBAL(_insb)
333         cmpwi   0,r5,0
334         mtctr   r5
335         subi    r4,r4,1
336         blelr-
337 00:     lbz     r5,0(r3)
338         eieio
339         stbu    r5,1(r4)
340         bdnz    00b
341         twi     0,r5,0
342         isync
343         blr
344
345 _GLOBAL(_outsb)
346         cmpwi   0,r5,0
347         mtctr   r5
348         subi    r4,r4,1
349         blelr-
350 00:     lbzu    r5,1(r4)
351         stb     r5,0(r3)
352         bdnz    00b
353         sync
354         blr     
355
356 _GLOBAL(_insw)
357         cmpwi   0,r5,0
358         mtctr   r5
359         subi    r4,r4,2
360         blelr-
361 00:     lhbrx   r5,0,r3
362         eieio
363         sthu    r5,2(r4)
364         bdnz    00b
365         twi     0,r5,0
366         isync
367         blr
368
369 _GLOBAL(_outsw)
370         cmpwi   0,r5,0
371         mtctr   r5
372         subi    r4,r4,2
373         blelr-
374 00:     lhzu    r5,2(r4)
375         sthbrx  r5,0,r3 
376         bdnz    00b
377         sync
378         blr     
379
380 _GLOBAL(_insl)
381         cmpwi   0,r5,0
382         mtctr   r5
383         subi    r4,r4,4
384         blelr-
385 00:     lwbrx   r5,0,r3
386         eieio
387         stwu    r5,4(r4)
388         bdnz    00b
389         twi     0,r5,0
390         isync
391         blr
392
393 _GLOBAL(_outsl)
394         cmpwi   0,r5,0
395         mtctr   r5
396         subi    r4,r4,4
397         blelr-
398 00:     lwzu    r5,4(r4)
399         stwbrx  r5,0,r3
400         bdnz    00b
401         sync
402         blr     
403
404 /* _GLOBAL(ide_insw) now in drivers/ide/ide-iops.c */
405 _GLOBAL(_insw_ns)
406         cmpwi   0,r5,0
407         mtctr   r5
408         subi    r4,r4,2
409         blelr-
410 00:     lhz     r5,0(r3)
411         eieio
412         sthu    r5,2(r4)
413         bdnz    00b
414         twi     0,r5,0
415         isync
416         blr
417
418 /* _GLOBAL(ide_outsw) now in drivers/ide/ide-iops.c */
419 _GLOBAL(_outsw_ns)
420         cmpwi   0,r5,0
421         mtctr   r5
422         subi    r4,r4,2
423         blelr-
424 00:     lhzu    r5,2(r4)
425         sth     r5,0(r3)
426         bdnz    00b
427         sync
428         blr     
429
430 _GLOBAL(_insl_ns)
431         cmpwi   0,r5,0
432         mtctr   r5
433         subi    r4,r4,4
434         blelr-
435 00:     lwz     r5,0(r3)
436         eieio
437         stwu    r5,4(r4)
438         bdnz    00b
439         twi     0,r5,0
440         isync
441         blr
442
443 _GLOBAL(_outsl_ns)
444         cmpwi   0,r5,0
445         mtctr   r5
446         subi    r4,r4,4
447         blelr-
448 00:     lwzu    r5,4(r4)
449         stw     r5,0(r3)
450         bdnz    00b
451         sync
452         blr     
453
454
455 _GLOBAL(cvt_fd)
456         lfd     0,0(r5)         /* load up fpscr value */
457         mtfsf   0xff,0
458         lfs     0,0(r3)
459         stfd    0,0(r4)
460         mffs    0               /* save new fpscr value */
461         stfd    0,0(r5)
462         blr
463
464 _GLOBAL(cvt_df)
465         lfd     0,0(r5)         /* load up fpscr value */
466         mtfsf   0xff,0
467         lfd     0,0(r3)
468         stfs    0,0(r4)
469         mffs    0               /* save new fpscr value */
470         stfd    0,0(r5)
471         blr
472
473 /*
474  * identify_cpu and calls setup_cpu
475  * In:  r3 = base of the cpu_specs array
476  *      r4 = address of cur_cpu_spec
477  *      r5 = relocation offset
478  */
479 _GLOBAL(identify_cpu)
480         mfpvr   r7
481 1:
482         lwz     r8,CPU_SPEC_PVR_MASK(r3)
483         and     r8,r8,r7
484         lwz     r9,CPU_SPEC_PVR_VALUE(r3)
485         cmplw   0,r9,r8
486         beq     1f
487         addi    r3,r3,CPU_SPEC_ENTRY_SIZE
488         b       1b
489 1:
490         add     r0,r3,r5
491         std     r0,0(r4)
492         ld      r4,CPU_SPEC_SETUP(r3)
493         sub     r4,r4,r5
494         ld      r4,0(r4)
495         sub     r4,r4,r5
496         mtctr   r4
497         /* Calling convention for cpu setup is r3=offset, r4=cur_cpu_spec */
498         mr      r4,r3
499         mr      r3,r5
500         bctr
501
502 /*
503  * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
504  * and writes nop's over sections of code that don't apply for this cpu.
505  * r3 = data offset (not changed)
506  */
507 _GLOBAL(do_cpu_ftr_fixups)
508         /* Get CPU 0 features */
509         LOADADDR(r6,cur_cpu_spec)
510         sub     r6,r6,r3
511         ld      r4,0(r6)
512         sub     r4,r4,r3
513         ld      r4,CPU_SPEC_FEATURES(r4)
514         /* Get the fixup table */
515         LOADADDR(r6,__start___ftr_fixup)
516         sub     r6,r6,r3
517         LOADADDR(r7,__stop___ftr_fixup)
518         sub     r7,r7,r3
519         /* Do the fixup */
520 1:      cmpld   r6,r7
521         bgelr
522         addi    r6,r6,32
523         ld      r8,-32(r6)      /* mask */
524         and     r8,r8,r4
525         ld      r9,-24(r6)      /* value */
526         cmpld   r8,r9
527         beq     1b
528         ld      r8,-16(r6)      /* section begin */
529         ld      r9,-8(r6)       /* section end */
530         subf.   r9,r8,r9
531         beq     1b
532         /* write nops over the section of code */
533         /* todo: if large section, add a branch at the start of it */
534         srwi    r9,r9,2
535         mtctr   r9
536         sub     r8,r8,r3
537         lis     r0,0x60000000@h /* nop */
538 3:      stw     r0,0(r8)
539         andi.   r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
540         beq     2f
541         dcbst   0,r8            /* suboptimal, but simpler */
542         sync
543         icbi    0,r8
544 2:      addi    r8,r8,4
545         bdnz    3b
546         sync                    /* additional sync needed on g4 */
547         isync
548         b       1b
549
550 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
551 /*
552  * Do an IO access in real mode
553  */
554 _GLOBAL(real_readb)
555         mfmsr   r7
556         ori     r0,r7,MSR_DR
557         xori    r0,r0,MSR_DR
558         sync
559         mtmsrd  r0
560         sync
561         isync
562         mfspr   r6,SPRN_HID4
563         rldicl  r5,r6,32,0
564         ori     r5,r5,0x100
565         rldicl  r5,r5,32,0
566         sync
567         mtspr   SPRN_HID4,r5
568         isync
569         slbia
570         isync
571         lbz     r3,0(r3)
572         sync
573         mtspr   SPRN_HID4,r6
574         isync
575         slbia
576         isync
577         mtmsrd  r7
578         sync
579         isync
580         blr
581
582         /*
583  * Do an IO access in real mode
584  */
585 _GLOBAL(real_writeb)
586         mfmsr   r7
587         ori     r0,r7,MSR_DR
588         xori    r0,r0,MSR_DR
589         sync
590         mtmsrd  r0
591         sync
592         isync
593         mfspr   r6,SPRN_HID4
594         rldicl  r5,r6,32,0
595         ori     r5,r5,0x100
596         rldicl  r5,r5,32,0
597         sync
598         mtspr   SPRN_HID4,r5
599         isync
600         slbia
601         isync
602         stb     r3,0(r4)
603         sync
604         mtspr   SPRN_HID4,r6
605         isync
606         slbia
607         isync
608         mtmsrd  r7
609         sync
610         isync
611         blr
612 #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
613
614 /*
615  * Create a kernel thread
616  *   kernel_thread(fn, arg, flags)
617  */
618 _GLOBAL(kernel_thread)
619         std     r29,-24(r1)
620         std     r30,-16(r1)
621         stdu    r1,-STACK_FRAME_OVERHEAD(r1)
622         mr      r29,r3
623         mr      r30,r4
624         ori     r3,r5,CLONE_VM  /* flags */
625         oris    r3,r3,(CLONE_UNTRACED>>16)
626         li      r4,0            /* new sp (unused) */
627         li      r0,__NR_clone
628         sc
629         cmpdi   0,r3,0          /* parent or child? */
630         bne     1f              /* return if parent */
631         li      r0,0
632         stdu    r0,-STACK_FRAME_OVERHEAD(r1)
633         ld      r2,8(r29)
634         ld      r29,0(r29)
635         mtlr    r29              /* fn addr in lr */
636         mr      r3,r30          /* load arg and call fn */
637         blrl
638         li      r0,__NR_exit    /* exit after child exits */
639         li      r3,0
640         sc
641 1:      addi    r1,r1,STACK_FRAME_OVERHEAD      
642         ld      r29,-24(r1)
643         ld      r30,-16(r1)
644         blr
645
646 /*
647  * disable_kernel_fp()
648  * Disable the FPU.
649  */
650 _GLOBAL(disable_kernel_fp)
651         mfmsr   r3
652         rldicl  r0,r3,(63-MSR_FP_LG),1
653         rldicl  r3,r0,(MSR_FP_LG+1),0
654         mtmsrd  r3                      /* disable use of fpu now */
655         isync
656         blr
657
658 /*
659  * giveup_fpu(tsk)
660  * Disable FP for the task given as the argument,
661  * and save the floating-point registers in its thread_struct.
662  * Enables the FPU for use in the kernel on return.
663  */
664 _GLOBAL(giveup_fpu)
665         mfmsr   r5
666         ori     r5,r5,MSR_FP
667         mtmsrd  r5                      /* enable use of fpu now */
668         isync
669         cmpdi   0,r3,0
670         beqlr-                          /* if no previous owner, done */
671         addi    r3,r3,THREAD            /* want THREAD of task */
672         ld      r5,PT_REGS(r3)
673         cmpdi   0,r5,0
674         SAVE_32FPRS(0, r3)
675         mffs    fr0
676         stfd    fr0,THREAD_FPSCR(r3)
677         beq     1f
678         ld      r4,_MSR-STACK_FRAME_OVERHEAD(r5)
679         li      r3,MSR_FP|MSR_FE0|MSR_FE1
680         andc    r4,r4,r3                /* disable FP for previous task */
681         std     r4,_MSR-STACK_FRAME_OVERHEAD(r5)
682 1:
683 #ifndef CONFIG_SMP
684         li      r5,0
685         ld      r4,last_task_used_math@got(r2)
686         std     r5,0(r4)
687 #endif /* CONFIG_SMP */
688         blr
689
690 #ifdef CONFIG_ALTIVEC
691
692 #if 0 /* this has no callers for now */
693 /*
694  * disable_kernel_altivec()
695  * Disable the VMX.
696  */
697 _GLOBAL(disable_kernel_altivec)
698         mfmsr   r3
699         rldicl  r0,r3,(63-MSR_VEC_LG),1
700         rldicl  r3,r0,(MSR_VEC_LG+1),0
701         mtmsrd  r3                      /* disable use of VMX now */
702         isync
703         blr
704 #endif /* 0 */
705
706 /*
707  * giveup_altivec(tsk)
708  * Disable VMX for the task given as the argument,
709  * and save the vector registers in its thread_struct.
710  * Enables the VMX for use in the kernel on return.
711  */
712 _GLOBAL(giveup_altivec)
713         mfmsr   r5
714         oris    r5,r5,MSR_VEC@h
715         mtmsrd  r5                      /* enable use of VMX now */
716         isync
717         cmpdi   0,r3,0
718         beqlr-                          /* if no previous owner, done */
719         addi    r3,r3,THREAD            /* want THREAD of task */
720         ld      r5,PT_REGS(r3)
721         cmpdi   0,r5,0
722         SAVE_32VRS(0,r4,r3)
723         mfvscr  vr0
724         li      r4,THREAD_VSCR
725         stvx    vr0,r4,r3
726         beq     1f
727         ld      r4,_MSR-STACK_FRAME_OVERHEAD(r5)
728         lis     r3,MSR_VEC@h
729         andc    r4,r4,r3                /* disable FP for previous task */
730         std     r4,_MSR-STACK_FRAME_OVERHEAD(r5)
731 1:
732 #ifndef CONFIG_SMP
733         li      r5,0
734         ld      r4,last_task_used_altivec@got(r2)
735         std     r5,0(r4)
736 #endif /* CONFIG_SMP */
737         blr
738
739 #endif /* CONFIG_ALTIVEC */
740
741 _GLOBAL(__setup_cpu_power3)
742         blr
743
744 _GLOBAL(execve)
745         li      r0,__NR_execve
746         sc
747         bnslr
748         neg     r3,r3
749         blr
750
751 /* kexec_wait(phys_cpu)
752  *
753  * wait for the flag to change, indicating this kernel is going away but
754  * the slave code for the next one is at addresses 0 to 100.
755  *
756  * This is used by all slaves.
757  *
758  * Physical (hardware) cpu id should be in r3.
759  */
760 _GLOBAL(kexec_wait)
761         bl      1f
762 1:      mflr    r5
763         addi    r5,r5,kexec_flag-1b
764
765 99:     HMT_LOW
766 #ifdef CONFIG_KEXEC             /* use no memory without kexec */
767         lwz     r4,0(r5)
768         cmpwi   0,r4,0
769         bnea    0x60
770 #endif
771         b       99b
772
773 /* this can be in text because we won't change it until we are
774  * running in real anyways
775  */
776 kexec_flag:
777         .long   0
778
779
780 #ifdef CONFIG_KEXEC
781
782 /* kexec_smp_wait(void)
783  *
784  * call with interrupts off
785  * note: this is a terminal routine, it does not save lr
786  *
787  * get phys id from paca
788  * set paca id to -1 to say we got here
789  * switch to real mode
790  * join other cpus in kexec_wait(phys_id)
791  */
792 _GLOBAL(kexec_smp_wait)
793         lhz     r3,PACAHWCPUID(r13)
794         li      r4,-1
795         sth     r4,PACAHWCPUID(r13)     /* let others know we left */
796         bl      real_mode
797         b       .kexec_wait
798
799 /*
800  * switch to real mode (turn mmu off)
801  * we use the early kernel trick that the hardware ignores bits
802  * 0 and 1 (big endian) of the effective address in real mode
803  *
804  * don't overwrite r3 here, it is live for kexec_wait above.
805  */
806 real_mode:      /* assume normal blr return */
807 1:      li      r9,MSR_RI
808         li      r10,MSR_DR|MSR_IR
809         mflr    r11             /* return address to SRR0 */
810         mfmsr   r12
811         andc    r9,r12,r9
812         andc    r10,r12,r10
813
814         mtmsrd  r9,1
815         mtspr   SPRN_SRR1,r10
816         mtspr   SPRN_SRR0,r11
817         rfid
818
819
820 /*
821  * kexec_sequence(newstack, start, image, control, clear_all())
822  *
823  * does the grungy work with stack switching and real mode switches
824  * also does simple calls to other code
825  */
826
827 _GLOBAL(kexec_sequence)
828         mflr    r0
829         std     r0,16(r1)
830
831         /* switch stacks to newstack -- &kexec_stack.stack */
832         stdu    r1,THREAD_SIZE-112(r3)
833         mr      r1,r3
834
835         li      r0,0
836         std     r0,16(r1)
837
838         /* save regs for local vars on new stack.
839          * yes, we won't go back, but ...
840          */
841         std     r31,-8(r1)
842         std     r30,-16(r1)
843         std     r29,-24(r1)
844         std     r28,-32(r1)
845         std     r27,-40(r1)
846         std     r26,-48(r1)
847         std     r25,-56(r1)
848
849         stdu    r1,-112-64(r1)
850
851         /* save args into preserved regs */
852         mr      r31,r3                  /* newstack (both) */
853         mr      r30,r4                  /* start (real) */
854         mr      r29,r5                  /* image (virt) */
855         mr      r28,r6                  /* control, unused */
856         mr      r27,r7                  /* clear_all() fn desc */
857         mr      r26,r8                  /* spare */
858         lhz     r25,PACAHWCPUID(r13)    /* get our phys cpu from paca */
859
860         /* disable interrupts, we are overwriting kernel data next */
861         mfmsr   r3
862         rlwinm  r3,r3,0,17,15
863         mtmsrd  r3,1
864
865         /* copy dest pages, flush whole dest image */
866         mr      r3,r29
867         bl      .kexec_copy_flush       /* (image) */
868
869         /* turn off mmu */
870         bl      real_mode
871
872         /* clear out hardware hash page table and tlb */
873         ld      r5,0(r27)               /* deref function descriptor */
874         mtctr   r5
875         bctrl                           /* ppc_md.hash_clear_all(void); */
876
877 /*
878  *   kexec image calling is:
879  *      the first 0x100 bytes of the entry point are copied to 0
880  *
881  *      all slaves branch to slave = 0x60 (absolute)
882  *              slave(phys_cpu_id);
883  *
884  *      master goes to start = entry point
885  *              start(phys_cpu_id, start, 0);
886  *
887  *
888  *   a wrapper is needed to call existing kernels, here is an approximate
889  *   description of one method:
890  *
891  * v2: (2.6.10)
892  *   start will be near the boot_block (maybe 0x100 bytes before it?)
893  *   it will have a 0x60, which will b to boot_block, where it will wait
894  *   and 0 will store phys into struct boot-block and load r3 from there,
895  *   copy kernel 0-0x100 and tell slaves to back down to 0x60 again
896  *
897  * v1: (2.6.9)
898  *    boot block will have all cpus scanning device tree to see if they
899  *    are the boot cpu ?????
900  *    other device tree differences (prop sizes, va vs pa, etc)...
901  */
902
903         /* copy  0x100 bytes starting at start to 0 */
904         li      r3,0
905         mr      r4,r30
906         li      r5,0x100
907         li      r6,0
908         bl      .copy_and_flush /* (dest, src, copy limit, start offset) */
909 1:      /* assume normal blr return */
910
911         /* release other cpus to the new kernel secondary start at 0x60 */
912         mflr    r5
913         li      r6,1
914         stw     r6,kexec_flag-1b(5)
915         mr      r3,r25  # my phys cpu
916         mr      r4,r30  # start, aka phys mem offset
917         mtlr    4
918         li      r5,0
919         blr     /* image->start(physid, image->start, 0); */
920 #endif /* CONFIG_KEXEC */
921
922 /* Why isn't this a) automatic, b) written in 'C'? */   
923         .balign 8
924 _GLOBAL(sys_call_table32)
925         .llong .sys_restart_syscall     /* 0 */
926         .llong .sys_exit
927         .llong .ppc_fork
928         .llong .sys_read
929         .llong .sys_write
930         .llong .compat_sys_open         /* 5 */
931         .llong .sys_close
932         .llong .compat_sys_waitpid
933         .llong .compat_sys_creat
934         .llong .sys_link
935         .llong .sys_unlink              /* 10 */
936         .llong .compat_sys_execve
937         .llong .sys_chdir
938         .llong .compat_sys_time
939         .llong .sys_mknod
940         .llong .sys_chmod               /* 15 */
941         .llong .sys_lchown
942         .llong .sys_ni_syscall          /* old break syscall */
943         .llong .sys_ni_syscall          /* old stat syscall */
944         .llong .ppc32_lseek
945         .llong .sys_getpid              /* 20 */
946         .llong .compat_sys_mount
947         .llong .sys_oldumount
948         .llong .sys_setuid
949         .llong .sys_getuid
950         .llong .compat_sys_stime        /* 25 */
951         .llong .compat_sys_ptrace
952         .llong .sys_alarm
953         .llong .sys_ni_syscall          /* old fstat syscall */
954         .llong .compat_sys_pause
955         .llong .compat_sys_utime        /* 30 */
956         .llong .sys_ni_syscall          /* old stty syscall */
957         .llong .sys_ni_syscall          /* old gtty syscall */
958         .llong .compat_sys_access
959         .llong .compat_sys_nice
960         .llong .sys_ni_syscall          /* 35 - old ftime syscall */
961         .llong .sys_sync
962         .llong .compat_sys_kill
963         .llong .sys_rename
964         .llong .compat_sys_mkdir
965         .llong .sys_rmdir               /* 40 */
966         .llong .sys_dup
967         .llong .sys_pipe
968         .llong .compat_sys_times
969         .llong .sys_ni_syscall          /* old prof syscall */
970         .llong .sys_brk                 /* 45 */
971         .llong .sys_setgid
972         .llong .sys_getgid
973         .llong .sys_signal
974         .llong .sys_geteuid
975         .llong .sys_getegid             /* 50 */
976         .llong .sys_acct
977         .llong .sys_umount
978         .llong .sys_ni_syscall          /* old lock syscall */
979         .llong .compat_sys_ioctl
980         .llong .compat_sys_fcntl                /* 55 */
981         .llong .sys_ni_syscall          /* old mpx syscall */
982         .llong .compat_sys_setpgid
983         .llong .sys_ni_syscall          /* old ulimit syscall */
984         .llong .sys_olduname
985         .llong .compat_sys_umask        /* 60 */
986         .llong .sys_chroot
987         .llong .sys_ustat
988         .llong .sys_dup2
989         .llong .sys_getppid
990         .llong .sys_getpgrp             /* 65 */
991         .llong .sys_setsid
992         .llong .compat_sys_sigaction
993         .llong .sys_sgetmask
994         .llong .compat_sys_ssetmask
995         .llong .sys_setreuid            /* 70 */
996         .llong .sys_setregid
997         .llong .ppc32_sigsuspend
998         .llong .compat_sys_sigpending
999         .llong .compat_sys_sethostname
1000         .llong .compat_sys_setrlimit    /* 75 */
1001         .llong .compat_sys_old_getrlimit
1002         .llong .compat_sys_getrusage
1003         .llong .compat_sys_gettimeofday
1004         .llong .compat_sys_settimeofday
1005         .llong .compat_sys_getgroups    /* 80 */
1006         .llong .compat_sys_setgroups
1007         .llong .sys_ni_syscall          /* old select syscall */
1008         .llong .sys_symlink
1009         .llong .sys_ni_syscall          /* old lstat syscall */
1010         .llong .compat_sys_readlink     /* 85 */
1011         .llong .sys_uselib
1012         .llong .sys_swapon
1013         .llong .sys_reboot
1014         .llong .old32_readdir
1015         .llong .sys_mmap                /* 90 */
1016         .llong .sys_munmap
1017         .llong .sys_truncate
1018         .llong .sys_ftruncate
1019         .llong .sys_fchmod
1020         .llong .sys_fchown              /* 95 */
1021         .llong .compat_sys_getpriority
1022         .llong .compat_sys_setpriority
1023         .llong .sys_ni_syscall          /* old profil syscall */
1024         .llong .compat_sys_statfs
1025         .llong .compat_sys_fstatfs      /* 100 */
1026         .llong .sys_ni_syscall          /* old ioperm syscall */
1027         .llong .compat_sys_socketcall
1028         .llong .compat_sys_syslog
1029         .llong .compat_sys_setitimer
1030         .llong .compat_sys_getitimer    /* 105 */
1031         .llong .compat_sys_newstat
1032         .llong .compat_sys_newlstat
1033         .llong .compat_sys_newfstat
1034         .llong .sys_uname
1035         .llong .sys_ni_syscall          /* 110 old iopl syscall */
1036         .llong .sys_vhangup
1037         .llong .sys_ni_syscall          /* old idle syscall */
1038         .llong .sys_ni_syscall          /* old vm86 syscall */
1039         .llong .compat_sys_wait4
1040         .llong .sys_swapoff             /* 115 */
1041         .llong .compat_sys_sysinfo
1042         .llong .sys32_ipc
1043         .llong .sys_fsync
1044         .llong .ppc32_sigreturn
1045         .llong .ppc_clone               /* 120 */
1046         .llong .compat_sys_setdomainname
1047         .llong .ppc_newuname
1048         .llong .sys_ni_syscall          /* old modify_ldt syscall */
1049         .llong .compat_sys_adjtimex
1050         .llong .sys_mprotect            /* 125 */
1051         .llong .compat_sys_sigprocmask
1052         .llong .sys_ni_syscall          /* old create_module syscall */
1053         .llong .sys_init_module
1054         .llong .sys_delete_module
1055         .llong .sys_ni_syscall          /* 130 old get_kernel_syms syscall */
1056         .llong .sys_quotactl
1057         .llong .compat_sys_getpgid
1058         .llong .sys_fchdir
1059         .llong .sys_bdflush
1060         .llong .compat_sys_sysfs        /* 135 */
1061         .llong .ppc64_personality
1062         .llong .sys_ni_syscall          /* for afs_syscall */
1063         .llong .sys_setfsuid
1064         .llong .sys_setfsgid
1065         .llong .sys_llseek              /* 140 */
1066         .llong .compat_sys_getdents
1067         .llong .ppc32_select
1068         .llong .sys_flock
1069         .llong .sys_msync
1070         .llong .compat_sys_readv        /* 145 */
1071         .llong .compat_sys_writev
1072         .llong .compat_sys_getsid
1073         .llong .sys_fdatasync
1074         .llong .compat_sys_sysctl
1075         .llong .sys_mlock               /* 150 */
1076         .llong .sys_munlock
1077         .llong .sys_mlockall
1078         .llong .sys_munlockall
1079         .llong .compat_sys_sched_setparam
1080         .llong .compat_sys_sched_getparam       /* 155 */
1081         .llong .compat_sys_sched_setscheduler
1082         .llong .compat_sys_sched_getscheduler
1083         .llong .sys_sched_yield
1084         .llong .compat_sys_sched_get_priority_max
1085         .llong .compat_sys_sched_get_priority_min  /* 160 */
1086         .llong .compat_sys_sched_rr_get_interval
1087         .llong .compat_sys_nanosleep
1088         .llong .sys_mremap
1089         .llong .sys_setresuid
1090         .llong .sys_getresuid           /* 165 */
1091         .llong .sys_ni_syscall          /* old query_module syscall */
1092         .llong .sys_poll
1093         .llong .compat_sys_nfsservctl
1094         .llong .sys_setresgid
1095         .llong .sys_getresgid           /* 170 */
1096         .llong .compat_sys_prctl
1097         .llong .ppc32_rt_sigreturn
1098         .llong .compat_sys_rt_sigaction
1099         .llong .compat_sys_rt_sigprocmask
1100         .llong .compat_sys_rt_sigpending     /* 175 */
1101         .llong .compat_sys_rt_sigtimedwait
1102         .llong .compat_sys_rt_sigqueueinfo
1103         .llong .ppc32_rt_sigsuspend
1104         .llong .compat_sys_pread64
1105         .llong .compat_sys_pwrite64     /* 180 */
1106         .llong .sys_chown
1107         .llong .sys_getcwd
1108         .llong .sys_capget
1109         .llong .sys_capset
1110         .llong .compat_sys_sigaltstack  /* 185 */
1111         .llong .compat_sys_sendfile
1112         .llong .sys_ni_syscall          /* reserved for streams1 */
1113         .llong .sys_ni_syscall          /* reserved for streams2 */
1114         .llong .ppc_vfork
1115         .llong .compat_sys_getrlimit            /* 190 */
1116         .llong .compat_sys_readahead
1117         .llong .compat_sys_mmap2
1118         .llong .compat_sys_truncate64
1119         .llong .compat_sys_ftruncate64
1120         .llong .sys_stat64              /* 195 */
1121         .llong .sys_lstat64
1122         .llong .sys_fstat64
1123         .llong .compat_sys_pciconfig_read
1124         .llong .compat_sys_pciconfig_write
1125         .llong .compat_sys_pciconfig_iobase     /* 200 - pciconfig_iobase */
1126         .llong .sys_ni_syscall          /* reserved for MacOnLinux */
1127         .llong .sys_getdents64
1128         .llong .sys_pivot_root
1129         .llong .compat_sys_fcntl64
1130         .llong .sys_madvise             /* 205 */
1131         .llong .sys_mincore
1132         .llong .sys_gettid
1133         .llong .sys_tkill
1134         .llong .sys_setxattr
1135         .llong .sys_lsetxattr           /* 210 */
1136         .llong .sys_fsetxattr
1137         .llong .sys_getxattr
1138         .llong .sys_lgetxattr
1139         .llong .sys_fgetxattr
1140         .llong .sys_listxattr           /* 215 */
1141         .llong .sys_llistxattr
1142         .llong .sys_flistxattr
1143         .llong .sys_removexattr
1144         .llong .sys_lremovexattr
1145         .llong .sys_fremovexattr        /* 220 */
1146         .llong .compat_sys_futex
1147         .llong .compat_sys_sched_setaffinity
1148         .llong .compat_sys_sched_getaffinity
1149         .llong .sys_ni_syscall
1150         .llong .sys_ni_syscall          /* 225 - reserved for tux */
1151         .llong .compat_sys_sendfile64
1152         .llong .compat_sys_io_setup
1153         .llong .sys_io_destroy
1154         .llong .compat_sys_io_getevents
1155         .llong .compat_sys_io_submit
1156         .llong .sys_io_cancel
1157         .llong .sys_set_tid_address
1158         .llong .ppc32_fadvise64
1159         .llong .sys_exit_group
1160         .llong .ppc32_lookup_dcookie    /* 235 */
1161         .llong .sys_epoll_create
1162         .llong .sys_epoll_ctl
1163         .llong .sys_epoll_wait
1164         .llong .sys_remap_file_pages
1165         .llong .ppc32_timer_create      /* 240 */
1166         .llong .compat_sys_timer_settime
1167         .llong .compat_sys_timer_gettime
1168         .llong .sys_timer_getoverrun
1169         .llong .sys_timer_delete
1170         .llong .compat_sys_clock_settime/* 245 */
1171         .llong .compat_sys_clock_gettime
1172         .llong .compat_sys_clock_getres
1173         .llong .compat_sys_clock_nanosleep
1174         .llong .ppc32_swapcontext
1175         .llong .compat_sys_tgkill       /* 250 */
1176         .llong .compat_sys_utimes
1177         .llong .compat_sys_statfs64
1178         .llong .compat_sys_fstatfs64
1179         .llong .ppc_fadvise64_64        /* 32bit only fadvise64_64 */
1180         .llong .ppc_rtas                /* 255 */
1181         .llong .sys_ni_syscall          /* 256 reserved for sys_debug_setcontext */
1182         .llong .sys_ni_syscall          /* 257 reserved for vserver */
1183         .llong .sys_ni_syscall          /* 258 reserved for new sys_remap_file_pages */
1184         .llong .compat_sys_mbind
1185         .llong .compat_sys_get_mempolicy        /* 260 */
1186         .llong .compat_sys_set_mempolicy
1187         .llong .compat_sys_mq_open
1188         .llong .sys_mq_unlink
1189         .llong .compat_sys_mq_timedsend
1190         .llong .compat_sys_mq_timedreceive /* 265 */
1191         .llong .compat_sys_mq_notify
1192         .llong .compat_sys_mq_getsetattr
1193         .llong .compat_sys_kexec_load
1194         .llong .compat_sys_add_key
1195         .llong .compat_sys_request_key  /* 270 */
1196         .llong .compat_sys_keyctl
1197         .llong .compat_sys_waitid
1198         .llong .compat_sys_ioprio_set
1199         .llong .compat_sys_ioprio_get
1200         .llong .sys_inotify_init        /* 275 */
1201         .llong .sys_inotify_add_watch
1202         .llong .sys_inotify_rm_watch
1203
1204         .balign 8
1205 _GLOBAL(sys_call_table)
1206         .llong .sys_restart_syscall     /* 0 */
1207         .llong .sys_exit
1208         .llong .ppc_fork
1209         .llong .sys_read
1210         .llong .sys_write
1211         .llong .sys_open                /* 5 */
1212         .llong .sys_close
1213         .llong .sys_waitpid
1214         .llong .sys_creat
1215         .llong .sys_link
1216         .llong .sys_unlink              /* 10 */
1217         .llong .sys_execve
1218         .llong .sys_chdir
1219         .llong .sys64_time
1220         .llong .sys_mknod
1221         .llong .sys_chmod               /* 15 */
1222         .llong .sys_lchown
1223         .llong .sys_ni_syscall          /* old break syscall */
1224         .llong .sys_ni_syscall          /* old stat syscall */
1225         .llong .sys_lseek
1226         .llong .sys_getpid              /* 20 */
1227         .llong .sys_mount
1228         .llong .sys_ni_syscall          /* old umount syscall */
1229         .llong .sys_setuid
1230         .llong .sys_getuid
1231         .llong .sys_stime               /* 25 */
1232         .llong .sys_ptrace
1233         .llong .sys_alarm
1234         .llong .sys_ni_syscall          /* old fstat syscall */
1235         .llong .sys_pause
1236         .llong .sys_utime               /* 30 */
1237         .llong .sys_ni_syscall          /* old stty syscall */
1238         .llong .sys_ni_syscall          /* old gtty syscall */
1239         .llong .sys_access
1240         .llong .sys_nice
1241         .llong .sys_ni_syscall          /* 35 - old ftime syscall */
1242         .llong .sys_sync
1243         .llong .sys_kill
1244         .llong .sys_rename
1245         .llong .sys_mkdir
1246         .llong .sys_rmdir               /* 40 */
1247         .llong .sys_dup
1248         .llong .sys_pipe
1249         .llong .sys_times
1250         .llong .sys_ni_syscall          /* old prof syscall */
1251         .llong .sys_brk                 /* 45 */
1252         .llong .sys_setgid
1253         .llong .sys_getgid
1254         .llong .sys_signal
1255         .llong .sys_geteuid
1256         .llong .sys_getegid             /* 50 */
1257         .llong .sys_acct
1258         .llong .sys_umount
1259         .llong .sys_ni_syscall          /* old lock syscall */
1260         .llong .sys_ioctl
1261         .llong .sys_fcntl               /* 55 */
1262         .llong .sys_ni_syscall          /* old mpx syscall */
1263         .llong .sys_setpgid
1264         .llong .sys_ni_syscall          /* old ulimit syscall */
1265         .llong .sys_ni_syscall          /* old uname syscall */
1266         .llong .sys_umask               /* 60 */
1267         .llong .sys_chroot
1268         .llong .sys_ustat
1269         .llong .sys_dup2
1270         .llong .sys_getppid
1271         .llong .sys_getpgrp             /* 65 */
1272         .llong .sys_setsid
1273         .llong .sys_ni_syscall
1274         .llong .sys_sgetmask
1275         .llong .sys_ssetmask
1276         .llong .sys_setreuid            /* 70 */
1277         .llong .sys_setregid
1278         .llong .sys_ni_syscall
1279         .llong .sys_ni_syscall
1280         .llong .sys_sethostname
1281         .llong .sys_setrlimit           /* 75 */
1282         .llong .sys_ni_syscall          /* old getrlimit syscall */
1283         .llong .sys_getrusage
1284         .llong .sys_gettimeofday
1285         .llong .sys_settimeofday
1286         .llong .sys_getgroups           /* 80 */
1287         .llong .sys_setgroups
1288         .llong .sys_ni_syscall          /* old select syscall */
1289         .llong .sys_symlink
1290         .llong .sys_ni_syscall          /* old lstat syscall */
1291         .llong .sys_readlink            /* 85 */
1292         .llong .sys_uselib
1293         .llong .sys_swapon
1294         .llong .sys_reboot
1295         .llong .sys_ni_syscall          /* old readdir syscall */
1296         .llong .sys_mmap                /* 90 */
1297         .llong .sys_munmap
1298         .llong .sys_truncate
1299         .llong .sys_ftruncate
1300         .llong .sys_fchmod
1301         .llong .sys_fchown              /* 95 */
1302         .llong .sys_getpriority
1303         .llong .sys_setpriority
1304         .llong .sys_ni_syscall          /* old profil syscall holder */
1305         .llong .sys_statfs
1306         .llong .sys_fstatfs             /* 100 */
1307         .llong .sys_ni_syscall          /* old ioperm syscall */
1308         .llong .sys_socketcall
1309         .llong .sys_syslog
1310         .llong .sys_setitimer
1311         .llong .sys_getitimer           /* 105 */
1312         .llong .sys_newstat
1313         .llong .sys_newlstat
1314         .llong .sys_newfstat
1315         .llong .sys_ni_syscall          /* old uname syscall */
1316         .llong .sys_ni_syscall          /* 110 old iopl syscall */
1317         .llong .sys_vhangup
1318         .llong .sys_ni_syscall          /* old idle syscall */
1319         .llong .sys_ni_syscall          /* old vm86 syscall */
1320         .llong .sys_wait4
1321         .llong .sys_swapoff             /* 115 */
1322         .llong .sys_sysinfo
1323         .llong .sys_ipc
1324         .llong .sys_fsync
1325         .llong .sys_ni_syscall
1326         .llong .ppc_clone               /* 120 */
1327         .llong .sys_setdomainname
1328         .llong .ppc_newuname
1329         .llong .sys_ni_syscall          /* old modify_ldt syscall */
1330         .llong .sys_adjtimex
1331         .llong .sys_mprotect            /* 125 */
1332         .llong .sys_ni_syscall
1333         .llong .sys_ni_syscall          /* old create_module syscall */
1334         .llong .sys_init_module
1335         .llong .sys_delete_module
1336         .llong .sys_ni_syscall          /* 130 old get_kernel_syms syscall */
1337         .llong .sys_quotactl
1338         .llong .sys_getpgid
1339         .llong .sys_fchdir
1340         .llong .sys_bdflush
1341         .llong .sys_sysfs               /* 135 */
1342         .llong .ppc64_personality
1343         .llong .sys_ni_syscall          /* for afs_syscall */
1344         .llong .sys_setfsuid
1345         .llong .sys_setfsgid
1346         .llong .sys_llseek              /* 140 */
1347         .llong .sys_getdents
1348         .llong .sys_select
1349         .llong .sys_flock
1350         .llong .sys_msync
1351         .llong .sys_readv               /* 145 */
1352         .llong .sys_writev
1353         .llong .sys_getsid
1354         .llong .sys_fdatasync
1355         .llong .sys_sysctl
1356         .llong .sys_mlock               /* 150 */
1357         .llong .sys_munlock
1358         .llong .sys_mlockall
1359         .llong .sys_munlockall
1360         .llong .sys_sched_setparam
1361         .llong .sys_sched_getparam      /* 155 */
1362         .llong .sys_sched_setscheduler
1363         .llong .sys_sched_getscheduler
1364         .llong .sys_sched_yield
1365         .llong .sys_sched_get_priority_max
1366         .llong .sys_sched_get_priority_min  /* 160 */
1367         .llong .sys_sched_rr_get_interval
1368         .llong .sys_nanosleep
1369         .llong .sys_mremap
1370         .llong .sys_setresuid
1371         .llong .sys_getresuid           /* 165 */
1372         .llong .sys_ni_syscall          /* old query_module syscall */
1373         .llong .sys_poll
1374         .llong .sys_nfsservctl
1375         .llong .sys_setresgid
1376         .llong .sys_getresgid           /* 170 */
1377         .llong .sys_prctl
1378         .llong .ppc64_rt_sigreturn
1379         .llong .sys_rt_sigaction
1380         .llong .sys_rt_sigprocmask      
1381         .llong .sys_rt_sigpending       /* 175 */
1382         .llong .sys_rt_sigtimedwait
1383         .llong .sys_rt_sigqueueinfo
1384         .llong .ppc64_rt_sigsuspend
1385         .llong .sys_pread64
1386         .llong .sys_pwrite64            /* 180 */
1387         .llong .sys_chown
1388         .llong .sys_getcwd
1389         .llong .sys_capget
1390         .llong .sys_capset
1391         .llong .sys_sigaltstack         /* 185 */
1392         .llong .sys_sendfile64
1393         .llong .sys_ni_syscall          /* reserved for streams1 */
1394         .llong .sys_ni_syscall          /* reserved for streams2 */
1395         .llong .ppc_vfork
1396         .llong .sys_getrlimit           /* 190 */
1397         .llong .sys_readahead
1398         .llong .sys_ni_syscall          /* 32bit only mmap2 */
1399         .llong .sys_ni_syscall          /* 32bit only truncate64 */
1400         .llong .sys_ni_syscall          /* 32bit only ftruncate64 */
1401         .llong .sys_ni_syscall          /* 195 - 32bit only stat64 */
1402         .llong .sys_ni_syscall          /* 32bit only lstat64 */
1403         .llong .sys_ni_syscall          /* 32bit only fstat64 */
1404         .llong .sys_pciconfig_read
1405         .llong .sys_pciconfig_write
1406         .llong .sys_pciconfig_iobase    /* 200 - pciconfig_iobase */
1407         .llong .sys_ni_syscall          /* reserved for MacOnLinux */
1408         .llong .sys_getdents64
1409         .llong .sys_pivot_root
1410         .llong .sys_ni_syscall          /* 32bit only fcntl64 */
1411         .llong .sys_madvise             /* 205 */
1412         .llong .sys_mincore
1413         .llong .sys_gettid
1414         .llong .sys_tkill
1415         .llong .sys_setxattr
1416         .llong .sys_lsetxattr           /* 210 */
1417         .llong .sys_fsetxattr
1418         .llong .sys_getxattr
1419         .llong .sys_lgetxattr
1420         .llong .sys_fgetxattr
1421         .llong .sys_listxattr           /* 215 */
1422         .llong .sys_llistxattr
1423         .llong .sys_flistxattr
1424         .llong .sys_removexattr
1425         .llong .sys_lremovexattr
1426         .llong .sys_fremovexattr        /* 220 */
1427         .llong .sys_futex
1428         .llong .sys_sched_setaffinity
1429         .llong .sys_sched_getaffinity
1430         .llong .sys_ni_syscall
1431         .llong .sys_ni_syscall          /* 225 - reserved for tux */
1432         .llong .sys_ni_syscall          /* 32bit only sendfile64 */
1433         .llong .sys_io_setup
1434         .llong .sys_io_destroy
1435         .llong .sys_io_getevents
1436         .llong .sys_io_submit           /* 230 */
1437         .llong .sys_io_cancel
1438         .llong .sys_set_tid_address
1439         .llong .sys_fadvise64
1440         .llong .sys_exit_group
1441         .llong .sys_lookup_dcookie      /* 235 */
1442         .llong .sys_epoll_create
1443         .llong .sys_epoll_ctl
1444         .llong .sys_epoll_wait
1445         .llong .sys_remap_file_pages
1446         .llong .sys_timer_create        /* 240 */
1447         .llong .sys_timer_settime
1448         .llong .sys_timer_gettime
1449         .llong .sys_timer_getoverrun
1450         .llong .sys_timer_delete
1451         .llong .sys_clock_settime       /* 245 */
1452         .llong .sys_clock_gettime
1453         .llong .sys_clock_getres
1454         .llong .sys_clock_nanosleep
1455         .llong .ppc64_swapcontext
1456         .llong .sys_tgkill              /* 250 */
1457         .llong .sys_utimes
1458         .llong .sys_statfs64
1459         .llong .sys_fstatfs64
1460         .llong .sys_ni_syscall          /* 32bit only fadvise64_64 */
1461         .llong .ppc_rtas                /* 255 */
1462         .llong .sys_ni_syscall          /* 256 reserved for sys_debug_setcontext */
1463         .llong .sys_ni_syscall          /* 257 reserved for vserver */
1464         .llong .sys_ni_syscall          /* 258 reserved for new sys_remap_file_pages */
1465         .llong .sys_mbind
1466         .llong .sys_get_mempolicy       /* 260 */
1467         .llong .sys_set_mempolicy
1468         .llong .sys_mq_open
1469         .llong .sys_mq_unlink
1470         .llong .sys_mq_timedsend
1471         .llong .sys_mq_timedreceive     /* 265 */
1472         .llong .sys_mq_notify
1473         .llong .sys_mq_getsetattr
1474         .llong .sys_kexec_load
1475         .llong .sys_add_key
1476         .llong .sys_request_key         /* 270 */
1477         .llong .sys_keyctl
1478         .llong .sys_waitid
1479         .llong .sys_ioprio_set
1480         .llong .sys_ioprio_get
1481         .llong .sys_inotify_init        /* 275 */
1482         .llong .sys_inotify_add_watch
1483         .llong .sys_inotify_rm_watch