Changeset 88d594a in rtems for cpukit/score/cpu/unix/cpu.c


Ignore:
Timestamp:
May 24, 1995, 9:39:42 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5b9d6ddf
Parents:
bf61e45c
Message:

Fully tested on all in-house targets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/unix/cpu.c

    rbf61e45c r88d594a  
    3636#include <stdlib.h>
    3737#include <unistd.h>
    38 #include <string.h>
    3938#include <signal.h>
    4039#include <time.h>
     
    226225  unsigned32        _size,
    227226  unsigned32        _new_level,
    228   proc_ptr         *_entry_point
     227  void             *_entry_point
    229228)
    230229{
    231230    unsigned32  *addr;
    232231    unsigned32   jmp_addr;
    233     unsigned32   _stack;
     232    unsigned32   _stack_low;   /* lowest "stack aligned" address */
     233    unsigned32   _stack_high;  /* highest "stack aligned" address */
    234234    unsigned32   _the_size;
    235235
    236236    jmp_addr = (unsigned32) _entry_point;
    237237
    238     _stack = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
    239     _stack &= ~(CPU_STACK_ALIGNMENT - 1);
     238    /*
     239     *  On CPUs with stacks which grow down, we build the stack
     240     *  based on the _stack_high address.  On CPUs with stacks which
     241     *  grow up, we build the stack based on the _stack_low address. 
     242     */
     243
     244    _stack_low = ((unsigned32)(_stack_base) + CPU_STACK_ALIGNMENT);
     245    _stack_low &= ~(CPU_STACK_ALIGNMENT - 1);
     246
     247    _stack_high = ((unsigned32)(_stack_base) + _size);
     248    _stack_high &= ~(CPU_STACK_ALIGNMENT - 1);
    240249
    241250    _the_size = _size & ~(CPU_STACK_ALIGNMENT - 1);
     
    251260#if defined(hppa1_1)
    252261    *(addr + RP_OFF) = jmp_addr;
    253     *(addr + SP_OFF) = (unsigned32)(_stack + CPU_FRAME_SIZE);
     262    *(addr + SP_OFF) = (unsigned32)(_stack_low + CPU_FRAME_SIZE);
    254263
    255264    /*
     
    275284
    276285    *(addr + RP_OFF) = jmp_addr + ADDR_ADJ_OFFSET;
    277     *(addr + SP_OFF) = (unsigned32)(_stack +_the_size - CPU_FRAME_SIZE);
    278     *(addr + FP_OFF) = (unsigned32)(_stack +_the_size);
     286    *(addr + SP_OFF) = (unsigned32)(_stack_high - CPU_FRAME_SIZE);
     287    *(addr + FP_OFF) = (unsigned32)(_stack_high);
    279288#else
    280289#error "UNKNOWN CPU!!!"
Note: See TracChangeset for help on using the changeset viewer.