profile-low.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ###############################################################################
  2. #
  3. # Fast profiling interrupt handler
  4. #
  5. # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  6. # Written by David Howells (dhowells@redhat.com)
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public Licence
  10. # as published by the Free Software Foundation; either version
  11. # 2 of the Licence, or (at your option) any later version.
  12. #
  13. ###############################################################################
  14. #include <linux/sys.h>
  15. #include <linux/linkage.h>
  16. #include <asm/segment.h>
  17. #include <asm/smp.h>
  18. #include <asm/intctl-regs.h>
  19. #include <asm/timer-regs.h>
  20. #define pi break
  21. .balign 4
  22. counter:
  23. .long -1
  24. ###############################################################################
  25. #
  26. # Profiling interrupt entry point
  27. # - intended to run at interrupt priority 1
  28. #
  29. ###############################################################################
  30. ENTRY(profile_handler)
  31. movm [d2,d3,a2],(sp)
  32. # ignore userspace
  33. mov (12,sp),d2
  34. and EPSW_nSL,d2
  35. bne out
  36. # do nothing if there's no buffer
  37. mov (prof_buffer),a2
  38. and a2,a2
  39. beq out
  40. or 0x20000000,a2
  41. # calculate relative position in text segment
  42. mov (16,sp),d2
  43. sub _stext,d2
  44. mov (prof_shift),d3
  45. lsr d3,d2
  46. mov (prof_len),d3
  47. cmp d3,d2
  48. bcc outside_text
  49. # increment the appropriate profile bucket
  50. do_inc:
  51. asl2 d2
  52. mov (a2,d2),d3
  53. inc d3
  54. mov d3,(a2,d2)
  55. out:
  56. mov GxICR_DETECT,d2
  57. movbu d2,(TM11ICR) # ACK the interrupt
  58. movbu (TM11ICR),d2
  59. movm (sp),[d2,d3,a2]
  60. rti
  61. outside_text:
  62. sub 1,d3
  63. mov d3,d2
  64. bra do_inc