Skip to content

Commit

Permalink
Store entire context for or1k
Browse files Browse the repository at this point in the history
- Store the exception program counter (from EPCR) and exception status
  register (from ESR) also during the exception. A runtime system may
  replace them thereby to implement a thread switch.

    * or1k/exception-asm.S: Store missing state
  • Loading branch information
jjohnstn committed May 26, 2015
1 parent 3d4342d commit 40c0aa9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libgloss/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015-05-26 Stefan Wallentowitz <[email protected]>

* or1k/exception-asm.S: Store missing state

2015-05-26 Stefan Wallentowitz <[email protected]>

* or1k/crt0.S: Fix exception stack frame
Expand Down
10 changes: 10 additions & 0 deletions libgloss/or1k/exceptions-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ _or1k_exception_handler:
l.sw GPR_BUF_OFFSET(29)(r1),r29
l.sw GPR_BUF_OFFSET(30)(r1),r30
l.sw GPR_BUF_OFFSET(31)(r1),r31
l.mfspr r14,r0,OR1K_SPR_SYS_EPCR_BASE
l.sw 0x80(r1),r14
l.mfspr r14,r0,OR1K_SPR_SYS_ESR_BASE
l.sw 0x84(r1),r14

/* Replace impure pointer for exception */
l.movhi r20,hi(_or1k_exception_impure_ptr)
Expand Down Expand Up @@ -156,6 +160,12 @@ _or1k_exception_handler:
l.sw 0(r21),r20

/* Restore state */
l.lwz r2,0x80(r1)
l.mtspr r0,r2,OR1K_SPR_SYS_EPCR_BASE

l.lwz r2,0x84(r1)
l.mtspr r0,r2,OR1K_SPR_SYS_ESR_BASE

l.lwz r2,GPR_BUF_OFFSET(2)(r1)
l.lwz r3,GPR_BUF_OFFSET(3)(r1)
l.lwz r4,GPR_BUF_OFFSET(4)(r1)
Expand Down

0 comments on commit 40c0aa9

Please sign in to comment.