summaryrefslogtreecommitdiffstats
path: root/schedsim/rtems/sched_cpu/rtems
diff options
context:
space:
mode:
Diffstat (limited to 'schedsim/rtems/sched_cpu/rtems')
-rw-r--r--schedsim/rtems/sched_cpu/rtems/score/asm.h120
-rw-r--r--schedsim/rtems/sched_cpu/rtems/score/cpu.h34
-rw-r--r--schedsim/rtems/sched_cpu/rtems/score/cpuatomic.h14
3 files changed, 151 insertions, 17 deletions
diff --git a/schedsim/rtems/sched_cpu/rtems/score/asm.h b/schedsim/rtems/sched_cpu/rtems/score/asm.h
new file mode 100644
index 0000000..a2b11f6
--- /dev/null
+++ b/schedsim/rtems/sched_cpu/rtems/score/asm.h
@@ -0,0 +1,120 @@
+/**
+ * @file
+ *
+ * @brief Address the Problems Caused by Incompatible Flavor of
+ * Assemblers and Toolsets
+ *
+ * This include file attempts to address the problems
+ * caused by incompatible flavors of assemblers and
+ * toolsets. It primarily addresses variations in the
+ * use of leading underscores on symbols and the requirement
+ * that register names be preceded by a %.
+ *
+ * NOTE: The spacing in the use of these macros
+ * is critical to them working as advertised.
+ */
+
+/*
+ * COPYRIGHT:
+ *
+ * This file is based on similar code found in newlib available
+ * from ftp.cygnus.com. The file which was used had no copyright
+ * notice. This file is freely distributable as long as the source
+ * of the file is noted.
+ */
+
+#ifndef _RTEMS_ASM_H
+#define _RTEMS_ASM_H
+
+/*
+ * Indicate we are in an assembly file and get the basic CPU definitions.
+ */
+
+#ifndef ASM
+#define ASM
+#endif
+
+#include <rtems/score/cpuopts.h>
+#include <rtems/score/cpu.h>
+
+/*
+ * Recent versions of GNU cpp define variables which indicate the
+ * need for underscores and percents. If not using GNU cpp or
+ * the version does not support this, then you will obviously
+ * have to define these as appropriate.
+ */
+
+/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
+/* XXX The following ifdef magic fixes the problem but results in a warning */
+/* XXX when compiling assembly code. */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+#include <rtems/concat.h>
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+/*
+ * define macros for all of the registers on this CPU
+ *
+ * EXAMPLE: #define d0 REG (d0)
+ */
+
+/*
+ * Define macros to handle section beginning and ends.
+ */
+
+
+#define BEGIN_CODE_DCL .text
+#define END_CODE_DCL
+#define BEGIN_DATA_DCL .data
+#define END_DATA_DCL
+#define BEGIN_CODE .text
+#define END_CODE
+#define BEGIN_DATA
+#define END_DATA
+#define BEGIN_BSS
+#define END_BSS
+#define END
+
+/*
+ * Following must be tailor for a particular flavor of the C compiler.
+ * They may need to put underscores in front of the symbols.
+ */
+
+#define PUBLIC(sym) .globl SYM (sym)
+#define EXTERN(sym) .globl SYM (sym)
+
+/*
+ * Entry for traps which jump to a programmer-specified trap handler.
+ */
+
+#define TRAP(_vector, _handler) \
+ mov %psr, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ mov _vector, %l3
+
+/*
+ * Used for the reset trap to avoid a supervisor instruction
+ */
+
+#define RTRAP(_vector, _handler) \
+ mov %g0, %l0 ; \
+ sethi %hi(_handler), %l4 ; \
+ jmp %l4+%lo(_handler); \
+ mov _vector, %l3
+
+#endif
diff --git a/schedsim/rtems/sched_cpu/rtems/score/cpu.h b/schedsim/rtems/sched_cpu/rtems/score/cpu.h
index 219a347..03817fc 100644
--- a/schedsim/rtems/sched_cpu/rtems/score/cpu.h
+++ b/schedsim/rtems/sched_cpu/rtems/score/cpu.h
@@ -720,6 +720,11 @@ SCORE_EXTERN void *_CPU_Interrupt_stack_high;
#define _CPU_Initialize_vectors()
/**
+ * XXX fake cpu isr level variable
+ */
+extern int _CPU_ISR_level_on_sched_cpu;
+
+/**
* @ingroup CPUInterrupt
* Disable all interrupts for an RTEMS critical section. The previous
* level is returned in @a _isr_cookie.
@@ -732,7 +737,8 @@ SCORE_EXTERN void *_CPU_Interrupt_stack_high;
*/
#define _CPU_ISR_Disable( _isr_cookie ) \
{ \
- (_isr_cookie) = 0; /* do something to prevent warnings */ \
+ (_isr_cookie) = _CPU_ISR_level_on_sched_cpu; \
+ _CPU_ISR_level_on_sched_cpu = 1; \
}
/**
@@ -749,6 +755,7 @@ SCORE_EXTERN void *_CPU_Interrupt_stack_high;
*/
#define _CPU_ISR_Enable( _isr_cookie ) \
{ \
+ _CPU_ISR_level_on_sched_cpu = (_isr_cookie); \
}
/**
@@ -787,6 +794,7 @@ SCORE_EXTERN void *_CPU_Interrupt_stack_high;
*/
#define _CPU_ISR_Set_level( new_level ) \
{ \
+ _CPU_ISR_level_on_sched_cpu = (new_level); \
}
/**
@@ -800,7 +808,7 @@ SCORE_EXTERN void *_CPU_Interrupt_stack_high;
*
* XXX document implementation including references if appropriate
*/
-uint32_t _CPU_ISR_Get_level( void );
+#define _CPU_ISR_Get_level() (uint32_t) _CPU_ISR_level_on_sched_cpu
/* end of ISR handler macros */
@@ -1220,21 +1228,13 @@ void _CPU_Context_restore_fp(
#ifdef RTEMS_SMP
#define _CPU_Context_switch_to_first_task_smp(_context )
- RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
- _CPU_SMP_Get_current_processor( void )
- {
- return 0;
- }
-
- #define _CPU_SMP_Send_interrupt( dest);
-
- static inline void _CPU_SMP_Processor_event_broadcast( void )
- {
- }
-
- static inline void _CPU_SMP_Processor_event_receive( void )
- {
- }
+ uint32_t _CPU_SMP_Get_current_processor( void );
+ uint32_t _CPU_SMP_Initialize( void );
+ bool _CPU_SMP_Start_processor( uint32_t cpu_index );
+ void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
+ void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
+ void _CPU_SMP_Processor_event_broadcast( void );
+ void _CPU_SMP_Processor_event_receive( void );
#endif
typedef struct {
uint32_t trap;
diff --git a/schedsim/rtems/sched_cpu/rtems/score/cpuatomic.h b/schedsim/rtems/sched_cpu/rtems/score/cpuatomic.h
new file mode 100644
index 0000000..598ee76
--- /dev/null
+++ b/schedsim/rtems/sched_cpu/rtems/score/cpuatomic.h
@@ -0,0 +1,14 @@
+/*
+ * COPYRIGHT (c) 2012-2013 Deng Hengyi.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_ATOMIC_CPU_H
+#define _RTEMS_SCORE_ATOMIC_CPU_H
+
+#include <rtems/score/cpustdatomic.h>
+
+#endif /* _RTEMS_SCORE_ATOMIC_CPU_H */