This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 3/8] or1k: Store entire context
- From: Stefan Wallentowitz <stefan dot wallentowitz at tum dot de>
- To: newlib at sourceware dot org
- Date: Sun, 17 May 2015 17:04:19 +0200
- Subject: [PATCH 3/8] or1k: Store entire context
- Authentication-results: sourceware.org; auth=none
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.
libgloss/Changelog:
* or1k/exception-asm.S: Store missing state
>From 91ad1f82bfc2e18c7fbb078e52a83d53bfff380f Mon Sep 17 00:00:00 2001
From: Stefan Wallentowitz <stefan.wallentowitz@tum.de>
Date: Wed, 15 Apr 2015 08:47:15 +0200
Subject: [PATCH 3/8] or1k: Store entire context
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.
libgloss/Changelog:
* or1k/exception-asm.S: Store missing state
---
libgloss/or1k/exceptions-asm.S | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libgloss/or1k/exceptions-asm.S b/libgloss/or1k/exceptions-asm.S
index 762a509..91a2d89 100644
--- a/libgloss/or1k/exceptions-asm.S
+++ b/libgloss/or1k/exceptions-asm.S
@@ -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)
@@ -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)
--
2.1.4