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