misc.S 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include <asm/processor.h>
  16. #include <asm/asm-offsets.h>
  17. #include <asm/ppc_asm.h>
  18. .text
  19. /* unsigned long local_save_flags(void) */
  20. _GLOBAL(local_get_flags)
  21. lbz r3,PACAPROCENABLED(r13)
  22. blr
  23. /* unsigned long local_irq_disable(void) */
  24. _GLOBAL(local_irq_disable)
  25. lbz r3,PACAPROCENABLED(r13)
  26. li r4,0
  27. stb r4,PACAPROCENABLED(r13)
  28. blr /* Done */
  29. /* void local_irq_restore(unsigned long flags) */
  30. _GLOBAL(local_irq_restore)
  31. lbz r5,PACAPROCENABLED(r13)
  32. /* Check if things are setup the way we want _already_. */
  33. cmpw 0,r3,r5
  34. beqlr
  35. /* are we enabling interrupts? */
  36. cmpdi 0,r3,0
  37. stb r3,PACAPROCENABLED(r13)
  38. beqlr
  39. /* Check pending interrupts */
  40. /* A decrementer, IPI or PMC interrupt may have occurred
  41. * while we were in the hypervisor (which enables) */
  42. ld r4,PACALPPACAPTR(r13)
  43. ld r4,LPPACAANYINT(r4)
  44. cmpdi r4,0
  45. beqlr
  46. /*
  47. * Handle pending interrupts in interrupt context
  48. */
  49. li r0,0x5555
  50. sc
  51. blr