summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-07-18 19:27:50 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-07-18 19:27:50 +0000
commit80445331528a5d1b0ce85f095fe27a3b7fdf5a9e (patch)
treeca7d09bddb0a44ead621008d207cb27132864124
parentall built successfully after merge (diff)
downloadrtems-80445331528a5d1b0ce85f095fe27a3b7fdf5a9e.tar.bz2
merged Linux UNIX simulator support (C)
-rw-r--r--c/src/exec/score/cpu/i386/cpu.c3
-rw-r--r--c/src/exec/score/cpu/unix/cpu.c22
-rw-r--r--c/src/exec/score/cpu/unix/cpu.h25
-rw-r--r--c/src/exec/score/cpu/unix/unix.h8
-rw-r--r--cpukit/score/cpu/i386/cpu.c3
-rw-r--r--cpukit/score/cpu/unix/cpu.c22
6 files changed, 76 insertions, 7 deletions
diff --git a/c/src/exec/score/cpu/i386/cpu.c b/c/src/exec/score/cpu/i386/cpu.c
index f2859230e2..cf30fd0b94 100644
--- a/c/src/exec/score/cpu/i386/cpu.c
+++ b/c/src/exec/score/cpu/i386/cpu.c
@@ -73,7 +73,6 @@ void _CPU_Initialize(
*/
#if __GO32__
-#include <cpu.h>
#include <go32.h>
#include <dpmi.h>
#endif /* __GO32__ */
@@ -89,7 +88,7 @@ void _CPU_ISR_install_raw_handler(
*old_handler = 0; /* XXX not supported */
- handler_info.pm_offset = new_handler;
+ handler_info.pm_offset = (u_long) new_handler;
handler_info.pm_selector = _go32_my_cs();
/* install the IDT entry */
diff --git a/c/src/exec/score/cpu/unix/cpu.c b/c/src/exec/score/cpu/unix/cpu.c
index acd53e3fd2..a7e1b3bfce 100644
--- a/c/src/exec/score/cpu/unix/cpu.c
+++ b/c/src/exec/score/cpu/unix/cpu.c
@@ -391,6 +391,28 @@ void _CPU_Context_Initialize(
*(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
*(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
*(addr + FP_OFF) = (unsigned32)(_stack_high);
+
+#elif defined(i386)
+
+ /*
+ * This information was gathered by disassembling setjmp().
+ */
+
+ stack_ptr = _stack_high - CPU_FRAME_SIZE;
+ *(addr + EBX_OFF) = 0xFEEDFEED;
+ *(addr + ESI_OFF) = 0xDEADDEAD;
+ *(addr + EDI_OFF) = 0xDEAFDEAF;
+ *(addr + EBP_OFF) = stack_ptr;
+ *(addr + ESP_OFF) = stack_ptr;
+ *(addr + RET_OFF) = jmp_addr;
+
+
+ addr = (unsigned32 *) stack_ptr;
+
+ addr[ 0 ] = jmp_addr;
+ addr[ 1 ] = (unsigned32) stack_ptr;
+ addr[ 2 ] = (unsigned32) stack_ptr;
+
#else
#error "UNKNOWN CPU!!!"
#endif
diff --git a/c/src/exec/score/cpu/unix/cpu.h b/c/src/exec/score/cpu/unix/cpu.h
index 091f0915b6..90eb6f5216 100644
--- a/c/src/exec/score/cpu/unix/cpu.h
+++ b/c/src/exec/score/cpu/unix/cpu.h
@@ -264,7 +264,7 @@ extern "C" {
#if defined(hppa1_1)
#define CPU_STACK_GROWS_UP TRUE
-#elif defined(sparc)
+#elif defined(sparc) || defined(i386)
#define CPU_STACK_GROWS_UP FALSE
#else
#error "unknown CPU!!"
@@ -362,6 +362,27 @@ extern "C" {
#endif
#endif
+#if defined(i386)
+
+#ifdef RTEMS_NEWLIB
+#error "Newlib not installed"
+#endif
+
+/*
+ * For Linux 1.1
+ */
+
+#ifdef RTEMS_UNIXLIB
+#define EBX_OFF 0
+#define ESI_OFF 1
+#define EDI_OFF 2
+#define EBP_OFF 3
+#define ESP_OFF 4
+#define RET_OFF 5
+#endif
+
+#endif
+
#if defined(sparc)
/*
@@ -515,6 +536,8 @@ EXTERN void (*_CPU_Thread_dispatch_pointer)();
#define CPU_FRAME_SIZE (32 * 4)
#elif defined(sparc)
#define CPU_FRAME_SIZE (112) /* based on disassembled test code */
+#elif defined(i386)
+#define CPU_FRAME_SIZE (24) /* return address, sp, and bp pushed plus fudge */
#else
#error "Unknown CPU!!!"
#endif
diff --git a/c/src/exec/score/cpu/unix/unix.h b/c/src/exec/score/cpu/unix/unix.h
index 10c4b6917c..91afec9517 100644
--- a/c/src/exec/score/cpu/unix/unix.h
+++ b/c/src/exec/score/cpu/unix/unix.h
@@ -64,11 +64,15 @@ extern "C" {
#if defined(hpux)
-#define RTEMS_MODEL_NAME "hpux"
+#define RTEMS_MODEL_NAME "HP-UX"
#elif defined(solaris)
-#define RTEMS_MODEL_NAME "solaris"
+#define RTEMS_MODEL_NAME "Solaris"
+
+#elif defined(linux)
+
+#define RTEMS_MODEL_NAME "Linux"
#else
diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
index f2859230e2..cf30fd0b94 100644
--- a/cpukit/score/cpu/i386/cpu.c
+++ b/cpukit/score/cpu/i386/cpu.c
@@ -73,7 +73,6 @@ void _CPU_Initialize(
*/
#if __GO32__
-#include <cpu.h>
#include <go32.h>
#include <dpmi.h>
#endif /* __GO32__ */
@@ -89,7 +88,7 @@ void _CPU_ISR_install_raw_handler(
*old_handler = 0; /* XXX not supported */
- handler_info.pm_offset = new_handler;
+ handler_info.pm_offset = (u_long) new_handler;
handler_info.pm_selector = _go32_my_cs();
/* install the IDT entry */
diff --git a/cpukit/score/cpu/unix/cpu.c b/cpukit/score/cpu/unix/cpu.c
index acd53e3fd2..a7e1b3bfce 100644
--- a/cpukit/score/cpu/unix/cpu.c
+++ b/cpukit/score/cpu/unix/cpu.c
@@ -391,6 +391,28 @@ void _CPU_Context_Initialize(
*(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
*(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
*(addr + FP_OFF) = (unsigned32)(_stack_high);
+
+#elif defined(i386)
+
+ /*
+ * This information was gathered by disassembling setjmp().
+ */
+
+ stack_ptr = _stack_high - CPU_FRAME_SIZE;
+ *(addr + EBX_OFF) = 0xFEEDFEED;
+ *(addr + ESI_OFF) = 0xDEADDEAD;
+ *(addr + EDI_OFF) = 0xDEAFDEAF;
+ *(addr + EBP_OFF) = stack_ptr;
+ *(addr + ESP_OFF) = stack_ptr;
+ *(addr + RET_OFF) = jmp_addr;
+
+
+ addr = (unsigned32 *) stack_ptr;
+
+ addr[ 0 ] = jmp_addr;
+ addr[ 1 ] = (unsigned32) stack_ptr;
+ addr[ 2 ] = (unsigned32) stack_ptr;
+
#else
#error "UNKNOWN CPU!!!"
#endif