summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/cpu/unix
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/exec/score/cpu/unix')
-rw-r--r--c/src/exec/score/cpu/unix/cpu.c25
-rw-r--r--c/src/exec/score/cpu/unix/cpu.h8
-rw-r--r--c/src/exec/score/cpu/unix/unix.h49
3 files changed, 44 insertions, 38 deletions
diff --git a/c/src/exec/score/cpu/unix/cpu.c b/c/src/exec/score/cpu/unix/cpu.c
index ed94953d58..68397a4e29 100644
--- a/c/src/exec/score/cpu/unix/cpu.c
+++ b/c/src/exec/score/cpu/unix/cpu.c
@@ -35,7 +35,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <string.h>
#include <signal.h>
#include <time.h>
@@ -225,18 +224,28 @@ void _CPU_Context_Initialize(
unsigned32 *_stack_base,
unsigned32 _size,
unsigned32 _new_level,
- proc_ptr *_entry_point
+ void *_entry_point
)
{
unsigned32 *addr;
unsigned32 jmp_addr;
- unsigned32 _stack;
+ unsigned32 _stack_low; /* lowest "stack aligned" address */
+ unsigned32 _stack_high; /* highest "stack aligned" address */
unsigned32 _the_size;
jmp_addr = (unsigned32) _entry_point;
- _stack = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
- _stack &= ~(CPU_STACK_ALIGNMENT - 1);
+ /*
+ * On CPUs with stacks which grow down, we build the stack
+ * based on the _stack_high address. On CPUs with stacks which
+ * grow up, we build the stack based on the _stack_low address.
+ */
+
+ _stack_low = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
+ _stack_low &= ~(CPU_STACK_ALIGNMENT - 1);
+
+ _stack_high = ((unsigned32)(_stack_base) + _size);
+ _stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
_the_size = _size & ~(CPU_STACK_ALIGNMENT - 1);
@@ -250,7 +259,7 @@ void _CPU_Context_Initialize(
#if defined(hppa1_1)
*(addr + RP_OFF) = jmp_addr;
- *(addr + SP_OFF) = (unsigned32)(_stack + CPU_FRAME_SIZE);
+ *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE);
/*
* See if we are using shared libraries by checking
@@ -274,8 +283,8 @@ void _CPU_Context_Initialize(
asm ("ta 0x03"); /* flush registers */
*(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
- *(addr + SP_OFF) = (unsigned32)(_stack +_the_size - CPU_FRAME_SIZE);
- *(addr + FP_OFF) = (unsigned32)(_stack +_the_size);
+ *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
+ *(addr + FP_OFF) = (unsigned32)(_stack_high);
#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 e6b29bcd74..4a016e5879 100644
--- a/c/src/exec/score/cpu/unix/cpu.h
+++ b/c/src/exec/score/cpu/unix/cpu.h
@@ -27,8 +27,10 @@ extern "C" {
#endif
#include <setjmp.h>
-#include <string.h>
-#include <unix.h>
+#include <rtems/unix.h>
+#ifndef ASM
+#include <rtems/unixtypes.h>
+#endif
/* conditional compilation parameters */
@@ -676,7 +678,7 @@ extern void _CPU_Context_Initialize(
unsigned32 *_stack_base,
unsigned32 _size,
unsigned32 _new_level,
- proc_ptr *_entry_point
+ void *_entry_point
);
/* end of Context handler macros */
diff --git a/c/src/exec/score/cpu/unix/unix.h b/c/src/exec/score/cpu/unix/unix.h
index 823bbcfb34..10c4b6917c 100644
--- a/c/src/exec/score/cpu/unix/unix.h
+++ b/c/src/exec/score/cpu/unix/unix.h
@@ -1,6 +1,6 @@
/* unix.h
*
- * This include file contains the basic type definitions required by RTEMS
+ * This include file contains the definitions required by RTEMS
* which are typical for a modern UNIX computer using GCC.
*
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
@@ -11,7 +11,7 @@
* to the copyright license under the clause at DFARS 252.227-7013. This
* notice must appear in all copies of this file and its derivatives.
*
- * $Id$
+ * unix.h,v 1.2 1995/05/09 20:12:28 joel Exp
*/
#ifndef __UNIX_h
@@ -28,12 +28,31 @@ extern "C" {
* with the name of the appropriate macro for this target CPU.
*/
+#ifdef unix
+#undef unix
+#endif
#define unix
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_FAMILY
+#undef REPLACE_THIS_WITH_THE_CPU_FAMILY
+#endif
#define REPLACE_THIS_WITH_THE_CPU_FAMILY
+
+#ifdef REPLACE_THIS_WITH_THE_BSP
+#undef REPLACE_THIS_WITH_THE_BSP
+#endif
#define REPLACE_THIS_WITH_THE_BSP
+
+#ifdef REPLACE_THIS_WITH_THE_CPU_MODEL
+#undef REPLACE_THIS_WITH_THE_CPU_MODEL
+#endif
#define REPLACE_THIS_WITH_THE_CPU_MODEL
+
+#ifdef REPLACE_THIS_WITH_THE_UNIX_FLAVOR
+#undef REPLACE_THIS_WITH_THE_UNIX_FLAVOR
+#endif
#define REPLACE_THIS_WITH_THE_UNIX_FLAVOR
-
+
/*
* This file contains the information required to build
* RTEMS for a particular member of the "unix"
@@ -57,34 +76,10 @@ extern "C" {
#endif
-#ifndef ASM
-
-/* type definitions */
-
-typedef unsigned char unsigned8; /* 8-bit unsigned integer */
-typedef unsigned short unsigned16; /* 16-bit unsigned integer */
-typedef unsigned int unsigned32; /* 32-bit unsigned integer */
-typedef unsigned long long unsigned64; /* 64-bit unsigned integer */
-
-typedef unsigned16 Priority_Bit_map_control;
-
-typedef char signed8; /* 8-bit signed integer */
-typedef short signed16; /* 16-bit signed integer */
-typedef int signed32; /* 32-bit signed integer */
-typedef long long signed64; /* 64-bit signed integer */
-
-typedef unsigned32 boolean; /* Boolean value */
-
-typedef float single_precision; /* single precision float */
-typedef double double_precision; /* double precision float */
-
-typedef void ( *unix_isr_entry )( void );
-
#ifdef __cplusplus
}
#endif
-#endif /* !ASM */
#endif
/* end of include file */