This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / arch / powerpc / platforms / iseries / misc.S
1 /*
2  * This file contains miscellaneous low-level functions.
3  *    Copyright (C) 1995-2005 IBM Corp
4  *
5  * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6  * and Paul Mackerras.
7  * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
8  * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version
13  * 2 of the License, or (at your option) any later version.
14  */
15
16 #include <asm/processor.h>
17 #include <asm/asm-offsets.h>
18 #include <asm/ppc_asm.h>
19
20         .text
21
22 /* unsigned long local_save_flags(void) */
23 _GLOBAL(local_get_flags)
24         lbz     r3,PACAPROCENABLED(r13)
25         blr
26
27 /* unsigned long local_irq_disable(void) */
28 _GLOBAL(local_irq_disable)
29         lbz     r3,PACAPROCENABLED(r13)
30         li      r4,0
31         stb     r4,PACAPROCENABLED(r13)
32         blr                     /* Done */
33
34 /* void local_irq_restore(unsigned long flags) */
35 _GLOBAL(local_irq_restore)
36         lbz     r5,PACAPROCENABLED(r13)
37          /* Check if things are setup the way we want _already_. */
38         cmpw    0,r3,r5
39         beqlr
40         /* are we enabling interrupts? */
41         cmpdi   0,r3,0
42         stb     r3,PACAPROCENABLED(r13)
43         beqlr
44         /* Check pending interrupts */
45         /*   A decrementer, IPI or PMC interrupt may have occurred
46          *   while we were in the hypervisor (which enables) */
47         ld      r4,PACALPPACAPTR(r13)
48         ld      r4,LPPACAANYINT(r4)
49         cmpdi   r4,0
50         beqlr
51
52         /*
53          * Handle pending interrupts in interrupt context
54          */
55         li      r0,0x5555
56         sc
57         blr