Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 16th, 2011  |  syntax: None  |  size: 1.72 KB  |  views: 251  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. .section .vectors,"ax",%progbits
  2. .code 32
  3. .global vectors
  4. vectors:
  5.     b   start
  6.     b   undef_instr_handler
  7.     b   software_int_handler
  8.     b   prefetch_abort_handler
  9.     b   data_abort_handler
  10.     b   reserved_handler
  11.     b   irq_handler
  12.     b   fiq_handler
  13.  
  14. .section    .init.text,"ax",%progbits
  15. .code       32
  16. .align      0x04
  17. .global     start
  18. start:
  19.     msr     cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
  20.     /* Set up some stack and munge it with 0xdeadbeef */
  21.     ldr     sp, =stackend
  22.     ldr     r2, =stackbegin
  23.     ldr     r3, =0xdeadbeef
  24. 1:
  25.     cmp     sp, r2
  26.     strhi   r3, [r2], #4
  27.     bhi     1b
  28.     /* Set up stack for IRQ mode */
  29.     msr     cpsr_c, #0xd2
  30.     ldr     sp, =irq_stack
  31.     /* Set up stack for FIQ mode */
  32.     msr     cpsr_c, #0xd1
  33.     ldr     sp, =fiq_stack
  34.     /* Let abort and undefined modes use IRQ stack */
  35.     msr     cpsr_c, #0xd7
  36.     ldr     sp, =irq_stack
  37.     msr     cpsr_c, #0xdb
  38.     ldr     sp, =irq_stack
  39.     /* Switch back to supervisor mode */
  40.     msr     cpsr_c, #0xd3
  41.     /* Disable MMU, disable caching and buffering;
  42.      * use low exception range address (the core uses high range by default) */
  43.     mrc     p15, 0, r0, c1, c0, 0
  44.     ldr     r1, =0x3005
  45.     bic     r0, r1
  46.     mcr     p15, 0, r0, c1, c0, 0
  47.     /* Go to main */
  48.     bl      main
  49. loop:
  50.     b       loop
  51.  
  52. undef_instr_handler:
  53. software_int_handler:
  54. prefetch_abort_handler:
  55. data_abort_handler:
  56. reserved_handler:
  57.     b       reserved_handler
  58.  
  59. .weak       irq_handler, fiq_handler
  60.  
  61. irq_handler:
  62. fiq_handler:
  63. dead_loop:
  64.     b       dead_loop
  65.  
  66. /* 256 words of IRQ stack */
  67.     .space 256*4
  68. irq_stack:
  69.  
  70. /* 256 words of FIQ stack */
  71.     .space 256*4
  72. fiq_stack:
clone this paste RAW Paste Data