[PATCH 1/2] cpukit: libcpu: split of i386 CPU code between score and libcpu; Introduction of virtual and native CPU models in libcpu.
philipp.eppelt at mailbox.tu-dresden.de
philipp.eppelt at mailbox.tu-dresden.de
Fri Sep 20 07:22:42 UTC 2013
From: Philipp Eppelt <philipp.eppelt at mailbox.tu-dresden.de>
---
c/src/lib/libcpu/i386/Makefile.am | 44 ++++++++++++
c/src/lib/libcpu/i386/configure.ac | 4 ++
c/src/lib/libcpu/i386/cpu.h | 2 +-
c/src/lib/libcpu/i386/native/cpu-score-split.c | 26 +++++++
.../libcpu/i386/native/include/cpu-score-split.h | 59 ++++++++++++++++
.../i386/native/include/rtems/score/interrupts.h | 81 ++++++++++++++++++++++
c/src/lib/libcpu/i386/preinstall.am | 39 +++++++++++
c/src/lib/libcpu/i386/virtual/cpu-score-split.c | 32 +++++++++
.../libcpu/i386/virtual/include/cpu-score-split.h | 58 ++++++++++++++++
.../i386/virtual/include/rtems/score/interrupts.h | 70 +++++++++++++++++++
cpukit/score/cpu/i386/Makefile.am | 1 -
cpukit/score/cpu/i386/cpu.c | 7 --
cpukit/score/cpu/i386/preinstall.am | 4 --
cpukit/score/cpu/i386/rtems/score/cpu.h | 29 +-------
cpukit/score/cpu/i386/rtems/score/interrupts.h | 81 ----------------------
15 files changed, 417 insertions(+), 120 deletions(-)
create mode 100644 c/src/lib/libcpu/i386/native/cpu-score-split.c
create mode 100644 c/src/lib/libcpu/i386/native/include/cpu-score-split.h
create mode 100644 c/src/lib/libcpu/i386/native/include/rtems/score/interrupts.h
create mode 100644 c/src/lib/libcpu/i386/virtual/cpu-score-split.c
create mode 100644 c/src/lib/libcpu/i386/virtual/include/cpu-score-split.h
create mode 100644 c/src/lib/libcpu/i386/virtual/include/rtems/score/interrupts.h
delete mode 100644 cpukit/score/cpu/i386/rtems/score/interrupts.h
diff --git a/c/src/lib/libcpu/i386/Makefile.am b/c/src/lib/libcpu/i386/Makefile.am
index 0330ba3..25aa90b 100644
--- a/c/src/lib/libcpu/i386/Makefile.am
+++ b/c/src/lib/libcpu/i386/Makefile.am
@@ -4,12 +4,51 @@ noinst_PROGRAMS =
include $(top_srcdir)/../../../automake/compile.am
+if VIRT_POK
+
+
+# insert virtual-pok cpu includes here
+include_libcpudir = $(includedir)/libcpu
+
+include_libcpu_HEADERS = cpu.h cpuModel.h
+include_libcpu_HEADERS += ../shared/include/cache.h
+include_libcpu_HEADERS += byteorder.h
+
+include_libcpu_HEADERS += virtual/include/rtems/score/interrupts.h
+include_libcpu_HEADERS += virtual/include/cpu-score-split.h
+
+noinst_PROGRAMS += cache.rel
+cache_rel_SOURCES = cache.c cache_.h ../shared/src/cache_aligned_malloc.c \
+ ../shared/src/cache_manager.c ../shared/include/cache.h
+cache_rel_CPPFLAGS = $(AM_CPPFLAGS)
+cache_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_PROGRAMS += score.rel
+score_rel_SOURCES = displayCpu.c cpuModel.S cpuModel.h idtr.S cpu.h
+score_rel_SOURCES += virtual/cpu-score-split.c
+score_rel_CPPFLAGS = $(AM_CPPFLAGS)
+score_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+noinst_PROGRAMS += page.rel
+page_rel_SOURCES = page.c cpu.h
+page_rel_CPPFLAGS = $(AM_CPPFLAGS)
+page_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+
+
+else # native
+
+
+
include_libcpudir = $(includedir)/libcpu
include_libcpu_HEADERS = cpu.h cpuModel.h
include_libcpu_HEADERS += ../shared/include/cache.h
include_libcpu_HEADERS += byteorder.h
+include_libcpu_HEADERS += native/include/rtems/score/interrupts.h
+include_libcpu_HEADERS += native/include/cpu-score-split.h
+
noinst_PROGRAMS += cache.rel
cache_rel_SOURCES = cache.c cache_.h ../shared/src/cache_aligned_malloc.c \
../shared/src/cache_manager.c ../shared/include/cache.h
@@ -18,6 +57,7 @@ cache_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
noinst_PROGRAMS += score.rel
score_rel_SOURCES = displayCpu.c cpuModel.S cpuModel.h idtr.S cpu.h
+score_rel_SOURCES += native/cpu-score-split.c
score_rel_CPPFLAGS = $(AM_CPPFLAGS)
score_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
@@ -26,5 +66,9 @@ page_rel_SOURCES = page.c cpu.h
page_rel_CPPFLAGS = $(AM_CPPFLAGS)
page_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+
+
+endif
+
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../automake/local.am
diff --git a/c/src/lib/libcpu/i386/configure.ac b/c/src/lib/libcpu/i386/configure.ac
index 5bc68c1..973971b 100644
--- a/c/src/lib/libcpu/i386/configure.ac
+++ b/c/src/lib/libcpu/i386/configure.ac
@@ -2,6 +2,7 @@
AC_PREREQ([2.69])
AC_INIT([rtems-c-src-lib-libcpu-i386],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
+# check ac_config_srcdir cpuModel.h -- replacement necessary?
AC_CONFIG_SRCDIR([cpuModel.h])
RTEMS_TOP([../../../../..],[../../..])
@@ -19,6 +20,9 @@ AM_PROG_CC_C_O
RTEMS_CANONICALIZE_TOOLS
RTEMS_PROG_CCAS
+AM_CONDITIONAL([VIRT_POK],[test x"$RTEMS_CPU_MODEL" = x"virtual-pok"])
+
+
RTEMS_AMPOLISH3
# Explicitly list all Makefiles here
diff --git a/c/src/lib/libcpu/i386/cpu.h b/c/src/lib/libcpu/i386/cpu.h
index a14ed46..1b39194 100644
--- a/c/src/lib/libcpu/i386/cpu.h
+++ b/c/src/lib/libcpu/i386/cpu.h
@@ -26,7 +26,7 @@
/*
* Interrupt Level Macros
*/
-#include <rtems/score/interrupts.h>
+#include <libcpu/interrupts.h>
/*
* Segment Access Routines
diff --git a/c/src/lib/libcpu/i386/native/cpu-score-split.c b/c/src/lib/libcpu/i386/native/cpu-score-split.c
new file mode 100644
index 0000000..8f858f3
--- /dev/null
+++ b/c/src/lib/libcpu/i386/native/cpu-score-split.c
@@ -0,0 +1,26 @@
+/**
+ * @file
+ *
+ * @brief Virtualization Sensitive i386 Dependent Source
+ *
+ * Part of cpu.c that must be replaced with a virtualization acceptable way to
+ * idle. On i386 "hlt" is used, which is priviledged and causes a GPF.
+ */
+
+#include <rtems/score/cpu.h> // function definition
+
+/**
+ * @brief Idle thread executes idle operation
+ *
+ * If used in a virtualized environment, this executes a call to the
+ * virtualization layer.
+ */
+
+void *_CPU_Thread_Idle_body( uintptr_t ignored )
+{
+ while(1)
+ {
+ __asm__ volatile ("hlt");
+ }
+ return NULL;
+}
diff --git a/c/src/lib/libcpu/i386/native/include/cpu-score-split.h b/c/src/lib/libcpu/i386/native/include/cpu-score-split.h
new file mode 100644
index 0000000..cb0ea6a
--- /dev/null
+++ b/c/src/lib/libcpu/i386/native/include/cpu-score-split.h
@@ -0,0 +1,59 @@
+/**
+ * @file
+ *
+ * @brief Virtualized Sensitive I386 CPU Dependent Source
+ *
+ * This include file contains information for the virtualized i386
+ * architecture.
+ */
+
+#ifndef _RTEMS_LIBCPU_CPU_H
+#define _RTEMS_LIBCPU_CPU_H
+
+#include <rtems/score/i386.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ASM
+
+/*
+ * ISR handler macros
+ *
+ * These macros perform the following functions:
+ * + set a particular level
+ */
+
+#define _CPU_ISR_Set_level( _new_level ) \
+ { \
+ if ( _new_level ) __asm__ volatile ( "cli" ); \
+ else __asm__ volatile ( "sti" ); \
+ }
+
+/*
+ * Fatal Error manager macros
+ *
+ * These macros perform the following functions:
+ * + disable interrupts and halt the CPU
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ { \
+ uint32_t _error_lvalue = ( _error ); \
+ __asm__ volatile ( "cli ; \
+ movl %0,%%eax ; \
+ hlt" \
+ : "=r" ((_error_lvalue)) : "0" ((_error_lvalue)) \
+ ); \
+ }
+
+#endif /* ASM */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _RTEMS_LIBCPU_CPU_H */
diff --git a/c/src/lib/libcpu/i386/native/include/rtems/score/interrupts.h b/c/src/lib/libcpu/i386/native/include/rtems/score/interrupts.h
new file mode 100644
index 0000000..b67cd3d
--- /dev/null
+++ b/c/src/lib/libcpu/i386/native/include/rtems/score/interrupts.h
@@ -0,0 +1,81 @@
+/**
+ * @file
+ *
+ * @brief I386 Interrupt Macros
+ *
+ * Relocated from score/cpu/i386/.
+ */
+
+/*
+ * COPYRIGHT (c) 1998 valette at crf.canon.fr
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * Applications must not include this file directly.
+ */
+
+#ifndef _RTEMS_SCORE_INTERRUPTS_H
+#define _RTEMS_SCORE_INTERRUPTS_H
+
+#ifndef ASM
+
+struct __rtems_raw_irq_connect_data__;
+
+typedef void (*rtems_raw_irq_hdl) (void);
+typedef void (*rtems_raw_irq_enable) (const struct __rtems_raw_irq_connect_data__*);
+typedef void (*rtems_raw_irq_disable) (const struct __rtems_raw_irq_connect_data__*);
+typedef int (*rtems_raw_irq_is_enabled) (const struct __rtems_raw_irq_connect_data__*);
+
+/**
+ * @name Interrupt Level Macros
+ *
+ */
+/**@{**/
+
+#define i386_disable_interrupts( _level ) \
+ { \
+ __asm__ volatile ( "pushf ; \
+ cli ; \
+ pop %0" \
+ : "=rm" ((_level)) \
+ ); \
+ }
+
+#define i386_enable_interrupts( _level ) \
+ { \
+ __asm__ volatile ( "push %0 ; \
+ popf" \
+ : : "rm" ((_level)) : "cc" \
+ ); \
+ }
+
+#define i386_flash_interrupts( _level ) \
+ { \
+ __asm__ volatile ( "push %0 ; \
+ popf ; \
+ cli" \
+ : : "rm" ((_level)) : "cc" \
+ ); \
+ }
+
+#define i386_get_interrupt_level( _level ) \
+ do { \
+ register uint32_t _eflags; \
+ \
+ __asm__ volatile ( "pushf ; \
+ pop %0" \
+ : "=rm" ((_eflags)) \
+ ); \
+ \
+ _level = (_eflags & EFLAGS_INTR_ENABLE) ? 0 : 1; \
+ } while (0)
+
+#define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level )
+#define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level )
+
+/** @} */
+
+#endif
+#endif
diff --git a/c/src/lib/libcpu/i386/preinstall.am b/c/src/lib/libcpu/i386/preinstall.am
index 6f4af52..c749294 100644
--- a/c/src/lib/libcpu/i386/preinstall.am
+++ b/c/src/lib/libcpu/i386/preinstall.am
@@ -13,6 +13,7 @@ all-am: $(PREINSTALL_FILES)
PREINSTALL_FILES =
CLEANFILES = $(PREINSTALL_FILES)
+if VIRT_POK
$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
@$(MKDIR_P) $(PROJECT_INCLUDE)/libcpu
@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
@@ -34,3 +35,41 @@ $(PROJECT_INCLUDE)/libcpu/byteorder.h: byteorder.h $(PROJECT_INCLUDE)/libcpu/$(d
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/byteorder.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/byteorder.h
+$(PROJECT_INCLUDE)/libcpu/interrupts.h: virtual/include/rtems/score/interrupts.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/interrupts.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/interrupts.h
+
+$(PROJECT_INCLUDE)/libcpu/cpu-score-split.h: virtual/include/cpu-score-split.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cpu-score-split.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cpu-score-split.h
+
+else # native
+$(PROJECT_INCLUDE)/libcpu/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_INCLUDE)/libcpu
+ @: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+
+$(PROJECT_INCLUDE)/libcpu/cpu.h: cpu.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cpu.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cpu.h
+
+$(PROJECT_INCLUDE)/libcpu/cpuModel.h: cpuModel.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cpuModel.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cpuModel.h
+
+$(PROJECT_INCLUDE)/libcpu/cache.h: ../shared/include/cache.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cache.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cache.h
+
+$(PROJECT_INCLUDE)/libcpu/byteorder.h: byteorder.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/byteorder.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/byteorder.h
+
+$(PROJECT_INCLUDE)/libcpu/interrupts.h: native/include/rtems/score/interrupts.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/interrupts.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/interrupts.h
+
+$(PROJECT_INCLUDE)/libcpu/cpu-score-split.h: native/include/cpu-score-split.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/cpu-score-split.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/cpu-score-split.h
+endif
diff --git a/c/src/lib/libcpu/i386/virtual/cpu-score-split.c b/c/src/lib/libcpu/i386/virtual/cpu-score-split.c
new file mode 100644
index 0000000..6b84daa
--- /dev/null
+++ b/c/src/lib/libcpu/i386/virtual/cpu-score-split.c
@@ -0,0 +1,32 @@
+/**
+ * @file
+ *
+ * @brief Virtualization Sensitive i386 Dependent Source
+ *
+ * Part of cpu.c that must be replaced with a virtualization acceptable way to
+ * idle. On i386 "hlt" is used, which is priviledged and causes a GPF.
+ */
+
+/*
+ * COPYRIGHT (c) Philipp Eppelt.
+ * philipp.eppelt at mailbox.tu-dresden.de
+ */
+
+#include <rtems/score/cpu.h> // function definition
+#include <virtualizationlayercpu.h>
+
+/**
+ * @brief Idle thread executes idle operation
+ *
+ * If used in a virtualized environment, this executes a call to the
+ * virtualization layer.
+ */
+
+void *_CPU_Thread_Idle_body( uintptr_t ignored )
+{
+ while(1)
+ {
+ _CPU_Virtual_idle_thread();
+ }
+ return NULL;
+}
diff --git a/c/src/lib/libcpu/i386/virtual/include/cpu-score-split.h b/c/src/lib/libcpu/i386/virtual/include/cpu-score-split.h
new file mode 100644
index 0000000..c7ce92b
--- /dev/null
+++ b/c/src/lib/libcpu/i386/virtual/include/cpu-score-split.h
@@ -0,0 +1,58 @@
+/**
+ * @file
+ *
+ * @brief Virtualized Sensitive I386 CPU Dependent Source
+ *
+ * This include file contains information for the virtualized i386
+ * architecture.
+ *
+ * COPYRIGHT (c) 2013 Philipp Eppelt.
+ * philipp.eppelt at mailbox.tu-dresden.de
+ */
+
+#ifndef _RTEMS_LIBCPU_CPU_H
+#define _RTEMS_LIBCPU_CPU_H
+
+#include <rtems/score/i386.h>
+#include <virtualizationlayercpu.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ASM
+
+/*
+ * ISR handler macros
+ *
+ * These macros perform the following functions:
+ * + set a particular level
+ */
+
+
+#define _CPU_ISR_Set_level( _new_level ) \
+ { \
+ if ( _new_level ) _CPU_Virtual_Interrupts_close(); \
+ else _CPU_Virtual_Interrupts_open(); \
+ }
+
+/*
+ * Fatal Error manager macros
+ *
+ * These macros perform the following functions:
+ * + disable interrupts and halt the CPU
+ */
+
+#define _CPU_Fatal_halt( _error ) \
+ { \
+ _CPU_Virtual_Interrupts_close(); \
+ _CPU_Virtual_exec_stop_error( _error ); \
+ }
+
+#endif /* ASM */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTEMS_LIBCPU_CPU_H */
diff --git a/c/src/lib/libcpu/i386/virtual/include/rtems/score/interrupts.h b/c/src/lib/libcpu/i386/virtual/include/rtems/score/interrupts.h
new file mode 100644
index 0000000..2179751
--- /dev/null
+++ b/c/src/lib/libcpu/i386/virtual/include/rtems/score/interrupts.h
@@ -0,0 +1,70 @@
+/**
+ * @file
+ *
+ * @brief I386 Interrupt Macros
+ *
+ * Relocated from score/cpu/i386/.
+ */
+
+/*
+ * COPYRIGHT (c) 2013 Philipp Eppelt.
+ * philipp.eppelt at mailbox.tu-dresden.de
+ *
+ * COPYRIGHT (c) 1998 valette at crf.canon.fr
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * Applications must not include this file directly.
+ */
+
+#ifndef _RTEMS_SCORE_INTERRUPTS_H
+#define _RTEMS_SCORE_INTERRUPTS_H
+
+#ifndef ASM
+
+struct __rtems_raw_irq_connect_data__;
+
+typedef void (*rtems_raw_irq_hdl) (void);
+typedef void (*rtems_raw_irq_enable) (const struct __rtems_raw_irq_connect_data__*);
+typedef void (*rtems_raw_irq_disable) (const struct __rtems_raw_irq_connect_data__*);
+typedef int (*rtems_raw_irq_is_enabled) (const struct __rtems_raw_irq_connect_data__*);
+
+#include <virtualizationlayercpu.h>
+
+
+/**
+ * @name Interrupt Level Macros
+ *
+ */
+/**@{**/
+
+#define i386_disable_interrupts( _level ) \
+ { \
+ _CPU_Virtual_Interrupts_disable( _level ); \
+ }
+
+#define i386_enable_interrupts( _level ) \
+ { \
+ _CPU_Virtual_Interrupts_enable( _level ); \
+ }
+
+#define i386_flash_interrupts( _level ) \
+ { \
+ _CPU_Virtual_Interrupts_enable(_level); \
+ _CPU_Virtual_Interrupts_disable(_level); \
+ }
+
+#define i386_get_interrupt_level( _level ) \
+ { \
+ _CPU_Virtual_Interrupts_get_level( _level ); \
+ }
+
+#define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level )
+#define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level )
+
+/** @} */
+
+#endif
+#endif
diff --git a/cpukit/score/cpu/i386/Makefile.am b/cpukit/score/cpu/i386/Makefile.am
index e35a81c..dc33e93 100644
--- a/cpukit/score/cpu/i386/Makefile.am
+++ b/cpukit/score/cpu/i386/Makefile.am
@@ -7,7 +7,6 @@ include_rtems_scoredir = $(includedir)/rtems/score
include_rtems_score_HEADERS = rtems/score/cpu.h
include_rtems_score_HEADERS += rtems/score/i386.h
include_rtems_score_HEADERS += rtems/score/types.h
-include_rtems_score_HEADERS += rtems/score/interrupts.h
include_rtems_score_HEADERS += rtems/score/registers.h
include_rtems_score_HEADERS += rtems/score/idtr.h
include_rtems_score_HEADERS += rtems/score/cpuatomic.h
diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
index c87a76d..87edd05 100644
--- a/cpukit/score/cpu/i386/cpu.c
+++ b/cpukit/score/cpu/i386/cpu.c
@@ -97,13 +97,6 @@ uint32_t _CPU_ISR_Get_level( void )
return level;
}
-void *_CPU_Thread_Idle_body( uintptr_t ignored )
-{
- while(1){
- __asm__ volatile ("hlt");
- }
- return NULL;
-}
struct Frame_ {
struct Frame_ *up;
diff --git a/cpukit/score/cpu/i386/preinstall.am b/cpukit/score/cpu/i386/preinstall.am
index f9faf87..4519686 100644
--- a/cpukit/score/cpu/i386/preinstall.am
+++ b/cpukit/score/cpu/i386/preinstall.am
@@ -39,10 +39,6 @@ $(PROJECT_INCLUDE)/rtems/score/types.h: rtems/score/types.h $(PROJECT_INCLUDE)/r
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/types.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/types.h
-$(PROJECT_INCLUDE)/rtems/score/interrupts.h: rtems/score/interrupts.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/interrupts.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/interrupts.h
-
$(PROJECT_INCLUDE)/rtems/score/registers.h: rtems/score/registers.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/registers.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/registers.h
diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h
index 43422ed..68b0e53 100644
--- a/cpukit/score/cpu/i386/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
@@ -29,9 +29,9 @@ extern "C" {
#include <rtems/score/types.h>
#include <rtems/score/i386.h>
-
+#include <libcpu/cpu-score-split.h>
#ifndef ASM
-#include <rtems/score/interrupts.h> /* formerly in libcpu/cpu.h> */
+#include <libcpu/interrupts.h> /* formerly in libcpu/cpu.h> */
#include <rtems/score/registers.h> /* formerly part of libcpu */
#endif
@@ -368,6 +368,7 @@ SCORE_EXTERN Context_Control_fp _CPU_Null_fp_context;
* + restore previous interrupt level (enable)
* + temporarily restore interrupts (flash)
* + set a particular level
+ * -> MOVED to libcpu/i386/
*/
#define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level )
@@ -376,12 +377,6 @@ SCORE_EXTERN Context_Control_fp _CPU_Null_fp_context;
#define _CPU_ISR_Flash( _level ) i386_flash_interrupts( _level )
-#define _CPU_ISR_Set_level( _new_level ) \
- { \
- if ( _new_level ) __asm__ volatile ( "cli" ); \
- else __asm__ volatile ( "sti" ); \
- }
-
uint32_t _CPU_ISR_Get_level( void );
/* Make sure interrupt stack has space for ISR
@@ -407,7 +402,6 @@ uint32_t _CPU_ISR_Get_level( void );
* + calculate the initial pointer into a FP context area
* + initialize an FP context area
*/
-
#define CPU_EFLAGS_INTERRUPTS_ON 0x00003202
#define CPU_EFLAGS_INTERRUPTS_OFF 0x00003002
@@ -490,23 +484,6 @@ uint32_t _CPU_ISR_Get_level( void );
/* end of Context handler macros */
-/*
- * Fatal Error manager macros
- *
- * These macros perform the following functions:
- * + disable interrupts and halt the CPU
- */
-
-#define _CPU_Fatal_halt( _error ) \
- { \
- uint32_t _error_lvalue = ( _error ); \
- __asm__ volatile ( "cli ; \
- movl %0,%%eax ; \
- hlt" \
- : "=r" ((_error_lvalue)) : "0" ((_error_lvalue)) \
- ); \
- }
-
#endif /* ASM */
/* end of Fatal Error manager macros */
diff --git a/cpukit/score/cpu/i386/rtems/score/interrupts.h b/cpukit/score/cpu/i386/rtems/score/interrupts.h
deleted file mode 100644
index bed6330..0000000
--- a/cpukit/score/cpu/i386/rtems/score/interrupts.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * @file
- *
- * @brief Intel I386 Interrupt Macros
- *
- * Formerly contained in and extracted from libcpu/i386/cpu.h
- */
-
-/*
- * COPYRIGHT (c) 1998 valette at crf.canon.fr
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * Applications must not include this file directly.
- */
-
-#ifndef _RTEMS_SCORE_INTERRUPTS_H
-#define _RTEMS_SCORE_INTERRUPTS_H
-
-#ifndef ASM
-
-struct __rtems_raw_irq_connect_data__;
-
-typedef void (*rtems_raw_irq_hdl) (void);
-typedef void (*rtems_raw_irq_enable) (const struct __rtems_raw_irq_connect_data__*);
-typedef void (*rtems_raw_irq_disable) (const struct __rtems_raw_irq_connect_data__*);
-typedef int (*rtems_raw_irq_is_enabled) (const struct __rtems_raw_irq_connect_data__*);
-
-/**
- * @name Interrupt Level Macros
- *
- */
-/**@{**/
-
-#define i386_disable_interrupts( _level ) \
- { \
- __asm__ volatile ( "pushf ; \
- cli ; \
- pop %0" \
- : "=rm" ((_level)) \
- ); \
- }
-
-#define i386_enable_interrupts( _level ) \
- { \
- __asm__ volatile ( "push %0 ; \
- popf" \
- : : "rm" ((_level)) : "cc" \
- ); \
- }
-
-#define i386_flash_interrupts( _level ) \
- { \
- __asm__ volatile ( "push %0 ; \
- popf ; \
- cli" \
- : : "rm" ((_level)) : "cc" \
- ); \
- }
-
-#define i386_get_interrupt_level( _level ) \
- do { \
- register uint32_t _eflags; \
- \
- __asm__ volatile ( "pushf ; \
- pop %0" \
- : "=rm" ((_eflags)) \
- ); \
- \
- _level = (_eflags & EFLAGS_INTR_ENABLE) ? 0 : 1; \
- } while (0)
-
-#define _CPU_ISR_Disable( _level ) i386_disable_interrupts( _level )
-#define _CPU_ISR_Enable( _level ) i386_enable_interrupts( _level )
-
-/** @} */
-
-#endif
-#endif
--
1.8.1.4
More information about the devel
mailing list