NG4patch.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* NG4patch.S: Patch Ultra-I routines with Niagara-4 variant.
  2. *
  3. * Copyright (C) 2012 David S. Miller <davem@davemloft.net>
  4. */
  5. #define BRANCH_ALWAYS 0x10680000
  6. #define NOP 0x01000000
  7. #define NG_DO_PATCH(OLD, NEW) \
  8. sethi %hi(NEW), %g1; \
  9. or %g1, %lo(NEW), %g1; \
  10. sethi %hi(OLD), %g2; \
  11. or %g2, %lo(OLD), %g2; \
  12. sub %g1, %g2, %g1; \
  13. sethi %hi(BRANCH_ALWAYS), %g3; \
  14. sll %g1, 11, %g1; \
  15. srl %g1, 11 + 2, %g1; \
  16. or %g3, %lo(BRANCH_ALWAYS), %g3; \
  17. or %g3, %g1, %g3; \
  18. stw %g3, [%g2]; \
  19. sethi %hi(NOP), %g3; \
  20. or %g3, %lo(NOP), %g3; \
  21. stw %g3, [%g2 + 0x4]; \
  22. flush %g2;
  23. .globl niagara4_patch_copyops
  24. .type niagara4_patch_copyops,#function
  25. niagara4_patch_copyops:
  26. NG_DO_PATCH(memcpy, NG4memcpy)
  27. NG_DO_PATCH(___copy_from_user, NG4copy_from_user)
  28. NG_DO_PATCH(___copy_to_user, NG4copy_to_user)
  29. retl
  30. nop
  31. .size niagara4_patch_copyops,.-niagara4_patch_copyops
  32. .globl niagara4_patch_bzero
  33. .type niagara4_patch_bzero,#function
  34. niagara4_patch_bzero:
  35. NG_DO_PATCH(memset, NG4memset)
  36. NG_DO_PATCH(__bzero, NG4bzero)
  37. NG_DO_PATCH(__clear_user, NGclear_user)
  38. NG_DO_PATCH(tsb_init, NGtsb_init)
  39. retl
  40. nop
  41. .size niagara4_patch_bzero,.-niagara4_patch_bzero
  42. .globl niagara4_patch_pageops
  43. .type niagara4_patch_pageops,#function
  44. niagara4_patch_pageops:
  45. NG_DO_PATCH(copy_user_page, NG4copy_user_page)
  46. NG_DO_PATCH(_clear_page, NG4clear_page)
  47. NG_DO_PATCH(clear_user_page, NG4clear_user_page)
  48. retl
  49. nop
  50. .size niagara4_patch_pageops,.-niagara4_patch_pageops