dcr-low.S 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * "Indirect" DCR access
  3. *
  4. * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #include <asm/ppc_asm.h>
  12. #include <asm/processor.h>
  13. #include <asm/bug.h>
  14. #include <asm/export.h>
  15. #define DCR_ACCESS_PROLOG(table) \
  16. cmpli cr0,r3,1024; \
  17. rlwinm r3,r3,4,18,27; \
  18. lis r5,table@h; \
  19. ori r5,r5,table@l; \
  20. add r3,r3,r5; \
  21. bge- 1f; \
  22. mtctr r3; \
  23. bctr; \
  24. 1: trap; \
  25. EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0; \
  26. blr
  27. _GLOBAL(__mfdcr)
  28. DCR_ACCESS_PROLOG(__mfdcr_table)
  29. EXPORT_SYMBOL(__mfdcr)
  30. _GLOBAL(__mtdcr)
  31. DCR_ACCESS_PROLOG(__mtdcr_table)
  32. EXPORT_SYMBOL(__mtdcr)
  33. __mfdcr_table:
  34. mfdcr r3,0; blr
  35. __mtdcr_table:
  36. mtdcr 0,r4; blr
  37. dcr = 1
  38. .rept 1023
  39. mfdcr r3,dcr; blr
  40. mtdcr dcr,r4; blr
  41. dcr = dcr + 1
  42. .endr