2005-09-27 23:28:01 -04:00
|
|
|
/*
|
|
|
|
* This file contains miscellaneous low-level functions.
|
|
|
|
* Copyright (C) 1995-2005 IBM Corp
|
|
|
|
*
|
|
|
|
* Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
|
|
|
|
* and Paul Mackerras.
|
|
|
|
* Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
|
|
|
|
* PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/asm-offsets.h>
|
[PATCH] powerpc: Consolidate asm compatibility macros
This patch consolidates macros used to generate assembly for
compatibility across different CPUs or configs. A new header,
asm-powerpc/asm-compat.h contains the main compatibility macros. It
uses some preprocessor magic to make the macros suitable both for use
in .S files, and in inline asm in .c files. Headers (bitops.h,
uaccess.h, atomic.h, bug.h) which had their own such compatibility
macros are changed to use asm-compat.h.
ppc_asm.h is now for use in .S files *only*, and a #error enforces
that. As such, we're a lot more careless about namespace pollution
here than in asm-compat.h.
While we're at it, this patch adds a call to the PPC405_ERR77 macro in
futex.h which should have had it already, but didn't.
Built and booted on pSeries, Maple and iSeries (ARCH=powerpc). Built
for 32-bit powermac (ARCH=powerpc) and Walnut (ARCH=ppc).
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-09 20:56:55 -05:00
|
|
|
#include <asm/ppc_asm.h>
|
2005-09-27 23:28:01 -04:00
|
|
|
|
|
|
|
.text
|
|
|
|
|
|
|
|
/* unsigned long local_save_flags(void) */
|
|
|
|
_GLOBAL(local_get_flags)
|
|
|
|
lbz r3,PACAPROCENABLED(r13)
|
|
|
|
blr
|
|
|
|
|
|
|
|
/* unsigned long local_irq_disable(void) */
|
|
|
|
_GLOBAL(local_irq_disable)
|
|
|
|
lbz r3,PACAPROCENABLED(r13)
|
|
|
|
li r4,0
|
|
|
|
stb r4,PACAPROCENABLED(r13)
|
|
|
|
blr /* Done */
|
|
|
|
|
|
|
|
/* void local_irq_restore(unsigned long flags) */
|
|
|
|
_GLOBAL(local_irq_restore)
|
|
|
|
lbz r5,PACAPROCENABLED(r13)
|
|
|
|
/* Check if things are setup the way we want _already_. */
|
|
|
|
cmpw 0,r3,r5
|
|
|
|
beqlr
|
|
|
|
/* are we enabling interrupts? */
|
|
|
|
cmpdi 0,r3,0
|
|
|
|
stb r3,PACAPROCENABLED(r13)
|
|
|
|
beqlr
|
|
|
|
/* Check pending interrupts */
|
|
|
|
/* A decrementer, IPI or PMC interrupt may have occurred
|
|
|
|
* while we were in the hypervisor (which enables) */
|
2006-01-12 18:26:42 -05:00
|
|
|
ld r4,PACALPPACAPTR(r13)
|
|
|
|
ld r4,LPPACAANYINT(r4)
|
2005-09-27 23:28:01 -04:00
|
|
|
cmpdi r4,0
|
|
|
|
beqlr
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle pending interrupts in interrupt context
|
|
|
|
*/
|
|
|
|
li r0,0x5555
|
|
|
|
sc
|
|
|
|
blr
|