misc.S 1.4 KB

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