Ignore:
Timestamp:
Sep 15, 2014, 10:33:28 PM (7 years ago)
Author:
Hesham ALMatary <heshamelmatary@…>
Branches:
4.11, 5, master
Children:
5f56d267
Parents:
7f8a978
git-author:
Hesham ALMatary <heshamelmatary@…> (09/15/14 22:33:28)
git-committer:
Joel Sherrill <joel.sherrill@…> (09/16/14 14:52:56)
Message:

OpenRISC: Account for red-zone (fixup printf bug).

This patch allocate a space in the stack to account for red-zone
that gcc may utilize for the use of leaf functions. Care must be
taken to handle this red-zone from many places:
1- Upon creation of a new thread stack.
2- Once an interrupt entred.

Also moving the enable-thread-dispach() and increment ISR level before
checking if dispatch needed was required.

The previous modifications solved the printf bug which disabled ticker
to output strings after context switches that arise from Thread_Delay_ended.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/or1k/or1k-exception-handler-low.S

    r7f8a978 reb14fc2b  
    9494
    9595  /* Save interrupted task stack pointer */
    96   l.addi r4, r1, 144
     96  l.addi r4, r1, 340
    9797  l.sw   4(r1), r4
    9898
     
    119119   * this point r5 should be holding ISR_NEST_LEVEL value.
    120120   */
    121   l.sfgtui r5, 2
     121  l.sfgtui r5, 1
    122122  l.bf jump_to_c_handler
    123123  l.nop
     
    134134  /* Switch back to the interrupted task stack */
    135135  l.add r1, r14, r0
     136
     137  /* Decrement nesting level */
     138  l.movhi r6, hi(ISR_NEST_LEVEL)
     139  l.ori   r6, r6, lo(ISR_NEST_LEVEL)
     140
     141  /* Enable multitasking */
     142  l.movhi r8, hi(THREAD_DISPATCH_DISABLE_LEVEL)
     143  l.ori   r8, r8, lo(THREAD_DISPATCH_DISABLE_LEVEL)
     144
     145  l.lwz   r5, 0(r6)
     146  l.lwz   r7, 0(r8)
     147  l.addi  r5, r5, -1
     148  l.addi  r7, r7, -1
     149  l.sw    0(r6), r5
     150  l.sw    0(r8), r7
    136151
    137152  /* Check if dispatch needed */
     
    163178  l.lwz  r13,  136(r1)
    164179  l.mtspr r0, r13, CPU_OR1K_SPR_ESR0
    165 
    166   /* Increment nesting level */
    167   l.movhi r6, hi(ISR_NEST_LEVEL)
    168   l.ori   r6, r6, lo(ISR_NEST_LEVEL)
    169 
    170   /* Disable multitasking */
    171   l.movhi r8, hi(THREAD_DISPATCH_DISABLE_LEVEL)
    172   l.ori   r8, r8, lo(THREAD_DISPATCH_DISABLE_LEVEL)
    173 
    174   l.lwz   r5, 0(r6)
    175   l.lwz   r7, 0(r8)
    176   l.addi  r5, r5, -1
    177   l.addi  r7, r7, -1
    178   l.sw    0(r6), r5
    179   l.sw    0(r8), r7
    180180
    181181  l.lwz  r2,  8(r1)
     
    210210  l.lwz  r31, 124(r1)
    211211
     212  /* Unwind exception frame */
    212213  l.addi r1, r1, 140
    213214
    214   l.addi r1, r1, 4
     215  /* Red-zone */
     216  l.addi r1, r1, 200
    215217
    216218  l.rfe
Note: See TracChangeset for help on using the changeset viewer.