vserver 1.9.3
[linux-2.6.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/offsets.h>
30 #include <asm/cputable.h>
31
32         .text
33
34 /*
35  * Returns (address we're running at) - (address we were linked 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_PPC_ISERIES
69 /* unsigned long local_save_flags(void) */
70 _GLOBAL(local_get_flags)
71         lbz     r3,PACAPROCENABLED(r13)
72         blr
73
74 /* unsigned long local_irq_disable(void) */
75 _GLOBAL(local_irq_disable)
76         lbz     r3,PACAPROCENABLED(r13)
77         li      r4,0
78         stb     r4,PACAPROCENABLED(r13)
79         blr                     /* Done */
80
81 /* void local_irq_restore(unsigned long flags) */       
82 _GLOBAL(local_irq_restore)
83         lbz     r5,PACAPROCENABLED(r13)
84          /* Check if things are setup the way we want _already_. */
85         cmpw    0,r3,r5
86         beqlr
87         /* are we enabling interrupts? */
88         cmpdi   0,r3,0
89         stb     r3,PACAPROCENABLED(r13)
90         beqlr
91         /* Check pending interrupts */
92         /*   A decrementer, IPI or PMC interrupt may have occurred
93          *   while we were in the hypervisor (which enables) */
94         ld      r4,PACALPPACA+LPPACAANYINT(r13)
95         cmpdi   r4,0
96         beqlr
97
98         /*
99          * Handle pending interrupts in interrupt context
100          */
101         li      r0,0x5555
102         sc
103         blr
104 #endif /* CONFIG_PPC_ISERIES */
105
106 #ifdef CONFIG_IRQSTACKS
107 _GLOBAL(call_do_softirq)
108         mflr    r0
109         std     r0,16(r1)
110         stdu    r1,THREAD_SIZE-112(r3)
111         mr      r1,r3
112         bl      .__do_softirq
113         ld      r1,0(r1)
114         ld      r0,16(r1)
115         mtlr    r0
116         blr
117
118 _GLOBAL(call_handle_irq_event)
119         mflr    r0
120         std     r0,16(r1)
121         stdu    r1,THREAD_SIZE-112(r6)
122         mr      r1,r6
123         bl      .handle_irq_event
124         ld      r1,0(r1)
125         ld      r0,16(r1)
126         mtlr    r0
127         blr
128 #endif /* CONFIG_IRQSTACKS */
129
130         /*
131  * To be called by C code which needs to do some operations with MMU
132  * disabled. Note that interrupts have to be disabled by the caller
133  * prior to calling us. The code called _MUST_ be in the RMO of course
134  * and part of the linear mapping as we don't attempt to translate the
135  * stack pointer at all. The function is called with the stack switched
136  * to this CPU emergency stack
137  *
138  * prototype is void *call_with_mmu_off(void *func, void *data);
139  *
140  * the called function is expected to be of the form
141  *
142  * void *called(void *data); 
143  */
144 _GLOBAL(call_with_mmu_off)
145         mflr    r0                      /* get link, save it on stackframe */
146         std     r0,16(r1)
147         mr      r1,r5                   /* save old stack ptr */
148         ld      r1,PACAEMERGSP(r13)     /* get emerg. stack */
149         subi    r1,r1,STACK_FRAME_OVERHEAD
150         std     r0,16(r1)               /* save link on emerg. stack */
151         std     r5,0(r1)                /* save old stack ptr in backchain */
152         ld      r3,0(r3)                /* get to real function ptr (assume same TOC) */
153         bl      2f                      /* we need LR to return, continue at label 2 */
154
155         ld      r0,16(r1)               /* we return here from the call, get LR and */
156         ld      r1,0(r1)                /* .. old stack ptr */
157         mtspr   SPRN_SRR0,r0            /* and get back to virtual mode with these */
158         mfmsr   r4
159         ori     r4,r4,MSR_IR|MSR_DR
160         mtspr   SPRN_SRR1,r4
161         rfid
162
163 2:      mtspr   SPRN_SRR0,r3            /* coming from above, enter real mode */
164         mr      r3,r4                   /* get parameter */
165         mfmsr   r0
166         ori     r0,r0,MSR_IR|MSR_DR
167         xori    r0,r0,MSR_IR|MSR_DR
168         mtspr   SPRN_SRR1,r0
169         rfid
170         
171 /*
172  * Flush instruction cache.
173  */
174 _GLOBAL(flush_instruction_cache)
175
176 /*
177  * This is called by kgdb code
178  * and should probably go away
179  * to be replaced by invalidating
180  * the cache lines that are actually
181  * modified
182  */
183         /* use invalidate-all bit in HID0
184          *  - is this consistent across all 64-bit cpus?  -- paulus */
185         mfspr   r3,HID0
186         ori     r3,r3,HID0_ICFI
187         mtspr   HID0,r3
188         sync
189         isync
190         blr
191
192 /*
193  * Write any modified data cache blocks out to memory
194  * and invalidate the corresponding instruction cache blocks.
195  *
196  * flush_icache_range(unsigned long start, unsigned long stop)
197  *
198  *   flush all bytes from start through stop-1 inclusive
199  */
200
201 _GLOBAL(__flush_icache_range)
202
203 /*
204  * Flush the data cache to memory 
205  * 
206  * Different systems have different cache line sizes
207  * and in some cases i-cache and d-cache line sizes differ from
208  * each other.
209  */
210         LOADADDR(r10,naca)              /* Get Naca address */
211         ld      r10,0(r10)
212         LOADADDR(r11,systemcfg)         /* Get systemcfg address */
213         ld      r11,0(r11)
214         lwz     r7,DCACHEL1LINESIZE(r11)/* Get cache line size */
215         addi    r5,r7,-1
216         andc    r6,r3,r5                /* round low to line bdy */
217         subf    r8,r6,r4                /* compute length */
218         add     r8,r8,r5                /* ensure we get enough */
219         lwz     r9,DCACHEL1LOGLINESIZE(r10)     /* Get log-2 of cache line size */
220         srw.    r8,r8,r9                /* compute line count */
221         beqlr                           /* nothing to do? */
222         mtctr   r8
223 1:      dcbst   0,r6
224         add     r6,r6,r7
225         bdnz    1b
226         sync
227
228 /* Now invalidate the instruction cache */
229         
230         lwz     r7,ICACHEL1LINESIZE(r11)        /* Get Icache line size */
231         addi    r5,r7,-1
232         andc    r6,r3,r5                /* round low to line bdy */
233         subf    r8,r6,r4                /* compute length */
234         add     r8,r8,r5
235         lwz     r9,ICACHEL1LOGLINESIZE(r10)     /* Get log-2 of Icache line size */
236         srw.    r8,r8,r9                /* compute line count */
237         beqlr                           /* nothing to do? */
238         mtctr   r8
239 2:      icbi    0,r6
240         add     r6,r6,r7
241         bdnz    2b
242         isync
243         blr
244         
245 /*
246  * Like above, but only do the D-cache.
247  *
248  * flush_dcache_range(unsigned long start, unsigned long stop)
249  *
250  *    flush all bytes from start to stop-1 inclusive
251  */
252 _GLOBAL(flush_dcache_range)
253
254 /*
255  * Flush the data cache to memory 
256  * 
257  * Different systems have different cache line sizes
258  */
259         LOADADDR(r10,naca)              /* Get Naca address */
260         ld      r10,0(r10)
261         LOADADDR(r11,systemcfg)         /* Get systemcfg address */
262         ld      r11,0(r11)
263         lwz     r7,DCACHEL1LINESIZE(r11)        /* Get dcache line size */
264         addi    r5,r7,-1
265         andc    r6,r3,r5                /* round low to line bdy */
266         subf    r8,r6,r4                /* compute length */
267         add     r8,r8,r5                /* ensure we get enough */
268         lwz     r9,DCACHEL1LOGLINESIZE(r10)     /* Get log-2 of dcache line size */
269         srw.    r8,r8,r9                /* compute line count */
270         beqlr                           /* nothing to do? */
271         mtctr   r8
272 0:      dcbst   0,r6
273         add     r6,r6,r7
274         bdnz    0b
275         sync
276         blr
277
278 /*
279  * Like above, but works on non-mapped physical addresses.
280  * Use only for non-LPAR setups ! It also assumes real mode
281  * is cacheable. Used for flushing out the DART before using
282  * it as uncacheable memory 
283  *
284  * flush_dcache_phys_range(unsigned long start, unsigned long stop)
285  *
286  *    flush all bytes from start to stop-1 inclusive
287  */
288 _GLOBAL(flush_dcache_phys_range)
289         LOADADDR(r10,naca)              /* Get Naca address */
290         ld      r10,0(r10)
291         LOADADDR(r11,systemcfg)         /* Get systemcfg address */
292         ld      r11,0(r11)
293         lwz     r7,DCACHEL1LINESIZE(r11)        /* Get dcache line size */
294         addi    r5,r7,-1
295         andc    r6,r3,r5                /* round low to line bdy */
296         subf    r8,r6,r4                /* compute length */
297         add     r8,r8,r5                /* ensure we get enough */
298         lwz     r9,DCACHEL1LOGLINESIZE(r10)     /* Get log-2 of dcache line size */
299         srw.    r8,r8,r9                /* compute line count */
300         beqlr                           /* nothing to do? */
301         mfmsr   r5                      /* Disable MMU Data Relocation */
302         ori     r0,r5,MSR_DR
303         xori    r0,r0,MSR_DR
304         sync
305         mtmsr   r0
306         sync
307         isync
308         mtctr   r8
309 0:      dcbst   0,r6
310         add     r6,r6,r7
311         bdnz    0b
312         sync
313         isync
314         mtmsr   r5                      /* Re-enable MMU Data Relocation */
315         sync
316         isync
317         blr
318
319
320 /*
321  * Flush a particular page from the data cache to RAM.
322  * Note: this is necessary because the instruction cache does *not*
323  * snoop from the data cache.
324  *
325  *      void __flush_dcache_icache(void *page)
326  */
327 _GLOBAL(__flush_dcache_icache)
328 /*
329  * Flush the data cache to memory 
330  * 
331  * Different systems have different cache line sizes
332  */
333
334 /* Flush the dcache */
335         LOADADDR(r7,naca)
336         ld      r7,0(r7)
337         LOADADDR(r8,systemcfg)                  /* Get systemcfg address */
338         ld      r8,0(r8)
339         clrrdi  r3,r3,12                    /* Page align */
340         lwz     r4,DCACHEL1LINESPERPAGE(r7)     /* Get # dcache lines per page */
341         lwz     r5,DCACHEL1LINESIZE(r8)         /* Get dcache line size */
342         mr      r6,r3
343         mtctr   r4
344 0:      dcbst   0,r6
345         add     r6,r6,r5
346         bdnz    0b
347         sync
348
349 /* Now invalidate the icache */ 
350
351         lwz     r4,ICACHEL1LINESPERPAGE(r7)     /* Get # icache lines per page */
352         lwz     r5,ICACHEL1LINESIZE(r8)         /* Get icache line size */
353         mtctr   r4
354 1:      icbi    0,r3
355         add     r3,r3,r5
356         bdnz    1b
357         isync
358         blr
359         
360 /*
361  * I/O string operations
362  *
363  * insb(port, buf, len)
364  * outsb(port, buf, len)
365  * insw(port, buf, len)
366  * outsw(port, buf, len)
367  * insl(port, buf, len)
368  * outsl(port, buf, len)
369  * insw_ns(port, buf, len)
370  * outsw_ns(port, buf, len)
371  * insl_ns(port, buf, len)
372  * outsl_ns(port, buf, len)
373  *
374  * The *_ns versions don't do byte-swapping.
375  */
376 _GLOBAL(_insb)
377         cmpwi   0,r5,0
378         mtctr   r5
379         subi    r4,r4,1
380         blelr-
381 00:     lbz     r5,0(r3)
382         eieio
383         stbu    r5,1(r4)
384         bdnz    00b
385         twi     0,r5,0
386         isync
387         blr
388
389 _GLOBAL(_outsb)
390         cmpwi   0,r5,0
391         mtctr   r5
392         subi    r4,r4,1
393         blelr-
394 00:     lbzu    r5,1(r4)
395         stb     r5,0(r3)
396         bdnz    00b
397         sync
398         blr     
399
400 _GLOBAL(_insw)
401         cmpwi   0,r5,0
402         mtctr   r5
403         subi    r4,r4,2
404         blelr-
405 00:     lhbrx   r5,0,r3
406         eieio
407         sthu    r5,2(r4)
408         bdnz    00b
409         twi     0,r5,0
410         isync
411         blr
412
413 _GLOBAL(_outsw)
414         cmpwi   0,r5,0
415         mtctr   r5
416         subi    r4,r4,2
417         blelr-
418 00:     lhzu    r5,2(r4)
419         sthbrx  r5,0,r3 
420         bdnz    00b
421         sync
422         blr     
423
424 _GLOBAL(_insl)
425         cmpwi   0,r5,0
426         mtctr   r5
427         subi    r4,r4,4
428         blelr-
429 00:     lwbrx   r5,0,r3
430         eieio
431         stwu    r5,4(r4)
432         bdnz    00b
433         twi     0,r5,0
434         isync
435         blr
436
437 _GLOBAL(_outsl)
438         cmpwi   0,r5,0
439         mtctr   r5
440         subi    r4,r4,4
441         blelr-
442 00:     lwzu    r5,4(r4)
443         stwbrx  r5,0,r3
444         bdnz    00b
445         sync
446         blr     
447
448 /* _GLOBAL(ide_insw) now in drivers/ide/ide-iops.c */
449 _GLOBAL(_insw_ns)
450         cmpwi   0,r5,0
451         mtctr   r5
452         subi    r4,r4,2
453         blelr-
454 00:     lhz     r5,0(r3)
455         eieio
456         sthu    r5,2(r4)
457         bdnz    00b
458         twi     0,r5,0
459         isync
460         blr
461
462 /* _GLOBAL(ide_outsw) now in drivers/ide/ide-iops.c */
463 _GLOBAL(_outsw_ns)
464         cmpwi   0,r5,0
465         mtctr   r5
466         subi    r4,r4,2
467         blelr-
468 00:     lhzu    r5,2(r4)
469         sth     r5,0(r3)
470         bdnz    00b
471         sync
472         blr     
473
474 _GLOBAL(_insl_ns)
475         cmpwi   0,r5,0
476         mtctr   r5
477         subi    r4,r4,4
478         blelr-
479 00:     lwz     r5,0(r3)
480         eieio
481         stwu    r5,4(r4)
482         bdnz    00b
483         twi     0,r5,0
484         isync
485         blr
486
487 _GLOBAL(_outsl_ns)
488         cmpwi   0,r5,0
489         mtctr   r5
490         subi    r4,r4,4
491         blelr-
492 00:     lwzu    r5,4(r4)
493         stw     r5,0(r3)
494         bdnz    00b
495         sync
496         blr     
497
498
499 _GLOBAL(cvt_fd)
500         lfd     0,0(r5)         /* load up fpscr value */
501         mtfsf   0xff,0
502         lfs     0,0(r3)
503         stfd    0,0(r4)
504         mffs    0               /* save new fpscr value */
505         stfd    0,0(r5)
506         blr
507
508 _GLOBAL(cvt_df)
509         lfd     0,0(r5)         /* load up fpscr value */
510         mtfsf   0xff,0
511         lfd     0,0(r3)
512         stfs    0,0(r4)
513         mffs    0               /* save new fpscr value */
514         stfd    0,0(r5)
515         blr
516
517 /*
518  * identify_cpu and calls setup_cpu
519  * In:  r3 = base of the cpu_specs array
520  *      r4 = address of cur_cpu_spec
521  *      r5 = relocation offset
522  */
523 _GLOBAL(identify_cpu)
524         mfpvr   r7
525 1:
526         lwz     r8,CPU_SPEC_PVR_MASK(r3)
527         and     r8,r8,r7
528         lwz     r9,CPU_SPEC_PVR_VALUE(r3)
529         cmplw   0,r9,r8
530         beq     1f
531         addi    r3,r3,CPU_SPEC_ENTRY_SIZE
532         b       1b
533 1:
534         add     r0,r3,r5
535         std     r0,0(r4)
536         ld      r4,CPU_SPEC_SETUP(r3)
537         sub     r4,r4,r5
538         ld      r4,0(r4)
539         sub     r4,r4,r5
540         mtctr   r4
541         /* Calling convention for cpu setup is r3=offset, r4=cur_cpu_spec */
542         mr      r4,r3
543         mr      r3,r5
544         bctr
545
546 /*
547  * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
548  * and writes nop's over sections of code that don't apply for this cpu.
549  * r3 = data offset (not changed)
550  */
551 _GLOBAL(do_cpu_ftr_fixups)
552         /* Get CPU 0 features */
553         LOADADDR(r6,cur_cpu_spec)
554         sub     r6,r6,r3
555         ld      r4,0(r6)
556         sub     r4,r4,r3
557         ld      r4,CPU_SPEC_FEATURES(r4)
558         /* Get the fixup table */
559         LOADADDR(r6,__start___ftr_fixup)
560         sub     r6,r6,r3
561         LOADADDR(r7,__stop___ftr_fixup)
562         sub     r7,r7,r3
563         /* Do the fixup */
564 1:      cmpld   r6,r7
565         bgelr
566         addi    r6,r6,32
567         ld      r8,-32(r6)      /* mask */
568         and     r8,r8,r4
569         ld      r9,-24(r6)      /* value */
570         cmpld   r8,r9
571         beq     1b
572         ld      r8,-16(r6)      /* section begin */
573         ld      r9,-8(r6)       /* section end */
574         subf.   r9,r8,r9
575         beq     1b
576         /* write nops over the section of code */
577         /* todo: if large section, add a branch at the start of it */
578         srwi    r9,r9,2
579         mtctr   r9
580         sub     r8,r8,r3
581         lis     r0,0x60000000@h /* nop */
582 3:      stw     r0,0(r8)
583         andi.   r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
584         beq     2f
585         dcbst   0,r8            /* suboptimal, but simpler */
586         sync
587         icbi    0,r8
588 2:      addi    r8,r8,4
589         bdnz    3b
590         sync                    /* additional sync needed on g4 */
591         isync
592         b       1b
593
594 #ifdef CONFIG_PPC_PMAC
595 /*
596  * Do an IO access in real mode
597  */
598 _GLOBAL(real_readb)
599         mfmsr   r7
600         ori     r0,r7,MSR_DR
601         xori    r0,r0,MSR_DR
602         sync
603         mtmsrd  r0
604         sync
605         isync
606         mfspr   r6,SPRN_HID4
607         rldicl  r5,r6,32,0
608         ori     r5,r5,0x100
609         rldicl  r5,r5,32,0
610         sync
611         mtspr   SPRN_HID4,r5
612         isync
613         slbia
614         isync
615         lbz     r3,0(r3)
616         sync
617         mtspr   SPRN_HID4,r6
618         isync
619         slbia
620         isync
621         mtmsrd  r7
622         sync
623         isync
624         blr
625
626         /*
627  * Do an IO access in real mode
628  */
629 _GLOBAL(real_writeb)
630         mfmsr   r7
631         ori     r0,r7,MSR_DR
632         xori    r0,r0,MSR_DR
633         sync
634         mtmsrd  r0
635         sync
636         isync
637         mfspr   r6,SPRN_HID4
638         rldicl  r5,r6,32,0
639         ori     r5,r5,0x100
640         rldicl  r5,r5,32,0
641         sync
642         mtspr   SPRN_HID4,r5
643         isync
644         slbia
645         isync
646         stb     r3,0(r4)
647         sync
648         mtspr   SPRN_HID4,r6
649         isync
650         slbia
651         isync
652         mtmsrd  r7
653         sync
654         isync
655         blr
656 #endif /* CONFIG_PPC_PMAC */
657
658 /*
659  * Create a kernel thread
660  *   kernel_thread(fn, arg, flags)
661  */
662 _GLOBAL(kernel_thread)
663         std     r29,-24(r1)
664         std     r30,-16(r1)
665         stdu    r1,-STACK_FRAME_OVERHEAD(r1)
666         mr      r29,r3
667         mr      r30,r4
668         ori     r3,r5,CLONE_VM  /* flags */
669         oris    r3,r3,(CLONE_UNTRACED>>16)
670         li      r4,0            /* new sp (unused) */
671         li      r0,__NR_clone
672         sc
673         cmpdi   0,r3,0          /* parent or child? */
674         bne     1f              /* return if parent */
675         li      r0,0
676         stdu    r0,-STACK_FRAME_OVERHEAD(r1)
677         ld      r2,8(r29)
678         ld      r29,0(r29)
679         mtlr    r29              /* fn addr in lr */
680         mr      r3,r30          /* load arg and call fn */
681         blrl
682         li      r0,__NR_exit    /* exit after child exits */
683         li      r3,0
684         sc
685 1:      addi    r1,r1,STACK_FRAME_OVERHEAD      
686         ld      r29,-24(r1)
687         ld      r30,-16(r1)
688         blr
689
690 #ifndef CONFIG_PPC_PSERIES      /* hack hack hack */
691 #define ppc_rtas        sys_ni_syscall
692 #endif
693
694 /* Why isn't this a) automatic, b) written in 'C'? */   
695         .balign 8
696 _GLOBAL(sys_call_table32)
697         .llong .sys_restart_syscall     /* 0 */
698         .llong .sys_exit
699         .llong .ppc_fork
700         .llong .sys_read
701         .llong .sys_write
702         .llong .sys32_open              /* 5 */
703         .llong .sys_close
704         .llong .sys32_waitpid
705         .llong .sys32_creat
706         .llong .sys_link
707         .llong .sys_unlink              /* 10 */
708         .llong .sys32_execve
709         .llong .sys_chdir
710         .llong .sys32_time
711         .llong .sys_mknod
712         .llong .sys_chmod               /* 15 */
713         .llong .sys_lchown
714         .llong .sys_ni_syscall          /* old break syscall */
715         .llong .sys_ni_syscall          /* old stat syscall */
716         .llong .ppc32_lseek
717         .llong .sys_getpid              /* 20 */
718         .llong .compat_sys_mount
719         .llong .sys_oldumount
720         .llong .sys_setuid
721         .llong .sys_getuid
722         .llong .ppc64_sys32_stime       /* 25 */
723         .llong .sys32_ptrace
724         .llong .sys_alarm
725         .llong .sys_ni_syscall          /* old fstat syscall */
726         .llong .sys32_pause
727         .llong .compat_sys_utime                /* 30 */
728         .llong .sys_ni_syscall          /* old stty syscall */
729         .llong .sys_ni_syscall          /* old gtty syscall */
730         .llong .sys32_access
731         .llong .sys32_nice
732         .llong .sys_ni_syscall          /* 35 - old ftime syscall */
733         .llong .sys_sync
734         .llong .sys32_kill
735         .llong .sys_rename
736         .llong .sys32_mkdir
737         .llong .sys_rmdir               /* 40 */
738         .llong .sys_dup
739         .llong .sys_pipe
740         .llong .compat_sys_times
741         .llong .sys_ni_syscall          /* old prof syscall */
742         .llong .sys_brk                 /* 45 */
743         .llong .sys_setgid
744         .llong .sys_getgid
745         .llong .sys_signal
746         .llong .sys_geteuid
747         .llong .sys_getegid             /* 50 */
748         .llong .sys_acct
749         .llong .sys_umount
750         .llong .sys_ni_syscall          /* old lock syscall */
751         .llong .compat_sys_ioctl
752         .llong .compat_sys_fcntl                /* 55 */
753         .llong .sys_ni_syscall          /* old mpx syscall */
754         .llong .sys32_setpgid
755         .llong .sys_ni_syscall          /* old ulimit syscall */
756         .llong .sys32_olduname
757         .llong .sys32_umask             /* 60 */
758         .llong .sys_chroot
759         .llong .sys_ustat
760         .llong .sys_dup2
761         .llong .sys_getppid
762         .llong .sys_getpgrp             /* 65 */
763         .llong .sys_setsid
764         .llong .sys32_sigaction
765         .llong .sys_sgetmask
766         .llong .sys32_ssetmask
767         .llong .sys_setreuid            /* 70 */
768         .llong .sys_setregid
769         .llong .ppc32_sigsuspend
770         .llong .compat_sys_sigpending
771         .llong .sys32_sethostname
772         .llong .compat_sys_setrlimit            /* 75 */
773         .llong .compat_sys_old_getrlimit
774         .llong .compat_sys_getrusage
775         .llong .sys32_gettimeofday
776         .llong .sys32_settimeofday
777         .llong .sys32_getgroups         /* 80 */
778         .llong .sys32_setgroups
779         .llong .sys_ni_syscall          /* old select syscall */
780         .llong .sys_symlink
781         .llong .sys_ni_syscall          /* old lstat syscall */
782         .llong .sys32_readlink          /* 85 */
783         .llong .sys_uselib
784         .llong .sys_swapon
785         .llong .sys_reboot
786         .llong .old32_readdir
787         .llong .sys_mmap                /* 90 */
788         .llong .sys_munmap
789         .llong .sys_truncate
790         .llong .sys_ftruncate
791         .llong .sys_fchmod
792         .llong .sys_fchown              /* 95 */
793         .llong .sys32_getpriority
794         .llong .sys32_setpriority
795         .llong .sys_ni_syscall          /* old profil syscall */
796         .llong .compat_sys_statfs
797         .llong .compat_sys_fstatfs              /* 100 */
798         .llong .sys_ni_syscall          /* old ioperm syscall */
799         .llong .compat_sys_socketcall
800         .llong .sys32_syslog
801         .llong .compat_sys_setitimer
802         .llong .compat_sys_getitimer            /* 105 */
803         .llong .compat_sys_newstat
804         .llong .compat_sys_newlstat
805         .llong .compat_sys_newfstat
806         .llong .sys_uname
807         .llong .sys_ni_syscall          /* 110 old iopl syscall */
808         .llong .sys_vhangup
809         .llong .sys_ni_syscall          /* old idle syscall */
810         .llong .sys_ni_syscall          /* old vm86 syscall */
811         .llong .compat_sys_wait4
812         .llong .sys_swapoff             /* 115 */
813         .llong .sys32_sysinfo
814         .llong .sys32_ipc
815         .llong .sys_fsync
816         .llong .ppc32_sigreturn
817         .llong .ppc_clone               /* 120 */
818         .llong .sys32_setdomainname
819         .llong .ppc64_newuname
820         .llong .sys_ni_syscall          /* old modify_ldt syscall */
821         .llong .sys32_adjtimex
822         .llong .sys_mprotect            /* 125 */
823         .llong .compat_sys_sigprocmask
824         .llong .sys_ni_syscall          /* old create_module syscall */
825         .llong .sys_init_module
826         .llong .sys_delete_module
827         .llong .sys_ni_syscall          /* 130 old get_kernel_syms syscall */
828         .llong .sys_quotactl
829         .llong .sys32_getpgid
830         .llong .sys_fchdir
831         .llong .sys_bdflush
832         .llong .sys32_sysfs             /* 135 */
833         .llong .ppc64_personality
834         .llong .sys_ni_syscall          /* for afs_syscall */
835         .llong .sys_setfsuid
836         .llong .sys_setfsgid
837         .llong .sys_llseek              /* 140 */
838         .llong .sys32_getdents
839         .llong .ppc32_select
840         .llong .sys_flock
841         .llong .sys_msync
842         .llong .compat_sys_readv        /* 145 */
843         .llong .compat_sys_writev
844         .llong .sys32_getsid
845         .llong .sys_fdatasync
846         .llong .sys32_sysctl
847         .llong .sys_mlock               /* 150 */
848         .llong .sys_munlock
849         .llong .sys_mlockall
850         .llong .sys_munlockall
851         .llong .sys32_sched_setparam
852         .llong .sys32_sched_getparam    /* 155 */
853         .llong .sys32_sched_setscheduler
854         .llong .sys32_sched_getscheduler
855         .llong .sys_sched_yield
856         .llong .sys32_sched_get_priority_max
857         .llong .sys32_sched_get_priority_min  /* 160 */
858         .llong .sys32_sched_rr_get_interval
859         .llong .compat_sys_nanosleep
860         .llong .sys_mremap
861         .llong .sys_setresuid
862         .llong .sys_getresuid           /* 165 */
863         .llong .sys_ni_syscall          /* old query_module syscall */
864         .llong .sys_poll
865         .llong .compat_sys_nfsservctl
866         .llong .sys_setresgid
867         .llong .sys_getresgid           /* 170 */
868         .llong .sys32_prctl
869         .llong .ppc32_rt_sigreturn
870         .llong .sys32_rt_sigaction
871         .llong .sys32_rt_sigprocmask
872         .llong .sys32_rt_sigpending     /* 175 */
873         .llong .sys32_rt_sigtimedwait
874         .llong .sys32_rt_sigqueueinfo
875         .llong .ppc32_rt_sigsuspend
876         .llong .sys32_pread64
877         .llong .sys32_pwrite64          /* 180 */
878         .llong .sys_chown
879         .llong .sys_getcwd
880         .llong .sys_capget
881         .llong .sys_capset
882         .llong .sys32_sigaltstack       /* 185 */
883         .llong .sys32_sendfile
884         .llong .sys_ni_syscall          /* reserved for streams1 */
885         .llong .sys_ni_syscall          /* reserved for streams2 */
886         .llong .ppc_vfork
887         .llong .compat_sys_getrlimit            /* 190 */
888         .llong .sys32_readahead
889         .llong .sys32_mmap2
890         .llong .sys32_truncate64
891         .llong .sys32_ftruncate64
892         .llong .sys_stat64              /* 195 */
893         .llong .sys_lstat64
894         .llong .sys_fstat64
895         .llong .sys32_pciconfig_read
896         .llong .sys32_pciconfig_write
897         .llong .sys32_pciconfig_iobase  /* 200 - pciconfig_iobase */
898         .llong .sys_ni_syscall          /* reserved for MacOnLinux */
899         .llong .sys_getdents64
900         .llong .sys_pivot_root
901         .llong .compat_sys_fcntl64
902         .llong .sys_madvise             /* 205 */
903         .llong .sys_mincore
904         .llong .sys_gettid
905         .llong .sys_tkill
906         .llong .sys_setxattr
907         .llong .sys_lsetxattr           /* 210 */
908         .llong .sys_fsetxattr
909         .llong .sys_getxattr
910         .llong .sys_lgetxattr
911         .llong .sys_fgetxattr
912         .llong .sys_listxattr           /* 215 */
913         .llong .sys_llistxattr
914         .llong .sys_flistxattr
915         .llong .sys_removexattr
916         .llong .sys_lremovexattr
917         .llong .sys_fremovexattr        /* 220 */
918         .llong .compat_sys_futex
919         .llong .compat_sys_sched_setaffinity
920         .llong .compat_sys_sched_getaffinity
921         .llong .sys_ni_syscall
922         .llong .sys_ni_syscall          /* 225 - reserved for tux */
923         .llong .sys32_sendfile64
924         .llong .compat_sys_io_setup
925         .llong .sys_io_destroy
926         .llong .compat_sys_io_getevents
927         .llong .compat_sys_io_submit
928         .llong .sys_io_cancel
929         .llong .sys_set_tid_address
930         .llong .ppc32_fadvise64
931         .llong .sys_exit_group
932         .llong .ppc32_lookup_dcookie    /* 235 */
933         .llong .sys_epoll_create
934         .llong .sys_epoll_ctl
935         .llong .sys_epoll_wait
936         .llong .sys_remap_file_pages
937         .llong .ppc32_timer_create      /* 240 */
938         .llong .compat_timer_settime
939         .llong .compat_timer_gettime
940         .llong .sys_timer_getoverrun
941         .llong .sys_timer_delete
942         .llong .compat_clock_settime    /* 245 */
943         .llong .compat_clock_gettime
944         .llong .compat_clock_getres
945         .llong .compat_clock_nanosleep
946         .llong .ppc32_swapcontext
947         .llong .sys32_tgkill            /* 250 */
948         .llong .sys32_utimes
949         .llong .compat_statfs64
950         .llong .compat_fstatfs64
951         .llong .ppc32_fadvise64_64      /* 32bit only fadvise64_64 */
952         .llong .ppc_rtas                /* 255 */
953         .llong .sys_ni_syscall          /* 256 reserved for sys_debug_setcontext */
954         .llong .sys_vserver
955         .llong .sys_ni_syscall          /* 258 reserved for new sys_remap_file_pages */
956         .llong .compat_mbind
957         .llong .compat_get_mempolicy    /* 260 */
958         .llong .compat_set_mempolicy
959         .llong .compat_sys_mq_open
960         .llong .sys_mq_unlink
961         .llong .compat_sys_mq_timedsend
962         .llong .compat_sys_mq_timedreceive /* 265 */
963         .llong .compat_sys_mq_notify
964         .llong .compat_sys_mq_getsetattr
965         .llong .sys_ni_syscall          /* 268 reserved for sys_kexec_load */
966
967         .balign 8
968 _GLOBAL(sys_call_table)
969         .llong .sys_restart_syscall     /* 0 */
970         .llong .sys_exit
971         .llong .ppc_fork
972         .llong .sys_read
973         .llong .sys_write
974         .llong .sys_open                /* 5 */
975         .llong .sys_close
976         .llong .sys_waitpid
977         .llong .sys_creat
978         .llong .sys_link
979         .llong .sys_unlink              /* 10 */
980         .llong .sys_execve
981         .llong .sys_chdir
982         .llong .sys64_time
983         .llong .sys_mknod
984         .llong .sys_chmod               /* 15 */
985         .llong .sys_lchown
986         .llong .sys_ni_syscall          /* old break syscall */
987         .llong .sys_ni_syscall          /* old stat syscall */
988         .llong .sys_lseek
989         .llong .sys_getpid              /* 20 */
990         .llong .sys_mount
991         .llong .sys_ni_syscall          /* old umount syscall */
992         .llong .sys_setuid
993         .llong .sys_getuid
994         .llong .ppc64_sys_stime         /* 25 */
995         .llong .sys_ptrace
996         .llong .sys_alarm
997         .llong .sys_ni_syscall          /* old fstat syscall */
998         .llong .sys_pause
999         .llong .sys_utime               /* 30 */
1000         .llong .sys_ni_syscall          /* old stty syscall */
1001         .llong .sys_ni_syscall          /* old gtty syscall */
1002         .llong .sys_access
1003         .llong .sys_nice
1004         .llong .sys_ni_syscall          /* 35 - old ftime syscall */
1005         .llong .sys_sync
1006         .llong .sys_kill
1007         .llong .sys_rename
1008         .llong .sys_mkdir
1009         .llong .sys_rmdir               /* 40 */
1010         .llong .sys_dup
1011         .llong .sys_pipe
1012         .llong .sys_times
1013         .llong .sys_ni_syscall          /* old prof syscall */
1014         .llong .sys_brk                 /* 45 */
1015         .llong .sys_setgid
1016         .llong .sys_getgid
1017         .llong .sys_signal
1018         .llong .sys_geteuid
1019         .llong .sys_getegid             /* 50 */
1020         .llong .sys_acct
1021         .llong .sys_umount
1022         .llong .sys_ni_syscall          /* old lock syscall */
1023         .llong .sys_ioctl
1024         .llong .sys_fcntl               /* 55 */
1025         .llong .sys_ni_syscall          /* old mpx syscall */
1026         .llong .sys_setpgid
1027         .llong .sys_ni_syscall          /* old ulimit syscall */
1028         .llong .sys_ni_syscall          /* old uname syscall */
1029         .llong .sys_umask               /* 60 */
1030         .llong .sys_chroot
1031         .llong .sys_ustat
1032         .llong .sys_dup2
1033         .llong .sys_getppid
1034         .llong .sys_getpgrp             /* 65 */
1035         .llong .sys_setsid
1036         .llong .sys_ni_syscall
1037         .llong .sys_sgetmask
1038         .llong .sys_ssetmask
1039         .llong .sys_setreuid            /* 70 */
1040         .llong .sys_setregid
1041         .llong .sys_ni_syscall
1042         .llong .sys_ni_syscall
1043         .llong .sys_sethostname
1044         .llong .sys_setrlimit           /* 75 */
1045         .llong .sys_ni_syscall          /* old getrlimit syscall */
1046         .llong .sys_getrusage
1047         .llong .sys_gettimeofday
1048         .llong .sys_settimeofday
1049         .llong .sys_getgroups           /* 80 */
1050         .llong .sys_setgroups
1051         .llong .sys_ni_syscall          /* old select syscall */
1052         .llong .sys_symlink
1053         .llong .sys_ni_syscall          /* old lstat syscall */
1054         .llong .sys_readlink            /* 85 */
1055         .llong .sys_uselib
1056         .llong .sys_swapon
1057         .llong .sys_reboot
1058         .llong .sys_ni_syscall          /* old readdir syscall */
1059         .llong .sys_mmap                /* 90 */
1060         .llong .sys_munmap
1061         .llong .sys_truncate
1062         .llong .sys_ftruncate
1063         .llong .sys_fchmod
1064         .llong .sys_fchown              /* 95 */
1065         .llong .sys_getpriority
1066         .llong .sys_setpriority
1067         .llong .sys_ni_syscall          /* old profil syscall holder */
1068         .llong .sys_statfs
1069         .llong .sys_fstatfs             /* 100 */
1070         .llong .sys_ni_syscall          /* old ioperm syscall */
1071         .llong .sys_socketcall
1072         .llong .sys_syslog
1073         .llong .sys_setitimer
1074         .llong .sys_getitimer           /* 105 */
1075         .llong .sys_newstat
1076         .llong .sys_newlstat
1077         .llong .sys_newfstat
1078         .llong .sys_ni_syscall          /* old uname syscall */
1079         .llong .sys_ni_syscall          /* 110 old iopl syscall */
1080         .llong .sys_vhangup
1081         .llong .sys_ni_syscall          /* old idle syscall */
1082         .llong .sys_ni_syscall          /* old vm86 syscall */
1083         .llong .sys_wait4
1084         .llong .sys_swapoff             /* 115 */
1085         .llong .sys_sysinfo
1086         .llong .sys_ipc
1087         .llong .sys_fsync
1088         .llong .sys_ni_syscall
1089         .llong .ppc_clone               /* 120 */
1090         .llong .sys_setdomainname
1091         .llong .ppc64_newuname
1092         .llong .sys_ni_syscall          /* old modify_ldt syscall */
1093         .llong .sys_adjtimex
1094         .llong .sys_mprotect            /* 125 */
1095         .llong .sys_ni_syscall
1096         .llong .sys_ni_syscall          /* old create_module syscall */
1097         .llong .sys_init_module
1098         .llong .sys_delete_module
1099         .llong .sys_ni_syscall          /* 130 old get_kernel_syms syscall */
1100         .llong .sys_quotactl
1101         .llong .sys_getpgid
1102         .llong .sys_fchdir
1103         .llong .sys_bdflush
1104         .llong .sys_sysfs               /* 135 */
1105         .llong .ppc64_personality
1106         .llong .sys_ni_syscall          /* for afs_syscall */
1107         .llong .sys_setfsuid
1108         .llong .sys_setfsgid
1109         .llong .sys_llseek              /* 140 */
1110         .llong .sys_getdents
1111         .llong .sys_select
1112         .llong .sys_flock
1113         .llong .sys_msync
1114         .llong .sys_readv               /* 145 */
1115         .llong .sys_writev
1116         .llong .sys_getsid
1117         .llong .sys_fdatasync
1118         .llong .sys_sysctl
1119         .llong .sys_mlock               /* 150 */
1120         .llong .sys_munlock
1121         .llong .sys_mlockall
1122         .llong .sys_munlockall
1123         .llong .sys_sched_setparam
1124         .llong .sys_sched_getparam      /* 155 */
1125         .llong .sys_sched_setscheduler
1126         .llong .sys_sched_getscheduler
1127         .llong .sys_sched_yield
1128         .llong .sys_sched_get_priority_max
1129         .llong .sys_sched_get_priority_min  /* 160 */
1130         .llong .sys_sched_rr_get_interval
1131         .llong .sys_nanosleep
1132         .llong .sys_mremap
1133         .llong .sys_setresuid
1134         .llong .sys_getresuid           /* 165 */
1135         .llong .sys_ni_syscall          /* old query_module syscall */
1136         .llong .sys_poll
1137         .llong .sys_nfsservctl
1138         .llong .sys_setresgid
1139         .llong .sys_getresgid           /* 170 */
1140         .llong .sys_prctl
1141         .llong .ppc64_rt_sigreturn
1142         .llong .sys_rt_sigaction
1143         .llong .sys_rt_sigprocmask      
1144         .llong .sys_rt_sigpending       /* 175 */
1145         .llong .sys_rt_sigtimedwait
1146         .llong .sys_rt_sigqueueinfo
1147         .llong .ppc64_rt_sigsuspend
1148         .llong .sys_pread64
1149         .llong .sys_pwrite64            /* 180 */
1150         .llong .sys_chown
1151         .llong .sys_getcwd
1152         .llong .sys_capget
1153         .llong .sys_capset
1154         .llong .sys_sigaltstack         /* 185 */
1155         .llong .sys_sendfile64
1156         .llong .sys_ni_syscall          /* reserved for streams1 */
1157         .llong .sys_ni_syscall          /* reserved for streams2 */
1158         .llong .ppc_vfork
1159         .llong .sys_getrlimit           /* 190 */
1160         .llong .sys_readahead
1161         .llong .sys_ni_syscall          /* 32bit only mmap2 */
1162         .llong .sys_ni_syscall          /* 32bit only truncate64 */
1163         .llong .sys_ni_syscall          /* 32bit only ftruncate64 */
1164         .llong .sys_ni_syscall          /* 195 - 32bit only stat64 */
1165         .llong .sys_ni_syscall          /* 32bit only lstat64 */
1166         .llong .sys_ni_syscall          /* 32bit only fstat64 */
1167         .llong .sys_ni_syscall          /* 32bit only pciconfig_read */
1168         .llong .sys_ni_syscall          /* 32bit only pciconfig_write */
1169         .llong .sys_ni_syscall          /* 32bit only pciconfig_iobase */
1170         .llong .sys_ni_syscall          /* reserved for MacOnLinux */
1171         .llong .sys_getdents64
1172         .llong .sys_pivot_root
1173         .llong .sys_ni_syscall          /* 32bit only fcntl64 */
1174         .llong .sys_madvise             /* 205 */
1175         .llong .sys_mincore
1176         .llong .sys_gettid
1177         .llong .sys_tkill
1178         .llong .sys_setxattr
1179         .llong .sys_lsetxattr           /* 210 */
1180         .llong .sys_fsetxattr
1181         .llong .sys_getxattr
1182         .llong .sys_lgetxattr
1183         .llong .sys_fgetxattr
1184         .llong .sys_listxattr           /* 215 */
1185         .llong .sys_llistxattr
1186         .llong .sys_flistxattr
1187         .llong .sys_removexattr
1188         .llong .sys_lremovexattr
1189         .llong .sys_fremovexattr        /* 220 */
1190         .llong .sys_futex
1191         .llong .sys_sched_setaffinity
1192         .llong .sys_sched_getaffinity
1193         .llong .sys_ni_syscall
1194         .llong .sys_ni_syscall          /* 225 - reserved for tux */
1195         .llong .sys_ni_syscall          /* 32bit only sendfile64 */
1196         .llong .sys_io_setup
1197         .llong .sys_io_destroy
1198         .llong .sys_io_getevents
1199         .llong .sys_io_submit           /* 230 */
1200         .llong .sys_io_cancel
1201         .llong .sys_set_tid_address
1202         .llong .sys_fadvise64
1203         .llong .sys_exit_group
1204         .llong .sys_lookup_dcookie      /* 235 */
1205         .llong .sys_epoll_create
1206         .llong .sys_epoll_ctl
1207         .llong .sys_epoll_wait
1208         .llong .sys_remap_file_pages
1209         .llong .sys_timer_create        /* 240 */
1210         .llong .sys_timer_settime
1211         .llong .sys_timer_gettime
1212         .llong .sys_timer_getoverrun
1213         .llong .sys_timer_delete
1214         .llong .sys_clock_settime       /* 245 */
1215         .llong .sys_clock_gettime
1216         .llong .sys_clock_getres
1217         .llong .sys_clock_nanosleep
1218         .llong .ppc64_swapcontext
1219         .llong .sys_tgkill              /* 250 */
1220         .llong .sys_utimes
1221         .llong .sys_statfs64
1222         .llong .sys_fstatfs64
1223         .llong .sys_ni_syscall          /* 32bit only fadvise64_64 */
1224         .llong .ppc_rtas                /* 255 */
1225         .llong .sys_ni_syscall          /* 256 reserved for sys_debug_setcontext */
1226         .llong .sys_ni_syscall          /* 257 reserved for vserver */
1227         .llong .sys_ni_syscall          /* 258 reserved for new sys_remap_file_pages */
1228         .llong .sys_mbind
1229         .llong .sys_get_mempolicy       /* 260 */
1230         .llong .sys_set_mempolicy
1231         .llong .sys_mq_open
1232         .llong .sys_mq_unlink
1233         .llong .sys_mq_timedsend
1234         .llong .sys_mq_timedreceive     /* 265 */
1235         .llong .sys_mq_notify
1236         .llong .sys_mq_getsetattr
1237         .llong .sys_ni_syscall          /* 268 reserved for sys_kexec_load */