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