entry.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2004-2006 Atmel Corporation
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <asm/sysreg.h>
  23. #include <asm/ptrace.h>
  24. .section .text.exception,"ax"
  25. .global _evba
  26. .type _evba,@function
  27. .align 10
  28. _evba:
  29. .irp x,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
  30. .align 2
  31. rjmp unknown_exception
  32. .endr
  33. .global timer_interrupt_handler
  34. .type timer_interrupt_handler,@function
  35. .align 2
  36. timer_interrupt_handler:
  37. /*
  38. * Increment timer_overflow and re-write COMPARE with 0xffffffff.
  39. *
  40. * We're running at interrupt level 3, so we don't need to save
  41. * r8-r12 or lr to the stack.
  42. */
  43. mov r8, lo(timer_overflow)
  44. orh r8, hi(timer_overflow)
  45. ld.w r9, r8[0]
  46. mov r10, -1
  47. mtsr SYSREG_COMPARE, r10
  48. sub r9, -1
  49. st.w r8[0], r9
  50. rete
  51. .type unknown_exception, @function
  52. unknown_exception:
  53. pushm r0-r12
  54. sub r8, sp, REG_R12 - REG_R0 - 4
  55. mov r9, lr
  56. mfsr r10, SYSREG_RAR_EX
  57. mfsr r11, SYSREG_RSR_EX
  58. pushm r8-r11
  59. mfsr r12, SYSREG_ECR
  60. mov r11, sp
  61. rcall do_unknown_exception
  62. 1: rjmp 1b