summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/m68k/rtems
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/cpu/m68k/rtems')
-rw-r--r--cpukit/score/cpu/m68k/rtems/asm.h11
-rw-r--r--cpukit/score/cpu/m68k/rtems/score/cpu.h58
-rw-r--r--cpukit/score/cpu/m68k/rtems/score/m68k.h4
3 files changed, 71 insertions, 2 deletions
diff --git a/cpukit/score/cpu/m68k/rtems/asm.h b/cpukit/score/cpu/m68k/rtems/asm.h
index 9381607dac..851093480e 100644
--- a/cpukit/score/cpu/m68k/rtems/asm.h
+++ b/cpukit/score/cpu/m68k/rtems/asm.h
@@ -96,6 +96,17 @@
#define rambar0 REG (rambar0)
#define mbar REG (mbar)
+/* additional v4e special regs */
+#define rambar1 REG (rambar1)
+#define macsr REG (macsr)
+#define acc0 REG (acc0)
+#define acc1 REG (acc1)
+#define acc2 REG (acc2)
+#define acc3 REG (acc3)
+#define accext01 REG (accext01)
+#define accext23 REG (accext23)
+#define mask REG (mask)
+
#define fp0 REG (fp0)
#define fp1 REG (fp1)
diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h b/cpukit/score/cpu/m68k/rtems/score/cpu.h
index 084d2cf0c9..ddc7432032 100644
--- a/cpukit/score/cpu/m68k/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h
@@ -133,6 +133,13 @@ typedef struct {
void *a5; /* (a5) address register 5 */
void *a6; /* (a6) address register 6 */
void *a7_msp; /* (a7) master stack pointer */
+
+#if (defined(__mcoldfire__))
+#if ( M68K_HAS_FPU == 1 )
+ uint8_t fpu_dis;
+#endif
+#endif
+
} Context_Control;
#define _CPU_Context_Get_SP( _context ) \
@@ -168,12 +175,35 @@ typedef struct {
} _operand2;
} Context_Control_fp;
-#else
+#elif (defined(__mcoldfire__))
/*
- * FP context save area for the M68881/M68882 numeric coprocessors.
+ * FP context save area for the ColdFire core numeric coprocessors
+ */
+typedef struct {
+ uint8_t fp_save_area[84]; /* 16 bytes for FSAVE/FRESTORE */
+ /* 64 bytes for FMOVEM FP0-7 */
+ /* 4 bytes for non-null flag */
+
+#if (M68K_HAS_EMAC == 1)
+
+/*
+ * EMAC context save area for the ColdFire core
*/
+ uint8_t emac_save_area[32]; /* 32 bytes for EMAC registers */
+
+#endif
+} Context_Control_fp;
+
+#if ( M68K_HAS_FPU == 1 )
+extern uint32_t _CPU_cacr_shadow;
+#endif
+
+#else
+/*
+ * FP context save area for the M68881/M68882 numeric coprocessors.
+ */
typedef struct {
uint8_t fp_save_area[332]; /* 216 bytes for FSAVE/FRESTORE */
/* 96 bytes for FMOVEM FP0-7 */
@@ -341,6 +371,7 @@ uint32_t _CPU_ISR_Get_level( void );
* + initialize an FP context area
*/
+#if (defined(__mcoldfire__) && ( M68K_HAS_FPU == 1 ))
#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
_isr, _entry_point, _is_fp ) \
do { \
@@ -350,7 +381,20 @@ uint32_t _CPU_ISR_Get_level( void );
_stack = (uint32_t )(_stack_base) + (_size) - 4; \
(_the_context)->a7_msp = (void *)_stack; \
*(void **)_stack = (void *)(_entry_point); \
+ (_the_context)->fpu_dis = (_is_fp == TRUE) ? 0x00 : 0x10; \
} while ( 0 )
+#else
+#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
+ _isr, _entry_point, _is_fp ) \
+ do { \
+ uint32_t _stack; \
+ \
+ (_the_context)->sr = 0x3000 | ((_isr) << 8); \
+ _stack = (uint32_t )(_stack_base) + (_size) - 4; \
+ (_the_context)->a7_msp = (void *)_stack; \
+ *(void **)_stack = (void *)(_entry_point); \
+ } while ( 0 )
+#endif
#define _CPU_Context_Restart_self( _the_context ) \
{ asm volatile( "movew %0,%%sr ; " \
@@ -396,12 +440,22 @@ uint32_t _CPU_ISR_Get_level( void );
) \
)
+#if (defined(__mcoldfire__) && ( M68K_HAS_FPU == 1 ))
#define _CPU_Context_Initialize_fp( _fp_area ) \
{ uint32_t *_fp_context = (uint32_t *)*(_fp_area); \
\
*(--(_fp_context)) = 0; \
*(_fp_area) = (uint8_t *)(_fp_context); \
+ asm volatile("movl %0,%%macsr": : "d" (0) ); \
}
+#else
+#define _CPU_Context_Initialize_fp( _fp_area ) \
+ { uint32_t *_fp_context = (uint32_t *)*(_fp_area); \
+ \
+ *(--(_fp_context)) = 0; \
+ *(_fp_area) = (uint8_t *)(_fp_context); \
+ }
+#endif
#endif
/* end of Context handler macros */
diff --git a/cpukit/score/cpu/m68k/rtems/score/m68k.h b/cpukit/score/cpu/m68k/rtems/score/m68k.h
index 2a501d64c8..85cf70b1a7 100644
--- a/cpukit/score/cpu/m68k/rtems/score/m68k.h
+++ b/cpukit/score/cpu/m68k/rtems/score/m68k.h
@@ -130,6 +130,10 @@ extern "C" {
*/
# if defined (__mcffpu__)
# define M68K_HAS_FPU 1
+ /*
+ * td: can we be sure that all CFs with FPU also have an EMAC?
+ */
+# define M68K_HAS_EMAC 1
# define M68K_HAS_FPSP_PACKAGE 0
# else
# define M68K_HAS_FPU 0