entry.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. lda.w r8, timer_overflow
  44. ld.w r9, r8[0]
  45. mov r10, -1
  46. mtsr SYSREG_COMPARE, r10
  47. sub r9, -1
  48. st.w r8[0], r9
  49. rete
  50. .type unknown_exception, @function
  51. unknown_exception:
  52. pushm r0-r12
  53. sub r8, sp, REG_R12 - REG_R0 - 4
  54. mov r9, lr
  55. mfsr r10, SYSREG_RAR_EX
  56. mfsr r11, SYSREG_RSR_EX
  57. pushm r8-r11
  58. mfsr r12, SYSREG_ECR
  59. mov r11, sp
  60. rcall do_unknown_exception
  61. 1: rjmp 1b