summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/nios2
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-08-09 10:28:09 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-08-09 10:28:09 +0000
commit40ae1fd5e64e3e37d422dd204813a1295b3ffc9c (patch)
treed605db2a0f43d7ba125beae42b0a292b77d6f409 /cpukit/score/cpu/nios2
parent2011-08-08 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-40ae1fd5e64e3e37d422dd204813a1295b3ffc9c.tar.bz2
2011-08-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
* cpu_asm.S, rtems/score/cpu.h: There is no need to save the global pointer (gp) in the thread register context since it is a system wide constant and set-up with the C runtime environment.
Diffstat (limited to 'cpukit/score/cpu/nios2')
-rw-r--r--cpukit/score/cpu/nios2/ChangeLog6
-rw-r--r--cpukit/score/cpu/nios2/cpu_asm.S18
-rw-r--r--cpukit/score/cpu/nios2/rtems/score/cpu.h40
3 files changed, 33 insertions, 31 deletions
diff --git a/cpukit/score/cpu/nios2/ChangeLog b/cpukit/score/cpu/nios2/ChangeLog
index 1919af71d2..158de7ebe2 100644
--- a/cpukit/score/cpu/nios2/ChangeLog
+++ b/cpukit/score/cpu/nios2/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * cpu_asm.S, rtems/score/cpu.h: There is no need to save the global
+ pointer (gp) in the thread register context since it is a system wide
+ constant and set-up with the C runtime environment.
+
2011-07-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* cpu.c: Remove /*PAGE markers which were interpreted by a long dead
diff --git a/cpukit/score/cpu/nios2/cpu_asm.S b/cpukit/score/cpu/nios2/cpu_asm.S
index 206fa262f0..c0f6a082f1 100644
--- a/cpukit/score/cpu/nios2/cpu_asm.S
+++ b/cpukit/score/cpu/nios2/cpu_asm.S
@@ -46,12 +46,11 @@ _CPU_Context_switch:
stw r21, 20(r4)
stw r22, 24(r4)
stw r23, 28(r4)
- stw gp, 32(r4)
- stw fp, 36(r4)
- stw sp, 40(r4)
- stw ra, 44(r4)
+ stw fp, 32(r4)
+ stw sp, 36(r4)
+ stw ra, 40(r4)
/* r6 saved status */
- stw r6, 48(r4)
+ stw r6, 44(r4)
_CPU_Context_switch_restore:
@@ -63,15 +62,14 @@ _CPU_Context_switch_restore:
ldw r21, 20(r5)
ldw r22, 24(r5)
ldw r23, 28(r5)
- ldw gp, 32(r5)
- ldw fp, 36(r5)
- ldw sp, 40(r5)
+ ldw fp, 32(r5)
+ ldw sp, 36(r5)
/* Disable interrupts */
wrctl status, r0
- ldw ea, 44(r5)
- ldw at, 48(r5)
+ ldw ea, 40(r5)
+ ldw at, 44(r5)
/* FIXME: Always have interrupts enabled when we return from Context_switch */
ori at, at, 1
wrctl estatus, at
diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h b/cpukit/score/cpu/nios2/rtems/score/cpu.h
index 810671bb73..1d54aaa896 100644
--- a/cpukit/score/cpu/nios2/rtems/score/cpu.h
+++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h
@@ -453,27 +453,27 @@ extern "C" {
*/
/**
- * @ingroup CPUContext Management
- * This defines the minimal set of integer and processor state registers
- * that must be saved during a voluntary context switch from one thread
- * to another.
+ * @brief Thread register context.
+ *
+ * The thread register context covers the non-volatile registers, the thread
+ * stack pointer, the return address, and the processor status.
+ *
+ * There is no need to save the global pointer (gp) since it is a system wide
+ * constant and set-up with the C runtime environment.
*/
typedef struct {
- uint32_t r16;
- uint32_t r17;
- uint32_t r18;
- uint32_t r19;
- uint32_t r20;
- uint32_t r21;
- uint32_t r22;
- uint32_t r23;
- uint32_t gp;
- uint32_t fp;
- uint32_t sp;
- uint32_t ra;
- uint32_t status;
- /* ienable? */
- /* ipending? */
+ uint32_t r16;
+ uint32_t r17;
+ uint32_t r18;
+ uint32_t r19;
+ uint32_t r20;
+ uint32_t r21;
+ uint32_t r22;
+ uint32_t r23;
+ uint32_t fp;
+ uint32_t sp;
+ uint32_t ra;
+ uint32_t status;
} Context_Control;
#define _CPU_Context_Get_SP( _context ) \
@@ -866,9 +866,7 @@ uint32_t _CPU_ISR_Get_level( void );
#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
_isr, _entry_point, _is_fp ) \
do { \
- extern char _gp[]; \
uint32_t _stack = (uint32_t)(_stack_base) + (_size) - 4; \
- (_the_context)->gp = (void *)_gp; \
(_the_context)->fp = (void *)_stack; \
(_the_context)->sp = (void *)_stack; \
(_the_context)->ra = (void *)(_entry_point); \