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