Merge to Fedora kernel-2.6.7-1.441
[linux-2.6.git] / arch / ppc / kernel / misc.S
1 /*
2  * This file contains miscellaneous low-level functions.
3  *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4  *
5  * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6  * and Paul Mackerras.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version
11  * 2 of the License, or (at your option) any later version.
12  *
13  */
14
15 #include <linux/config.h>
16 #include <linux/sys.h>
17 #include <asm/unistd.h>
18 #include <asm/errno.h>
19 #include <asm/processor.h>
20 #include <asm/page.h>
21 #include <asm/cache.h>
22 #include <asm/cputable.h>
23 #include <asm/mmu.h>
24 #include <asm/ppc_asm.h>
25 #include <asm/thread_info.h>
26 #include <asm/offsets.h>
27
28         .text
29
30         .align  5
31 _GLOBAL(__delay)
32         cmpwi   0,r3,0
33         mtctr   r3
34         beqlr
35 1:      bdnz    1b
36         blr
37
38 /*
39  * Returns (address we're running at) - (address we were linked at)
40  * for use before the text and data are mapped to KERNELBASE.
41  */
42 _GLOBAL(reloc_offset)
43         mflr    r0
44         bl      1f
45 1:      mflr    r3
46         lis     r4,1b@ha
47         addi    r4,r4,1b@l
48         subf    r3,r4,r3
49         mtlr    r0
50         blr
51
52 /*
53  * add_reloc_offset(x) returns x + reloc_offset().
54  */
55 _GLOBAL(add_reloc_offset)
56         mflr    r0
57         bl      1f
58 1:      mflr    r5
59         lis     r4,1b@ha
60         addi    r4,r4,1b@l
61         subf    r5,r4,r5
62         add     r3,r3,r5
63         mtlr    r0
64         blr
65
66 /*
67  * sub_reloc_offset(x) returns x - reloc_offset().
68  */
69 _GLOBAL(sub_reloc_offset)
70         mflr    r0
71         bl      1f
72 1:      mflr    r5
73         lis     r4,1b@ha
74         addi    r4,r4,1b@l
75         subf    r5,r4,r5
76         subf    r3,r5,r3
77         mtlr    r0
78         blr
79
80 /*
81  * reloc_got2 runs through the .got2 section adding an offset
82  * to each entry.
83  */
84 _GLOBAL(reloc_got2)
85         mflr    r11
86         lis     r7,__got2_start@ha
87         addi    r7,r7,__got2_start@l
88         lis     r8,__got2_end@ha
89         addi    r8,r8,__got2_end@l
90         subf    r8,r7,r8
91         srwi.   r8,r8,2
92         beqlr
93         mtctr   r8
94         bl      1f
95 1:      mflr    r0
96         lis     r4,1b@ha
97         addi    r4,r4,1b@l
98         subf    r0,r4,r0
99         add     r7,r0,r7
100 2:      lwz     r0,0(r7)
101         add     r0,r0,r3
102         stw     r0,0(r7)
103         addi    r7,r7,4
104         bdnz    2b
105         mtlr    r11
106         blr
107
108 /*
109  * identify_cpu,
110  * called with r3 = data offset and r4 = CPU number
111  * doesn't change r3
112  */
113 _GLOBAL(identify_cpu)
114         addis   r8,r3,cpu_specs@ha
115         addi    r8,r8,cpu_specs@l
116         mfpvr   r7
117 1:
118         lwz     r5,CPU_SPEC_PVR_MASK(r8)
119         and     r5,r5,r7
120         lwz     r6,CPU_SPEC_PVR_VALUE(r8)
121         cmplw   0,r6,r5
122         beq     1f
123         addi    r8,r8,CPU_SPEC_ENTRY_SIZE
124         b       1b
125 1:
126         addis   r6,r3,cur_cpu_spec@ha
127         addi    r6,r6,cur_cpu_spec@l
128         slwi    r4,r4,2
129         sub     r8,r8,r3
130         stwx    r8,r4,r6
131         blr
132
133 /*
134  * do_cpu_ftr_fixups - goes through the list of CPU feature fixups
135  * and writes nop's over sections of code that don't apply for this cpu.
136  * r3 = data offset (not changed)
137  */
138 _GLOBAL(do_cpu_ftr_fixups)
139         /* Get CPU 0 features */
140         addis   r6,r3,cur_cpu_spec@ha
141         addi    r6,r6,cur_cpu_spec@l
142         lwz     r4,0(r6)
143         add     r4,r4,r3
144         lwz     r4,CPU_SPEC_FEATURES(r4)
145
146         /* Get the fixup table */
147         addis   r6,r3,__start___ftr_fixup@ha
148         addi    r6,r6,__start___ftr_fixup@l
149         addis   r7,r3,__stop___ftr_fixup@ha
150         addi    r7,r7,__stop___ftr_fixup@l
151
152         /* Do the fixup */
153 1:      cmplw   0,r6,r7
154         bgelr
155         addi    r6,r6,16
156         lwz     r8,-16(r6)      /* mask */
157         and     r8,r8,r4
158         lwz     r9,-12(r6)      /* value */
159         cmplw   0,r8,r9
160         beq     1b
161         lwz     r8,-8(r6)       /* section begin */
162         lwz     r9,-4(r6)       /* section end */
163         subf.   r9,r8,r9
164         beq     1b
165         /* write nops over the section of code */
166         /* todo: if large section, add a branch at the start of it */
167         srwi    r9,r9,2
168         mtctr   r9
169         add     r8,r8,r3
170         lis     r0,0x60000000@h /* nop */
171 3:      stw     r0,0(r8)
172         andi.   r10,r4,CPU_FTR_SPLIT_ID_CACHE@l
173         beq     2f
174         dcbst   0,r8            /* suboptimal, but simpler */
175         sync
176         icbi    0,r8
177 2:      addi    r8,r8,4
178         bdnz    3b
179         sync                    /* additional sync needed on g4 */
180         isync
181         b       1b
182
183 /*
184  * call_setup_cpu - call the setup_cpu function for this cpu
185  * r3 = data offset, r24 = cpu number
186  *
187  * Setup function is called with:
188  *   r3 = data offset
189  *   r4 = CPU number
190  *   r5 = ptr to CPU spec (relocated)
191  */
192 _GLOBAL(call_setup_cpu)
193         addis   r5,r3,cur_cpu_spec@ha
194         addi    r5,r5,cur_cpu_spec@l
195         slwi    r4,r24,2
196         lwzx    r5,r4,r5
197         add     r5,r5,r3
198         lwz     r6,CPU_SPEC_SETUP(r5)
199         add     r6,r6,r3
200         mtctr   r6
201         mr      r4,r24
202         bctr
203
204 #if defined(CONFIG_CPU_FREQ_PMAC) && defined(CONFIG_6xx)
205
206 /* This gets called by via-pmu.c to switch the PLL selection
207  * on 750fx CPU. This function should really be moved to some
208  * other place (as most of the cpufreq code in via-pmu
209  */
210 _GLOBAL(low_choose_750fx_pll)
211         /* Clear MSR:EE */
212         mfmsr   r7
213         rlwinm  r0,r7,0,17,15
214         mtmsr   r0
215
216         /* If switching to PLL1, disable HID0:BTIC */
217         cmpli   cr0,r3,0
218         beq     1f
219         mfspr   r5,HID0
220         rlwinm  r5,r5,0,27,25
221         sync
222         mtspr   HID0,r5
223         isync
224         sync
225
226 1:
227         /* Calc new HID1 value */
228         mfspr   r4,SPRN_HID1    /* Build a HID1:PS bit from parameter */
229         rlwinm  r5,r3,16,15,15  /* Clear out HID1:PS from value read */
230         rlwinm  r4,r4,0,16,14   /* Could have I used rlwimi here ? */
231         or      r4,r4,r5
232         mtspr   SPRN_HID1,r4
233
234         /* Store new HID1 image */
235         rlwinm  r6,r1,0,0,18
236         lwz     r6,TI_CPU(r6)
237         slwi    r6,r6,2
238         addis   r6,r6,nap_save_hid1@ha
239         stw     r4,nap_save_hid1@l(r6)
240
241         /* If switching to PLL0, enable HID0:BTIC */
242         cmpli   cr0,r3,0
243         bne     1f
244         mfspr   r5,HID0
245         ori     r5,r5,HID0_BTIC
246         sync
247         mtspr   HID0,r5
248         isync
249         sync
250
251 1:
252         /* Return */
253         mtmsr   r7
254         blr
255
256 #endif /* CONFIG_CPU_FREQ_PMAC && CONFIG_6xx */
257
258 /* void local_save_flags_ptr(unsigned long *flags) */
259 _GLOBAL(local_save_flags_ptr)
260         mfmsr   r4
261         stw     r4,0(r3)
262         blr
263         /*
264          * Need these nops here for taking over save/restore to
265          * handle lost intrs
266          * -- Cort
267          */
268         nop
269         nop
270         nop
271         nop
272         nop
273         nop
274         nop
275         nop
276         nop
277         nop
278         nop
279         nop
280         nop
281         nop
282         nop
283         nop
284         nop
285 _GLOBAL(local_save_flags_ptr_end)
286
287 /* void local_irq_restore(unsigned long flags) */
288 _GLOBAL(local_irq_restore)
289 /*
290  * Just set/clear the MSR_EE bit through restore/flags but do not
291  * change anything else.  This is needed by the RT system and makes
292  * sense anyway.
293  *    -- Cort
294  */
295         mfmsr   r4
296         /* Copy all except the MSR_EE bit from r4 (current MSR value)
297            to r3.  This is the sort of thing the rlwimi instruction is
298            designed for.  -- paulus. */
299         rlwimi  r3,r4,0,17,15
300          /* Check if things are setup the way we want _already_. */
301         cmpw    0,r3,r4
302         beqlr
303 1:      SYNC
304         mtmsr   r3
305         SYNC
306         blr
307         nop
308         nop
309         nop
310         nop
311         nop
312         nop
313         nop
314         nop
315         nop
316         nop
317         nop
318         nop
319         nop
320         nop
321         nop
322         nop
323         nop
324         nop
325         nop
326 _GLOBAL(local_irq_restore_end)
327
328 _GLOBAL(local_irq_disable)
329         mfmsr   r0              /* Get current interrupt state */
330         rlwinm  r3,r0,16+1,32-1,31      /* Extract old value of 'EE' */
331         rlwinm  r0,r0,0,17,15   /* clear MSR_EE in r0 */
332         SYNC                    /* Some chip revs have problems here... */
333         mtmsr   r0              /* Update machine state */
334         blr                     /* Done */
335         /*
336          * Need these nops here for taking over save/restore to
337          * handle lost intrs
338          * -- Cort
339          */
340         nop
341         nop
342         nop
343         nop
344         nop
345         nop
346         nop
347         nop
348         nop
349         nop
350         nop
351         nop
352         nop
353         nop
354         nop
355 _GLOBAL(local_irq_disable_end)
356
357 _GLOBAL(local_irq_enable)
358         mfmsr   r3              /* Get current state */
359         ori     r3,r3,MSR_EE    /* Turn on 'EE' bit */
360         SYNC                    /* Some chip revs have problems here... */
361         mtmsr   r3              /* Update machine state */
362         blr
363         /*
364          * Need these nops here for taking over save/restore to
365          * handle lost intrs
366          * -- Cort
367          */
368         nop
369         nop
370         nop
371         nop
372         nop
373         nop
374         nop
375         nop
376         nop
377         nop
378         nop
379         nop
380         nop
381         nop
382         nop
383         nop
384 _GLOBAL(local_irq_enable_end)
385
386 /*
387  * complement mask on the msr then "or" some values on.
388  *     _nmask_and_or_msr(nmask, value_to_or)
389  */
390 _GLOBAL(_nmask_and_or_msr)
391         mfmsr   r0              /* Get current msr */
392         andc    r0,r0,r3        /* And off the bits set in r3 (first parm) */
393         or      r0,r0,r4        /* Or on the bits in r4 (second parm) */
394         SYNC                    /* Some chip revs have problems here... */
395         mtmsr   r0              /* Update machine state */
396         isync
397         blr                     /* Done */
398
399
400 /*
401  * Flush MMU TLB
402  */
403 _GLOBAL(_tlbia)
404 #if defined(CONFIG_40x)
405         sync                    /* Flush to memory before changing mapping */
406         tlbia
407         isync                   /* Flush shadow TLB */
408 #elif defined(CONFIG_44x)
409         li      r3,0
410         sync
411
412         /* Load high watermark */
413         lis     r4,tlb_44x_hwater@ha
414         lwz     r5,tlb_44x_hwater@l(r4)
415
416 1:      tlbwe   r3,r3,PPC44x_TLB_PAGEID
417         addi    r3,r3,1
418         cmpw    0,r3,r5
419         ble     1b
420
421         isync
422 #elif defined(CONFIG_FSL_BOOKE)
423         /* Invalidate all entries in TLB0 */
424         li      r3, 0x04
425         tlbivax 0,3
426         /* Invalidate all entries in TLB1 */
427         li      r3, 0x0c
428         tlbivax 0,3
429         /* Invalidate all entries in TLB2 */
430         li      r3, 0x14
431         tlbivax 0,3
432         /* Invalidate all entries in TLB3 */
433         li      r3, 0x1c
434         tlbivax 0,3
435         msync
436 #ifdef CONFIG_SMP
437         tlbsync
438 #endif /* CONFIG_SMP */
439 #else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
440 #if defined(CONFIG_SMP)
441         rlwinm  r8,r1,0,0,18
442         lwz     r8,TI_CPU(r8)
443         oris    r8,r8,10
444         mfmsr   r10
445         SYNC
446         rlwinm  r0,r10,0,17,15          /* clear bit 16 (MSR_EE) */
447         rlwinm  r0,r0,0,28,26           /* clear DR */
448         mtmsr   r0
449         SYNC_601
450         isync
451         lis     r9,mmu_hash_lock@h
452         ori     r9,r9,mmu_hash_lock@l
453         tophys(r9,r9)
454 10:     lwarx   r7,0,r9
455         cmpi    0,r7,0
456         bne-    10b
457         stwcx.  r8,0,r9
458         bne-    10b
459         sync
460         tlbia
461         sync
462         TLBSYNC
463         li      r0,0
464         stw     r0,0(r9)                /* clear mmu_hash_lock */
465         mtmsr   r10
466         SYNC_601
467         isync
468 #else /* CONFIG_SMP */
469         sync
470         tlbia
471         sync
472 #endif /* CONFIG_SMP */
473 #endif /* ! defined(CONFIG_40x) */
474         blr
475
476 /*
477  * Flush MMU TLB for a particular address
478  */
479 _GLOBAL(_tlbie)
480 #if defined(CONFIG_40x)
481         tlbsx.  r3, 0, r3
482         bne     10f
483         sync
484         /* There are only 64 TLB entries, so r3 < 64, which means bit 25 is clear.
485          * Since 25 is the V bit in the TLB_TAG, loading this value will invalidate
486          * the TLB entry. */
487         tlbwe   r3, r3, TLB_TAG
488         isync
489 10:
490 #elif defined(CONFIG_44x)
491         mfspr   r4,SPRN_MMUCR
492         mfspr   r5,SPRN_PID                     /* Get PID */
493         rlwimi  r4,r5,0,24,31                   /* Set TID */
494         mtspr   SPRN_MMUCR,r4
495
496         tlbsx.  r3, 0, r3
497         bne     10f
498         sync
499         /* There are only 64 TLB entries, so r3 < 64,
500          * which means bit 22, is clear.  Since 22 is
501          * the V bit in the TLB_PAGEID, loading this
502          * value will invalidate the TLB entry.
503          */
504         tlbwe   r3, r3, PPC44x_TLB_PAGEID
505         isync
506 10:
507 #elif defined(CONFIG_FSL_BOOKE)
508         rlwinm  r4, r3, 0, 0, 19
509         ori     r5, r4, 0x08    /* TLBSEL = 1 */
510         ori     r6, r4, 0x10    /* TLBSEL = 2 */
511         ori     r7, r4, 0x18    /* TLBSEL = 3 */
512         tlbivax 0, r4
513         tlbivax 0, r5
514         tlbivax 0, r6
515         tlbivax 0, r7
516         msync
517 #if defined(CONFIG_SMP)
518         tlbsync
519 #endif /* CONFIG_SMP */
520 #else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
521 #if defined(CONFIG_SMP)
522         rlwinm  r8,r1,0,0,18
523         lwz     r8,TI_CPU(r8)
524         oris    r8,r8,11
525         mfmsr   r10
526         SYNC
527         rlwinm  r0,r10,0,17,15          /* clear bit 16 (MSR_EE) */
528         rlwinm  r0,r0,0,28,26           /* clear DR */
529         mtmsr   r0
530         SYNC_601
531         isync
532         lis     r9,mmu_hash_lock@h
533         ori     r9,r9,mmu_hash_lock@l
534         tophys(r9,r9)
535 10:     lwarx   r7,0,r9
536         cmpi    0,r7,0
537         bne-    10b
538         stwcx.  r8,0,r9
539         bne-    10b
540         eieio
541         tlbie   r3
542         sync
543         TLBSYNC
544         li      r0,0
545         stw     r0,0(r9)                /* clear mmu_hash_lock */
546         mtmsr   r10
547         SYNC_601
548         isync
549 #else /* CONFIG_SMP */
550         tlbie   r3
551         sync
552 #endif /* CONFIG_SMP */
553 #endif /* ! CONFIG_40x */
554         blr
555
556 /*
557  * Flush instruction cache.
558  * This is a no-op on the 601.
559  */
560 _GLOBAL(flush_instruction_cache)
561 #if defined(CONFIG_8xx)
562         isync
563         lis     r5, IDC_INVALL@h
564         mtspr   IC_CST, r5
565 #elif defined(CONFIG_4xx)
566 #ifdef CONFIG_403GCX
567         li      r3, 512
568         mtctr   r3
569         lis     r4, KERNELBASE@h
570 1:      iccci   0, r4
571         addi    r4, r4, 16
572         bdnz    1b
573 #else
574         lis     r3, KERNELBASE@h
575         iccci   0,r3
576 #endif
577 #elif CONFIG_FSL_BOOKE
578         mfspr   r3,SPRN_L1CSR1
579         ori     r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
580         mtspr   SPRN_L1CSR1,r3
581 #else
582         mfspr   r3,PVR
583         rlwinm  r3,r3,16,16,31
584         cmpi    0,r3,1
585         beqlr                   /* for 601, do nothing */
586         /* 603/604 processor - use invalidate-all bit in HID0 */
587         mfspr   r3,HID0
588         ori     r3,r3,HID0_ICFI
589         mtspr   HID0,r3
590 #endif /* CONFIG_8xx/4xx */
591         isync
592         blr
593
594 /*
595  * Write any modified data cache blocks out to memory
596  * and invalidate the corresponding instruction cache blocks.
597  * This is a no-op on the 601.
598  *
599  * flush_icache_range(unsigned long start, unsigned long stop)
600  */
601 _GLOBAL(flush_icache_range)
602         mfspr   r5,PVR
603         rlwinm  r5,r5,16,16,31
604         cmpi    0,r5,1
605         beqlr                           /* for 601, do nothing */
606         li      r5,L1_CACHE_LINE_SIZE-1
607         andc    r3,r3,r5
608         subf    r4,r3,r4
609         add     r4,r4,r5
610         srwi.   r4,r4,LG_L1_CACHE_LINE_SIZE
611         beqlr
612         mtctr   r4
613         mr      r6,r3
614 1:      dcbst   0,r3
615         addi    r3,r3,L1_CACHE_LINE_SIZE
616         bdnz    1b
617         sync                            /* wait for dcbst's to get to ram */
618         mtctr   r4
619 2:      icbi    0,r6
620         addi    r6,r6,L1_CACHE_LINE_SIZE
621         bdnz    2b
622         sync                            /* additional sync needed on g4 */
623         isync
624         blr
625 /*
626  * Write any modified data cache blocks out to memory.
627  * Does not invalidate the corresponding cache lines (especially for
628  * any corresponding instruction cache).
629  *
630  * clean_dcache_range(unsigned long start, unsigned long stop)
631  */
632 _GLOBAL(clean_dcache_range)
633         li      r5,L1_CACHE_LINE_SIZE-1
634         andc    r3,r3,r5
635         subf    r4,r3,r4
636         add     r4,r4,r5
637         srwi.   r4,r4,LG_L1_CACHE_LINE_SIZE
638         beqlr
639         mtctr   r4
640
641 1:      dcbst   0,r3
642         addi    r3,r3,L1_CACHE_LINE_SIZE
643         bdnz    1b
644         sync                            /* wait for dcbst's to get to ram */
645         blr
646
647 /*
648  * Write any modified data cache blocks out to memory and invalidate them.
649  * Does not invalidate the corresponding instruction cache blocks.
650  *
651  * flush_dcache_range(unsigned long start, unsigned long stop)
652  */
653 _GLOBAL(flush_dcache_range)
654         li      r5,L1_CACHE_LINE_SIZE-1
655         andc    r3,r3,r5
656         subf    r4,r3,r4
657         add     r4,r4,r5
658         srwi.   r4,r4,LG_L1_CACHE_LINE_SIZE
659         beqlr
660         mtctr   r4
661
662 1:      dcbf    0,r3
663         addi    r3,r3,L1_CACHE_LINE_SIZE
664         bdnz    1b
665         sync                            /* wait for dcbst's to get to ram */
666         blr
667
668 /*
669  * Like above, but invalidate the D-cache.  This is used by the 8xx
670  * to invalidate the cache so the PPC core doesn't get stale data
671  * from the CPM (no cache snooping here :-).
672  *
673  * invalidate_dcache_range(unsigned long start, unsigned long stop)
674  */
675 _GLOBAL(invalidate_dcache_range)
676         li      r5,L1_CACHE_LINE_SIZE-1
677         andc    r3,r3,r5
678         subf    r4,r3,r4
679         add     r4,r4,r5
680         srwi.   r4,r4,LG_L1_CACHE_LINE_SIZE
681         beqlr
682         mtctr   r4
683
684 1:      dcbi    0,r3
685         addi    r3,r3,L1_CACHE_LINE_SIZE
686         bdnz    1b
687         sync                            /* wait for dcbi's to get to ram */
688         blr
689
690 #ifdef CONFIG_NOT_COHERENT_CACHE
691 /*
692  * 40x cores have 8K or 16K dcache and 32 byte line size.
693  * 44x has a 32K dcache and 32 byte line size.
694  * 8xx has 1, 2, 4, 8K variants.
695  * For now, cover the worst case of the 44x.
696  * Must be called with external interrupts disabled.
697  */
698 #define CACHE_NWAYS     64
699 #define CACHE_NLINES    16
700
701 _GLOBAL(flush_dcache_all)
702         li      r4, (2 * CACHE_NWAYS * CACHE_NLINES)
703         mtctr   r4
704         lis     r5, KERNELBASE@h
705 1:      lwz     r3, 0(r5)               /* Load one word from every line */
706         addi    r5, r5, L1_CACHE_LINE_SIZE
707         bdnz    1b
708         blr
709 #endif /* CONFIG_NOT_COHERENT_CACHE */
710
711 /*
712  * Flush a particular page from the data cache to RAM.
713  * Note: this is necessary because the instruction cache does *not*
714  * snoop from the data cache.
715  * This is a no-op on the 601 which has a unified cache.
716  *
717  *      void __flush_dcache_icache(void *page)
718  */
719 _GLOBAL(__flush_dcache_icache)
720         mfspr   r5,PVR
721         rlwinm  r5,r5,16,16,31
722         cmpi    0,r5,1
723         beqlr                                   /* for 601, do nothing */
724         rlwinm  r3,r3,0,0,19                    /* Get page base address */
725         li      r4,4096/L1_CACHE_LINE_SIZE      /* Number of lines in a page */
726         mtctr   r4
727         mr      r6,r3
728 0:      dcbst   0,r3                            /* Write line to ram */
729         addi    r3,r3,L1_CACHE_LINE_SIZE
730         bdnz    0b
731         sync
732         mtctr   r4
733 1:      icbi    0,r6
734         addi    r6,r6,L1_CACHE_LINE_SIZE
735         bdnz    1b
736         sync
737         isync
738         blr
739
740 /*
741  * Flush a particular page from the data cache to RAM, identified
742  * by its physical address.  We turn off the MMU so we can just use
743  * the physical address (this may be a highmem page without a kernel
744  * mapping).
745  *
746  *      void __flush_dcache_icache_phys(unsigned long physaddr)
747  */
748 _GLOBAL(__flush_dcache_icache_phys)
749         mfspr   r5,PVR
750         rlwinm  r5,r5,16,16,31
751         cmpi    0,r5,1
752         beqlr                                   /* for 601, do nothing */
753         mfmsr   r10
754         rlwinm  r0,r10,0,28,26                  /* clear DR */
755         mtmsr   r0
756         isync
757         rlwinm  r3,r3,0,0,19                    /* Get page base address */
758         li      r4,4096/L1_CACHE_LINE_SIZE      /* Number of lines in a page */
759         mtctr   r4
760         mr      r6,r3
761 0:      dcbst   0,r3                            /* Write line to ram */
762         addi    r3,r3,L1_CACHE_LINE_SIZE
763         bdnz    0b
764         sync
765         mtctr   r4
766 1:      icbi    0,r6
767         addi    r6,r6,L1_CACHE_LINE_SIZE
768         bdnz    1b
769         sync
770         mtmsr   r10                             /* restore DR */
771         isync
772         blr
773
774 /*
775  * Clear pages using the dcbz instruction, which doesn't cause any
776  * memory traffic (except to write out any cache lines which get
777  * displaced).  This only works on cacheable memory.
778  *
779  * void clear_pages(void *page, int order) ;
780  */
781 _GLOBAL(clear_pages)
782         li      r0,4096/L1_CACHE_LINE_SIZE
783         slw     r0,r0,r4
784         mtctr   r0
785 #ifdef CONFIG_8xx
786         li      r4, 0
787 1:      stw     r4, 0(r3)
788         stw     r4, 4(r3)
789         stw     r4, 8(r3)
790         stw     r4, 12(r3)
791 #else
792 1:      dcbz    0,r3
793 #endif
794         addi    r3,r3,L1_CACHE_LINE_SIZE
795         bdnz    1b
796         blr
797
798 /*
799  * Copy a whole page.  We use the dcbz instruction on the destination
800  * to reduce memory traffic (it eliminates the unnecessary reads of
801  * the destination into cache).  This requires that the destination
802  * is cacheable.
803  */
804 #define COPY_16_BYTES           \
805         lwz     r6,4(r4);       \
806         lwz     r7,8(r4);       \
807         lwz     r8,12(r4);      \
808         lwzu    r9,16(r4);      \
809         stw     r6,4(r3);       \
810         stw     r7,8(r3);       \
811         stw     r8,12(r3);      \
812         stwu    r9,16(r3)
813
814 _GLOBAL(copy_page)
815         addi    r3,r3,-4
816         addi    r4,r4,-4
817
818 #ifdef CONFIG_8xx
819         /* don't use prefetch on 8xx */
820         li      r0,4096/L1_CACHE_LINE_SIZE
821         mtctr   r0
822 1:      COPY_16_BYTES
823         bdnz    1b
824         blr
825
826 #else   /* not 8xx, we can prefetch */
827         li      r5,4
828
829 #if MAX_COPY_PREFETCH > 1
830         li      r0,MAX_COPY_PREFETCH
831         li      r11,4
832         mtctr   r0
833 11:     dcbt    r11,r4
834         addi    r11,r11,L1_CACHE_LINE_SIZE
835         bdnz    11b
836 #else /* MAX_COPY_PREFETCH == 1 */
837         dcbt    r5,r4
838         li      r11,L1_CACHE_LINE_SIZE+4
839 #endif /* MAX_COPY_PREFETCH */
840         li      r0,4096/L1_CACHE_LINE_SIZE - MAX_COPY_PREFETCH
841         crclr   4*cr0+eq
842 2:
843         mtctr   r0
844 1:
845         dcbt    r11,r4
846         dcbz    r5,r3
847         COPY_16_BYTES
848 #if L1_CACHE_LINE_SIZE >= 32
849         COPY_16_BYTES
850 #if L1_CACHE_LINE_SIZE >= 64
851         COPY_16_BYTES
852         COPY_16_BYTES
853 #if L1_CACHE_LINE_SIZE >= 128
854         COPY_16_BYTES
855         COPY_16_BYTES
856         COPY_16_BYTES
857         COPY_16_BYTES
858 #endif
859 #endif
860 #endif
861         bdnz    1b
862         beqlr
863         crnot   4*cr0+eq,4*cr0+eq
864         li      r0,MAX_COPY_PREFETCH
865         li      r11,4
866         b       2b
867 #endif  /* CONFIG_8xx */
868
869 /*
870  * void atomic_clear_mask(atomic_t mask, atomic_t *addr)
871  * void atomic_set_mask(atomic_t mask, atomic_t *addr);
872  */
873 _GLOBAL(atomic_clear_mask)
874 10:     lwarx   r5,0,r4
875         andc    r5,r5,r3
876         PPC405_ERR77(0,r4)
877         stwcx.  r5,0,r4
878         bne-    10b
879         blr
880 _GLOBAL(atomic_set_mask)
881 10:     lwarx   r5,0,r4
882         or      r5,r5,r3
883         PPC405_ERR77(0,r4)
884         stwcx.  r5,0,r4
885         bne-    10b
886         blr
887
888 /*
889  * I/O string operations
890  *
891  * insb(port, buf, len)
892  * outsb(port, buf, len)
893  * insw(port, buf, len)
894  * outsw(port, buf, len)
895  * insl(port, buf, len)
896  * outsl(port, buf, len)
897  * insw_ns(port, buf, len)
898  * outsw_ns(port, buf, len)
899  * insl_ns(port, buf, len)
900  * outsl_ns(port, buf, len)
901  *
902  * The *_ns versions don't do byte-swapping.
903  */
904 _GLOBAL(_insb)
905         cmpwi   0,r5,0
906         mtctr   r5
907         subi    r4,r4,1
908         blelr-
909 00:     lbz     r5,0(r3)
910         eieio
911         stbu    r5,1(r4)
912         bdnz    00b
913         blr
914
915 _GLOBAL(_outsb)
916         cmpwi   0,r5,0
917         mtctr   r5
918         subi    r4,r4,1
919         blelr-
920 00:     lbzu    r5,1(r4)
921         stb     r5,0(r3)
922         eieio
923         bdnz    00b
924         blr
925
926 _GLOBAL(_insw)
927         cmpwi   0,r5,0
928         mtctr   r5
929         subi    r4,r4,2
930         blelr-
931 00:     lhbrx   r5,0,r3
932         eieio
933         sthu    r5,2(r4)
934         bdnz    00b
935         blr
936
937 _GLOBAL(_outsw)
938         cmpwi   0,r5,0
939         mtctr   r5
940         subi    r4,r4,2
941         blelr-
942 00:     lhzu    r5,2(r4)
943         eieio
944         sthbrx  r5,0,r3
945         bdnz    00b
946         blr
947
948 _GLOBAL(_insl)
949         cmpwi   0,r5,0
950         mtctr   r5
951         subi    r4,r4,4
952         blelr-
953 00:     lwbrx   r5,0,r3
954         eieio
955         stwu    r5,4(r4)
956         bdnz    00b
957         blr
958
959 _GLOBAL(_outsl)
960         cmpwi   0,r5,0
961         mtctr   r5
962         subi    r4,r4,4
963         blelr-
964 00:     lwzu    r5,4(r4)
965         stwbrx  r5,0,r3
966         eieio
967         bdnz    00b
968         blr
969
970 _GLOBAL(__ide_mm_insw)
971 _GLOBAL(_insw_ns)
972         cmpwi   0,r5,0
973         mtctr   r5
974         subi    r4,r4,2
975         blelr-
976 00:     lhz     r5,0(r3)
977         eieio
978         sthu    r5,2(r4)
979         bdnz    00b
980         blr
981
982 _GLOBAL(__ide_mm_outsw)
983 _GLOBAL(_outsw_ns)
984         cmpwi   0,r5,0
985         mtctr   r5
986         subi    r4,r4,2
987         blelr-
988 00:     lhzu    r5,2(r4)
989         sth     r5,0(r3)
990         eieio
991         bdnz    00b
992         blr
993
994 _GLOBAL(__ide_mm_insl)
995 _GLOBAL(_insl_ns)
996         cmpwi   0,r5,0
997         mtctr   r5
998         subi    r4,r4,4
999         blelr-
1000 00:     lwz     r5,0(r3)
1001         eieio
1002         stwu    r5,4(r4)
1003         bdnz    00b
1004         blr
1005
1006 _GLOBAL(__ide_mm_outsl)
1007 _GLOBAL(_outsl_ns)
1008         cmpwi   0,r5,0
1009         mtctr   r5
1010         subi    r4,r4,4
1011         blelr-
1012 00:     lwzu    r5,4(r4)
1013         stw     r5,0(r3)
1014         eieio
1015         bdnz    00b
1016         blr
1017
1018 /*
1019  * Extended precision shifts.
1020  *
1021  * Updated to be valid for shift counts from 0 to 63 inclusive.
1022  * -- Gabriel
1023  *
1024  * R3/R4 has 64 bit value
1025  * R5    has shift count
1026  * result in R3/R4
1027  *
1028  *  ashrdi3: arithmetic right shift (sign propagation)  
1029  *  lshrdi3: logical right shift
1030  *  ashldi3: left shift
1031  */
1032 _GLOBAL(__ashrdi3)
1033         subfic  r6,r5,32
1034         srw     r4,r4,r5        # LSW = count > 31 ? 0 : LSW >> count
1035         addi    r7,r5,32        # could be xori, or addi with -32
1036         slw     r6,r3,r6        # t1 = count > 31 ? 0 : MSW << (32-count)
1037         rlwinm  r8,r7,0,32      # t3 = (count < 32) ? 32 : 0
1038         sraw    r7,r3,r7        # t2 = MSW >> (count-32)
1039         or      r4,r4,r6        # LSW |= t1
1040         slw     r7,r7,r8        # t2 = (count < 32) ? 0 : t2
1041         sraw    r3,r3,r5        # MSW = MSW >> count
1042         or      r4,r4,r7        # LSW |= t2
1043         blr
1044
1045 _GLOBAL(__ashldi3)
1046         subfic  r6,r5,32
1047         slw     r3,r3,r5        # MSW = count > 31 ? 0 : MSW << count
1048         addi    r7,r5,32        # could be xori, or addi with -32
1049         srw     r6,r4,r6        # t1 = count > 31 ? 0 : LSW >> (32-count)
1050         slw     r7,r4,r7        # t2 = count < 32 ? 0 : LSW << (count-32)
1051         or      r3,r3,r6        # MSW |= t1
1052         slw     r4,r4,r5        # LSW = LSW << count
1053         or      r3,r3,r7        # MSW |= t2
1054         blr
1055
1056 _GLOBAL(__lshrdi3)
1057         subfic  r6,r5,32
1058         srw     r4,r4,r5        # LSW = count > 31 ? 0 : LSW >> count
1059         addi    r7,r5,32        # could be xori, or addi with -32
1060         slw     r6,r3,r6        # t1 = count > 31 ? 0 : MSW << (32-count)
1061         srw     r7,r3,r7        # t2 = count < 32 ? 0 : MSW >> (count-32)
1062         or      r4,r4,r6        # LSW |= t1
1063         srw     r3,r3,r5        # MSW = MSW >> count
1064         or      r4,r4,r7        # LSW |= t2
1065         blr
1066
1067 _GLOBAL(abs)
1068         srawi   r4,r3,31
1069         xor     r3,r3,r4
1070         sub     r3,r3,r4
1071         blr
1072
1073 _GLOBAL(_get_SP)
1074         mr      r3,r1           /* Close enough */
1075         blr
1076
1077 /*
1078  * These are used in the alignment trap handler when emulating
1079  * single-precision loads and stores.
1080  * We restore and save the fpscr so the task gets the same result
1081  * and exceptions as if the cpu had performed the load or store.
1082  */
1083
1084 #if defined(CONFIG_4xx) || defined(CONFIG_E500)
1085 _GLOBAL(cvt_fd)
1086         lfs     0,0(r3)
1087         stfd    0,0(r4)
1088         blr
1089
1090 _GLOBAL(cvt_df)
1091         lfd     0,0(r3)
1092         stfs    0,0(r4)
1093         blr
1094 #else
1095 _GLOBAL(cvt_fd)
1096         lfd     0,-4(r5)        /* load up fpscr value */
1097         mtfsf   0xff,0
1098         lfs     0,0(r3)
1099         stfd    0,0(r4)
1100         mffs    0               /* save new fpscr value */
1101         stfd    0,-4(r5)
1102         blr
1103
1104 _GLOBAL(cvt_df)
1105         lfd     0,-4(r5)        /* load up fpscr value */
1106         mtfsf   0xff,0
1107         lfd     0,0(r3)
1108         stfs    0,0(r4)
1109         mffs    0               /* save new fpscr value */
1110         stfd    0,-4(r5)
1111         blr
1112 #endif
1113
1114 /*
1115  * Create a kernel thread
1116  *   kernel_thread(fn, arg, flags)
1117  */
1118 _GLOBAL(kernel_thread)
1119         stwu    r1,-16(r1)
1120         stw     r30,8(r1)
1121         stw     r31,12(r1)
1122         mr      r30,r3          /* function */
1123         mr      r31,r4          /* argument */
1124         ori     r3,r5,CLONE_VM  /* flags */
1125         oris    r3,r3,CLONE_UNTRACED>>16
1126         li      r4,0            /* new sp (unused) */
1127         li      r0,__NR_clone
1128         sc
1129         cmpi    0,r3,0          /* parent or child? */
1130         bne     1f              /* return if parent */
1131         li      r0,0            /* make top-level stack frame */
1132         stwu    r0,-16(r1)
1133         mtlr    r30             /* fn addr in lr */
1134         mr      r3,r31          /* load arg and call fn */
1135         blrl
1136         li      r0,__NR_exit    /* exit if function returns */
1137         li      r3,0
1138         sc
1139 1:      lwz     r30,8(r1)
1140         lwz     r31,12(r1)
1141         addi    r1,r1,16
1142         blr
1143
1144 /*
1145  * This routine is just here to keep GCC happy - sigh...
1146  */
1147 _GLOBAL(__main)
1148         blr
1149
1150 #define SYSCALL(name) \
1151 _GLOBAL(name) \
1152         li      r0,__NR_##name; \
1153         sc; \
1154         bnslr; \
1155         lis     r4,errno@ha; \
1156         stw     r3,errno@l(r4); \
1157         li      r3,-1; \
1158         blr
1159
1160 SYSCALL(execve)
1161
1162 /* Why isn't this a) automatic, b) written in 'C'? */
1163         .data
1164         .align 4
1165 _GLOBAL(sys_call_table)
1166         .long sys_restart_syscall /* 0 */
1167         .long sys_exit
1168         .long ppc_fork
1169         .long sys_read
1170         .long sys_write
1171         .long sys_open          /* 5 */
1172         .long sys_close
1173         .long sys_waitpid
1174         .long sys_creat
1175         .long sys_link
1176         .long sys_unlink        /* 10 */
1177         .long sys_execve
1178         .long sys_chdir
1179         .long sys_time
1180         .long sys_mknod
1181         .long sys_chmod         /* 15 */
1182         .long sys_lchown
1183         .long sys_ni_syscall                    /* old break syscall holder */
1184         .long sys_stat
1185         .long sys_lseek
1186         .long sys_getpid        /* 20 */
1187         .long sys_mount
1188         .long sys_oldumount
1189         .long sys_setuid
1190         .long sys_getuid
1191         .long sys_stime         /* 25 */
1192         .long sys_ptrace
1193         .long sys_alarm
1194         .long sys_fstat
1195         .long sys_pause
1196         .long sys_utime         /* 30 */
1197         .long sys_ni_syscall                    /* old stty syscall holder */
1198         .long sys_ni_syscall                    /* old gtty syscall holder */
1199         .long sys_access
1200         .long sys_nice
1201         .long sys_ni_syscall    /* 35 */        /* old ftime syscall holder */
1202         .long sys_sync
1203         .long sys_kill
1204         .long sys_rename
1205         .long sys_mkdir
1206         .long sys_rmdir         /* 40 */
1207         .long sys_dup
1208         .long sys_pipe
1209         .long sys_times
1210         .long sys_ni_syscall                    /* old prof syscall holder */
1211         .long sys_brk           /* 45 */
1212         .long sys_setgid
1213         .long sys_getgid
1214         .long sys_signal
1215         .long sys_geteuid
1216         .long sys_getegid       /* 50 */
1217         .long sys_acct
1218         .long sys_umount                        /* recycled never used phys() */
1219         .long sys_ni_syscall                    /* old lock syscall holder */
1220         .long sys_ioctl
1221         .long sys_fcntl         /* 55 */
1222         .long sys_ni_syscall                    /* old mpx syscall holder */
1223         .long sys_setpgid
1224         .long sys_ni_syscall                    /* old ulimit syscall holder */
1225         .long sys_olduname
1226         .long sys_umask         /* 60 */
1227         .long sys_chroot
1228         .long sys_ustat
1229         .long sys_dup2
1230         .long sys_getppid
1231         .long sys_getpgrp       /* 65 */
1232         .long sys_setsid
1233         .long sys_sigaction
1234         .long sys_sgetmask
1235         .long sys_ssetmask
1236         .long sys_setreuid      /* 70 */
1237         .long sys_setregid
1238         .long ppc_sigsuspend
1239         .long sys_sigpending
1240         .long sys_sethostname
1241         .long sys_setrlimit     /* 75 */
1242         .long sys_old_getrlimit
1243         .long sys_getrusage
1244         .long sys_gettimeofday
1245         .long sys_settimeofday
1246         .long sys_getgroups     /* 80 */
1247         .long sys_setgroups
1248         .long ppc_select
1249         .long sys_symlink
1250         .long sys_lstat
1251         .long sys_readlink      /* 85 */
1252         .long sys_uselib
1253         .long sys_swapon
1254         .long sys_reboot
1255         .long old_readdir
1256         .long sys_mmap          /* 90 */
1257         .long sys_munmap
1258         .long sys_truncate
1259         .long sys_ftruncate
1260         .long sys_fchmod
1261         .long sys_fchown        /* 95 */
1262         .long sys_getpriority
1263         .long sys_setpriority
1264         .long sys_ni_syscall                    /* old profil syscall holder */
1265         .long sys_statfs
1266         .long sys_fstatfs       /* 100 */
1267         .long sys_ni_syscall
1268         .long sys_socketcall
1269         .long sys_syslog
1270         .long sys_setitimer
1271         .long sys_getitimer     /* 105 */
1272         .long sys_newstat
1273         .long sys_newlstat
1274         .long sys_newfstat
1275         .long sys_uname
1276         .long sys_ni_syscall    /* 110 */
1277         .long sys_vhangup
1278         .long sys_ni_syscall    /* old 'idle' syscall */
1279         .long sys_ni_syscall
1280         .long sys_wait4
1281         .long sys_swapoff       /* 115 */
1282         .long sys_sysinfo
1283         .long sys_ipc
1284         .long sys_fsync
1285         .long sys_sigreturn
1286         .long ppc_clone         /* 120 */
1287         .long sys_setdomainname
1288         .long sys_newuname
1289         .long sys_ni_syscall
1290         .long sys_adjtimex
1291         .long sys_mprotect      /* 125 */
1292         .long sys_sigprocmask
1293         .long sys_ni_syscall    /* old sys_create_module */
1294         .long sys_init_module
1295         .long sys_delete_module
1296         .long sys_ni_syscall    /* old sys_get_kernel_syms */   /* 130 */
1297         .long sys_quotactl
1298         .long sys_getpgid
1299         .long sys_fchdir
1300         .long sys_bdflush
1301         .long sys_sysfs         /* 135 */
1302         .long sys_personality
1303         .long sys_ni_syscall    /* for afs_syscall */
1304         .long sys_setfsuid
1305         .long sys_setfsgid
1306         .long sys_llseek        /* 140 */
1307         .long sys_getdents
1308         .long ppc_select
1309         .long sys_flock
1310         .long sys_msync
1311         .long sys_readv         /* 145 */
1312         .long sys_writev
1313         .long sys_getsid
1314         .long sys_fdatasync
1315         .long sys_sysctl
1316         .long sys_mlock         /* 150 */
1317         .long sys_munlock
1318         .long sys_mlockall
1319         .long sys_munlockall
1320         .long sys_sched_setparam
1321         .long sys_sched_getparam        /* 155 */
1322         .long sys_sched_setscheduler
1323         .long sys_sched_getscheduler
1324         .long sys_sched_yield
1325         .long sys_sched_get_priority_max
1326         .long sys_sched_get_priority_min  /* 160 */
1327         .long sys_sched_rr_get_interval
1328         .long sys_nanosleep
1329         .long sys_mremap
1330         .long sys_setresuid
1331         .long sys_getresuid     /* 165 */
1332         .long sys_ni_syscall            /* old sys_query_module */
1333         .long sys_poll
1334         .long sys_nfsservctl
1335         .long sys_setresgid
1336         .long sys_getresgid     /* 170 */
1337         .long sys_prctl
1338         .long sys_rt_sigreturn
1339         .long sys_rt_sigaction
1340         .long sys_rt_sigprocmask
1341         .long sys_rt_sigpending /* 175 */
1342         .long sys_rt_sigtimedwait
1343         .long sys_rt_sigqueueinfo
1344         .long ppc_rt_sigsuspend
1345         .long sys_pread64
1346         .long sys_pwrite64      /* 180 */
1347         .long sys_chown
1348         .long sys_getcwd
1349         .long sys_capget
1350         .long sys_capset
1351         .long sys_sigaltstack   /* 185 */
1352         .long sys_sendfile
1353         .long sys_ni_syscall            /* streams1 */
1354         .long sys_ni_syscall            /* streams2 */
1355         .long ppc_vfork
1356         .long sys_getrlimit     /* 190 */
1357         .long sys_readahead
1358         .long sys_mmap2
1359         .long sys_truncate64
1360         .long sys_ftruncate64
1361         .long sys_stat64        /* 195 */
1362         .long sys_lstat64
1363         .long sys_fstat64
1364         .long sys_pciconfig_read
1365         .long sys_pciconfig_write
1366         .long sys_pciconfig_iobase      /* 200 */
1367         .long sys_ni_syscall            /* 201 - reserved - MacOnLinux - new */
1368         .long sys_getdents64
1369         .long sys_pivot_root
1370         .long sys_fcntl64
1371         .long sys_madvise       /* 205 */
1372         .long sys_mincore
1373         .long sys_gettid
1374         .long sys_tkill
1375         .long sys_setxattr
1376         .long sys_lsetxattr     /* 210 */
1377         .long sys_fsetxattr
1378         .long sys_getxattr
1379         .long sys_lgetxattr
1380         .long sys_fgetxattr
1381         .long sys_listxattr     /* 215 */
1382         .long sys_llistxattr
1383         .long sys_flistxattr
1384         .long sys_removexattr
1385         .long sys_lremovexattr
1386         .long sys_fremovexattr  /* 220 */
1387         .long sys_futex
1388         .long sys_sched_setaffinity
1389         .long sys_sched_getaffinity
1390         .long sys_ni_syscall
1391         .long sys_ni_syscall    /* 225 - reserved for Tux */
1392         .long sys_sendfile64
1393         .long sys_io_setup
1394         .long sys_io_destroy
1395         .long sys_io_getevents
1396         .long sys_io_submit     /* 230 */
1397         .long sys_io_cancel
1398         .long sys_set_tid_address
1399         .long sys_fadvise64
1400         .long sys_exit_group
1401         .long sys_lookup_dcookie /* 235 */
1402         .long sys_epoll_create
1403         .long sys_epoll_ctl
1404         .long sys_epoll_wait
1405         .long sys_remap_file_pages
1406         .long sys_timer_create  /* 240 */
1407         .long sys_timer_settime
1408         .long sys_timer_gettime
1409         .long sys_timer_getoverrun
1410         .long sys_timer_delete
1411         .long sys_clock_settime /* 245 */
1412         .long sys_clock_gettime
1413         .long sys_clock_getres
1414         .long sys_clock_nanosleep
1415         .long ppc_swapcontext
1416         .long sys_tgkill        /* 250 */
1417         .long sys_utimes
1418         .long sys_statfs64
1419         .long sys_fstatfs64
1420         .long ppc_fadvise64_64
1421         .long sys_ni_syscall            /* 255 - rtas (used on ppc64) */
1422         .long sys_ni_syscall            /* 256 reserved for sys_debug_setcontext */
1423         .long sys_vserver
1424         .long sys_ni_syscall            /* 258 reserved for new sys_remap_file_pages */
1425         .long sys_ni_syscall            /* 259 reserved for new sys_mbind */
1426         .long sys_ni_syscall            /* 260 reserved for new sys_get_mempolicy */
1427         .long sys_ni_syscall            /* 261 reserved for new sys_set_mempolicy */
1428         .long sys_mq_open
1429         .long sys_mq_unlink
1430         .long sys_mq_timedsend
1431         .long sys_mq_timedreceive       /* 265 */
1432         .long sys_mq_notify
1433         .long sys_mq_getsetattr
1434         .long sys_ni_syscall            /* 268 reserved for sys_kexec_load */