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

Untitled

By: a guest on Oct 6th, 2011  |  syntax: None  |  size: 2.95 KB  |  views: 78  |  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. diff --git a/firmware/target/arm/rk27xx/app.lds b/firmware/target/arm/rk27xx/app.lds
  2. index 080c74f..a282a4d 100644
  3. --- a/firmware/target/arm/rk27xx/app.lds
  4. +++ b/firmware/target/arm/rk27xx/app.lds
  5. @@ -89,6 +89,9 @@ SECTIONS
  6.       _fiqstackbegin = .;
  7.       . += 0x400;
  8.       _fiqstackend = .;
  9. +     _svcabtundfstackbegin = .;
  10. +     . += 0x100;
  11. +     _svcabtundfstackend = .;
  12.    } > DRAM
  13.  
  14.    .bss (NOLOAD) : {
  15. diff --git a/firmware/target/arm/rk27xx/crt0.S b/firmware/target/arm/rk27xx/crt0.S
  16. index 4ddae01..c29657f 100644
  17. --- a/firmware/target/arm/rk27xx/crt0.S
  18. +++ b/firmware/target/arm/rk27xx/crt0.S
  19. @@ -156,15 +156,6 @@ newstart2:
  20.      bhi     1b
  21.  #endif
  22.  
  23. -    /* Set up some stack and munge it with 0xdeadbeef */
  24. -    ldr     sp, =stackend
  25. -    ldr     r2, =stackbegin
  26. -    ldr     r3, =0xdeadbeef
  27. -1:
  28. -    cmp     sp, r2
  29. -    strhi   r3, [r2], #4
  30. -    bhi     1b
  31. -
  32.      /* Set up stack for IRQ mode */
  33.      msr     cpsr_c, #0xd2
  34.      ldr     sp, =_irqstackend
  35. @@ -173,14 +164,25 @@ newstart2:
  36.      msr     cpsr_c, #0xd1
  37.      ldr     sp, =_fiqstackend
  38.  
  39. -    /* Let abort and undefined modes use IRQ stack */
  40. +    /* Let svc, abort and undefined modes use separate stack */
  41. +    ldr     sp, =_svcabtundfstackend
  42.      msr     cpsr_c, #0xd7
  43. -    ldr     sp, =_irqstackend
  44. +    ldr     sp, =_svcabtundfstackend
  45.      msr     cpsr_c, #0xdb
  46. -    ldr     sp, =_irqstackend
  47. +    ldr     sp, =_svcabtundfstackend
  48. +
  49. +    /* Switch to sys mode */
  50. +    msr     cpsr_c, #0xdf
  51. +
  52. +    /* Set up some stack and munge it with 0xdeadbeef */
  53. +    ldr     sp, =stackend
  54. +    ldr     r2, =stackbegin
  55. +    ldr     r3, =0xdeadbeef
  56. +1:
  57. +    cmp     sp, r2
  58. +    strhi   r3, [r2], #4
  59. +    bhi     1b
  60.  
  61. -    /* Switch back to supervisor mode */
  62. -    msr     cpsr_c, #0xd3
  63.  
  64.      bl      main
  65.  
  66. @@ -196,12 +198,6 @@ undef_instr_handler:
  67.      mov    r1, #0
  68.      b      UIE
  69.  
  70. -/* We run supervisor mode most of the time, and should never see a software
  71. - * exception being thrown. Perhaps make it illegal and call UIE? */
  72. -software_int_handler:
  73. -reserved_handler:
  74. -    movs   pc, lr
  75. -
  76.  prefetch_abort_handler:
  77.      sub    r0, lr, #4
  78.      mov    r1, #1
  79. @@ -211,3 +207,11 @@ data_abort_handler:
  80.      sub    r0, lr, #8
  81.      mov    r1, #2
  82.      b      UIE
  83. +
  84. +/* We run sys mode most of the time, and should never see a software
  85. + * exception being thrown. Make it illegal and call UIE */
  86. +software_int_handler:
  87. +reserved_handler:
  88. +    sub    r0, lr, #4
  89. +    mov    r1, #5
  90. +    b      UIE
  91. diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c
  92. index 59eaa90..23ccfd1 100644
  93. --- a/firmware/target/arm/system-arm.c
  94. +++ b/firmware/target/arm/system-arm.c
  95. @@ -29,7 +29,8 @@ static const char* const uiename[] = {
  96.      "Undefined instruction",
  97.      "Prefetch abort",
  98.      "Data abort",
  99. -    "Divide by zero"
  100. +    "Divide by zero",
  101. +    "SWI"
  102.  };
  103.  
  104.  /* Unexpected Interrupt or Exception handler. Currently only deals with
  105.  
  106.  
clone this paste RAW Paste Data