Changeset 726b27c in rtems-schedsim


Ignore:
Timestamp:
Dec 13, 2013, 5:01:48 PM (5 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
8703c13
Parents:
9a34e3a
git-author:
Joel Sherrill <joel.sherrill@…> (12/13/13 17:01:48)
git-committer:
Joel Sherrill <joel.sherrill@…> (04/28/14 16:33:52)
Message:

schedsim: Update to latest RTEMS. Works Uniprocessor

Location:
schedsim
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • schedsim/rtems/Makefile.am

    r9a34e3a r726b27c  
    99librtems_a_CPPFLAGS += -I$(cpukitdir)/include
    1010librtems_a_CPPFLAGS += -I$(cpukitdir)/score/include
    11 librtems_a_CPPFLAGS += -I$(cpukitdir)/score/inline
    1211librtems_a_CPPFLAGS += -I$(cpukitdir)/rtems/include
    13 librtems_a_CPPFLAGS += -I$(cpukitdir)/rtems/inline
    1412librtems_a_CPPFLAGS += -I$(cpukitdir)/sapi/include
    15 librtems_a_CPPFLAGS += -I$(cpukitdir)/sapi/inline
    1613librtems_a_CPPFLAGS += -I$(cpukitdir)/libcsupport/include
    1714librtems_a_CPPFLAGS += -I$(cpukitdir)/libmisc/stringto
     
    3229librtems_a_SOURCES += $(cpukitdir)/score/src/percpu.c
    3330librtems_a_SOURCES += $(cpukitdir)/score/src/apiext.c
    34 librtems_a_SOURCES += $(cpukitdir)/score/src/apimutexallocate.c
    3531librtems_a_SOURCES += $(cpukitdir)/score/src/apimutex.c
    3632librtems_a_SOURCES += $(cpukitdir)/score/src/apimutexlock.c
     
    5349librtems_a_SOURCES += $(cpukitdir)/score/src/coretodget.c
    5450librtems_a_SOURCES += $(cpukitdir)/score/src/coretodgetuptimetimespec.c
     51librtems_a_SOURCES += $(cpukitdir)/score/src/coretodsecondssinceepoch.c
    5552librtems_a_SOURCES += $(cpukitdir)/score/src/coretodset.c
    5653librtems_a_SOURCES += $(cpukitdir)/score/src/coretodtickle.c
    5754librtems_a_SOURCES += $(cpukitdir)/score/src/coretodtickspersec.c
    58 librtems_a_SOURCES += $(cpukitdir)/score/src/coretodusectoticks.c
     55librtems_a_SOURCES += $(cpukitdir)/score/src/freechain.c
    5956librtems_a_SOURCES += $(cpukitdir)/score/src/isr.c
     57librtems_a_SOURCES += $(cpukitdir)/score/src/log2table.c
    6058librtems_a_SOURCES += $(cpukitdir)/score/src/objectallocate.c
    6159librtems_a_SOURCES += $(cpukitdir)/score/src/objectapimaximumclass.c
     
    7775librtems_a_SOURCES += $(cpukitdir)/score/src/objectsetname.c
    7876librtems_a_SOURCES += $(cpukitdir)/score/src/objectshrinkinformation.c
     77librtems_a_SOURCES += $(cpukitdir)/score/src/rbtree.c
     78librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreeextract.c
     79librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreefind.c
     80librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreeinsert.c
     81librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreeiterate.c
     82librtems_a_SOURCES += $(cpukitdir)/score/src/rbtreenext.c
    7983librtems_a_SOURCES += $(cpukitdir)/score/src/scheduler.c
    80 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityallocate.c
     84librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultallocatefree.c
     85librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultreleasejob.c
     86librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultstartidle.c
     87librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaulttick.c
     88librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerdefaultupdate.c
     89
     90# Uniprocessor Deterministic Scheduler
    8191librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityblock.c
    8292librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriority.c
    83 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerprioritytick.c
    8493librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityenqueue.c
    8594librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityenqueuefirst.c
    8695librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityextract.c
    87 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityfree.c
    8896librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityprioritycompare.c
    89 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityreleasejob.c
    9097librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityschedule.c
    9198librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityunblock.c
    9299librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityupdate.c
    93100librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerpriorityyield.c
     101
     102# Uniprocessor Scheduler Simple
    94103librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimpleblock.c
    95104librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimple.c
     
    102111librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimpleunblock.c
    103112librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimpleyield.c
     113
    104114librtems_a_SOURCES += $(cpukitdir)/score/src/thread.c
    105115librtems_a_SOURCES += $(cpukitdir)/score/src/threadchangepriority.c
    106116librtems_a_SOURCES += $(cpukitdir)/score/src/threadclearstate.c
    107 librtems_a_SOURCES += $(cpukitdir)/score/src/threadclose.c
    108117librtems_a_SOURCES += $(cpukitdir)/score/src/threadcreateidle.c
    109118librtems_a_SOURCES += $(cpukitdir)/score/src/threaddelayended.c
     
    114123librtems_a_SOURCES += $(cpukitdir)/score/src/threadloadenv.c
    115124librtems_a_SOURCES += $(cpukitdir)/score/src/threadready.c
    116 librtems_a_SOURCES += $(cpukitdir)/score/src/threadreset.c
    117125librtems_a_SOURCES += $(cpukitdir)/score/src/threadrestart.c
    118126librtems_a_SOURCES += $(cpukitdir)/score/src/threadsetpriority.c
     
    159167librtems_a_SOURCES += $(cpukitdir)/score/src/watchdog.c
    160168librtems_a_SOURCES += $(cpukitdir)/score/src/watchdoginsert.c
    161 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdognanoseconds.c
    162169librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogremove.c
    163 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogreport.c
    164 librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogreportchain.c
    165170librtems_a_SOURCES += $(cpukitdir)/score/src/watchdogtickle.c
    166171librtems_a_SOURCES += $(cpukitdir)/sapi/src/debug.c
     
    185190librtems_a_SOURCES += $(cpukitdir)/rtems/src/semrelease.c
    186191librtems_a_SOURCES += $(cpukitdir)/rtems/src/semtranslatereturncode.c
     192librtems_a_SOURCES += $(cpukitdir)/rtems/src/signalcatch.c
    187193librtems_a_SOURCES += $(cpukitdir)/rtems/src/status.c
     194librtems_a_SOURCES += $(cpukitdir)/rtems/src/statustext.c
    188195librtems_a_SOURCES += $(cpukitdir)/rtems/src/tasks.c
    189196librtems_a_SOURCES += $(cpukitdir)/rtems/src/taskdata.c
     
    199206librtems_a_SOURCES += $(cpukitdir)/rtems/src/taskmode.c
    200207librtems_a_SOURCES += $(cpukitdir)/rtems/src/taskwakeafter.c
     208librtems_a_SOURCES += $(cpukitdir)/posix/src/key.c
     209librtems_a_SOURCES += $(cpukitdir)/posix/src/keyfreememory.c
     210librtems_a_SOURCES += $(cpukitdir)/posix/src/keyrundestructors.c
    201211librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assoclocalbyname.c
    202212librtems_a_SOURCES += $(cpukitdir)/libcsupport/src/assoclocalbyremotebitfield.c
     
    229239if HAS_SMP
    230240librtems_a_SOURCES += $(cpukitdir)/score/src/smp.c
    231 librtems_a_SOURCES += $(cpukitdir)/score/src/smplock.c
    232 librtems_a_SOURCES += $(cpukitdir)/score/src/isrsmp.c
    233241librtems_a_SOURCES += $(cpukitdir)/score/src/threaddisabledispatch.c
    234242librtems_a_SOURCES += $(cpukitdir)/score/src/threadenabledispatch.c
    235243librtems_a_SOURCES += $(cpukitdir)/score/src/threaddispatchdisablelevel.c
    236 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpblock.c
    237 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpschedule.c
    238 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmptick.c
    239 librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmpunblock.c
     244librtems_a_SOURCES += $(cpukitdir)/score/src/schedulerprioritysmp.c
     245librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersimplesmp.c
     246librtems_a_SOURCES += $(cpukitdir)/score/src/schedulersmpstartidle.c
    240247endif
    241248
     
    252259  ${cpukitdir}/score/include/rtems/system.h \
    253260  ${cpukitdir}/score/include/rtems/debug.h \
    254   ${cpukitdir}/score/include/rtems/bspsmp.h \
    255261  ${cpukitdir}/include/rtems/bspIo.h \
    256262  $(cpukitdir)/sapi/include/rtems/fatal.h \
     
    323329  ${cpukitdir}/score/include/rtems/score/schedulersimple.h \
    324330  ${cpukitdir}/score/include/rtems/score/timespec.h \
    325   ${cpukitdir}/score/include/rtems/score/tqdata.h \
    326   ${cpukitdir}/score/include/rtems/score/bitfield.h \
    327331  ${cpukitdir}/score/include/rtems/score/interr.h \
    328   $(cpukitdir)/score/inline/rtems/score/address.inl \
    329   $(cpukitdir)/score/inline/rtems/score/corespinlock.inl \
    330   $(cpukitdir)/score/inline/rtems/score/priority.inl \
    331   $(cpukitdir)/score/inline/rtems/score/threadmp.inl \
    332   $(cpukitdir)/score/inline/rtems/score/chain.inl \
    333   $(cpukitdir)/score/inline/rtems/score/heap.inl \
    334   $(cpukitdir)/score/inline/rtems/score/scheduler.inl \
    335   $(cpukitdir)/score/inline/rtems/score/threadq.inl \
    336   $(cpukitdir)/score/inline/rtems/score/corebarrier.inl \
    337   $(cpukitdir)/score/inline/rtems/score/isr.inl \
    338   $(cpukitdir)/score/inline/rtems/score/schedulerpriority.inl \
    339   $(cpukitdir)/score/inline/rtems/score/tod.inl \
    340   $(cpukitdir)/score/inline/rtems/score/coremsg.inl \
    341   $(cpukitdir)/score/inline/rtems/score/mppkt.inl \
    342   $(cpukitdir)/score/inline/rtems/score/stack.inl \
    343   $(cpukitdir)/score/inline/rtems/score/tqdata.inl \
    344   $(cpukitdir)/score/inline/rtems/score/coremutex.inl \
    345   $(cpukitdir)/score/inline/rtems/score/object.inl \
    346   $(cpukitdir)/score/inline/rtems/score/states.inl \
    347   $(cpukitdir)/score/inline/rtems/score/watchdog.inl \
    348   $(cpukitdir)/score/inline/rtems/score/corerwlock.inl \
    349   $(cpukitdir)/score/inline/rtems/score/objectmp.inl \
    350   $(cpukitdir)/score/inline/rtems/score/sysstate.inl \
    351   $(cpukitdir)/score/inline/rtems/score/wkspace.inl \
    352   $(cpukitdir)/score/inline/rtems/score/coresem.inl \
    353   $(cpukitdir)/score/inline/rtems/score/prioritybitmap.inl \
    354   $(cpukitdir)/score/inline/rtems/score/thread.inl \
    355332  sched_cpu/rtems/score/cpu_asm.h \
    356333  $(top_builddir)/score/include/rtems/score/cpuopts.h \
     
    368345  ${cpukitdir}/rtems/include/rtems/rtems/ratemon.h \
    369346  ${cpukitdir}/rtems/include/rtems/rtems/rtemsapi.h \
    370   ${cpukitdir}/rtems/include/rtems/rtems/eventset.h \
    371347  ${cpukitdir}/rtems/include/rtems/rtems/mp.h \
    372348  ${cpukitdir}/rtems/include/rtems/rtems/dpmem.h \
     
    394370  ${cpukitdir}/rtems/include/rtems/rtems/signal.h \
    395371  ${cpukitdir}/rtems/include/rtems/rtems/barrier.h \
    396   ${cpukitdir}/rtems/include/rtems/rtems/tasks.h \
    397   $(cpukitdir)/rtems/inline/rtems/rtems/asr.inl  \
    398   $(cpukitdir)/rtems/inline/rtems/rtems/eventset.inl \
    399   $(cpukitdir)/rtems/inline/rtems/rtems/ratemon.inl \
    400   $(cpukitdir)/rtems/inline/rtems/rtems/tasks.inl \
    401   $(cpukitdir)/rtems/inline/rtems/rtems/attr.inl \
    402   $(cpukitdir)/rtems/inline/rtems/rtems/message.inl \
    403   $(cpukitdir)/rtems/inline/rtems/rtems/region.inl \
    404   $(cpukitdir)/rtems/inline/rtems/rtems/timer.inl \
    405   $(cpukitdir)/rtems/inline/rtems/rtems/barrier.inl \
    406   $(cpukitdir)/rtems/inline/rtems/rtems/modes.inl \
    407   $(cpukitdir)/rtems/inline/rtems/rtems/sem.inl \
    408   $(cpukitdir)/rtems/inline/rtems/rtems/dpmem.inl \
    409   $(cpukitdir)/rtems/inline/rtems/rtems/options.inl \
    410   $(cpukitdir)/rtems/inline/rtems/rtems/status.inl \
    411   $(cpukitdir)/rtems/inline/rtems/rtems/event.inl \
    412   $(cpukitdir)/rtems/inline/rtems/rtems/part.inl \
    413   $(cpukitdir)/rtems/inline/rtems/rtems/support.inl
     372  ${cpukitdir}/rtems/include/rtems/rtems/tasks.h
    414373
    415374schedsim_include_HEADERS += rtems_sched.h
  • schedsim/rtems/rtems_init.c

    r9a34e3a r726b27c  
    11/*
    22 *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
    3  *
    4  *  COPYRIGHT (c) 1989-2013.
     3 */
     4
     5/*
     6 *  COPYRIGHT (c) 1989-2014.
    57 *  On-Line Applications Research Corporation (OAR).
    68 *
     
    1315#define SCORE_INIT
    1416#define RTEMS_API_INIT
     17#define POSIX_API_INIT
    1518
    16 #include <rtems.h>
     19#include <rtems/system.h>
     20#include <rtems/config.h>
     21#include <rtems/debug.h>
     22#include <rtems/extensionimpl.h>
     23#include <rtems/fatal.h>
     24#include <rtems/init.h>
     25#include <rtems/io.h>
     26#include <rtems/score/sysstate.h>
     27
    1728#include <rtems/score/apiext.h>
    18 #include <rtems/score/bitfield.h>
    1929#include <rtems/score/apimutex.h>
     30#include <rtems/score/cpusetimpl.h>
    2031#include <rtems/score/userextimpl.h>
     32#include <rtems/score/schedulerimpl.h>
     33#include <rtems/score/smpimpl.h>
     34#include <rtems/score/threadimpl.h>
     35#include <rtems/score/todimpl.h>
     36#include <rtems/score/watchdogimpl.h>
    2137#include <rtems/score/wkspace.h>
    2238
     39#include <rtems/rtems/tasksimpl.h>
     40#include <rtems/rtems/semimpl.h>
     41
     42#include <rtems/posix/keyimpl.h>
     43
     44/*
     45 *  Declare Object Information tables directly here instead of API
     46 *  specific initialization files as in cpukit/sapi/src.
     47 */
    2348Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
    2449
    2550Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ];
     51
     52Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ];
    2653
    2754extern void check_heir_and_executing(void);
     
    4168  _Thread_Dispatch_initialization();
    4269
    43   /*
    44    *  Before this is called, we are not allowed to allocate memory
    45    *  from the Workspace because it is not initialized.
    46    */
    47   _Workspace_Handler_initialization(NULL, 0, NULL);
    48 
    49   #if defined(RTEMS_SMP)
    50     _SMP_Handler_initialize();
    51   #endif
    52 
    5370  _User_extensions_Handler_initialization();
    54 
    5571  _ISR_Handler_initialization();
    5672
     
    6076  _Objects_Information_table[OBJECTS_INTERNAL_API] = _Internal_Objects;
    6177
    62   _API_Mutex_Initialization( 1 );
     78  _API_Mutex_Initialization( 2 );
    6379  _API_Mutex_Allocate( &_RTEMS_Allocator_Mutex );
     80  _API_Mutex_Allocate( &_Once_Mutex );
    6481
    65   _Priority_bit_map_Handler_initialization();
    6682  _Watchdog_Handler_initialization();
    6783  _TOD_Handler_initialization();
     
    7187  _Scheduler_Handler_initialization();
    7288
     89  _SMP_Handler_initialize();
     90
     91  _CPU_set_Handler_initialization();
    7392
    7493/* MANAGERS */
     
    83102
    84103  /*
     104   * Install our API Object Management Table and initialize the
     105   * various managers.
     106   */
     107  _Objects_Information_table[OBJECTS_POSIX_API] = _POSIX_Objects;
     108
     109  _POSIX_Key_Manager_initialization();
     110
     111  /*
    85112   * Discover and initialize the secondary cores in an SMP system.
    86113   */
    87   #if defined(RTEMS_SMP)
    88     _SMP_Processor_count =
    89       bsp_smp_initialize( rtems_configuration_smp_maximum_processors );
    90   #endif
     114  _SMP_Handler_initialize();
    91115
    92116  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
     
    105129   */
    106130
    107   _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
     131  _System_state_Set( SYSTEM_STATE_UP );
     132
     133 _SMP_Request_start_multitasking();
    108134
    109135  _Thread_Start_multitasking();
     
    112138   *  Now we are back in a non-dispatching critical section
    113139   */
    114   _Thread_Dispatch_set_disable_level(0);
     140  #if defined(RTEMS_SMP)
     141    #error "NOT IMPLEMENTED"
     142  #else
     143    _Thread_Enable_dispatch();
     144  #endif
    115145
    116146  /*
  • schedsim/rtems/sched_cpu/cpu_asm.c

    r9a34e3a r726b27c  
    1 /*  cpu_asm.c  ===> cpu_asm.S or cpu_asm.s
     1/**
     2 *  @file
     3 *
    24 *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
    35 *
    4  *
    5  *  This file contains the basic algorithms for all assembly code used
    6  *  in an specific CPU port of RTEMS.  These algorithms must be implemented
    7  *  in assembly language
    8  *
    9  *  NOTE:  This is supposed to be a .S or .s file NOT a C file.
    10  *
    11  *  COPYRIGHT (c) 1989-2013.
     6 *  Every method in this file is stubbed. There are no real
     7 *  context switches or interrupts.
     8 */
     9
     10/*
     11 *  COPYRIGHT (c) 1989-2014.
    1212 *  On-Line Applications Research Corporation (OAR).
    1313 *
     
    1515 *  found in the file LICENSE in this distribution or at
    1616 *  http://www.rtems.com/license/LICENSE.
    17  */
    18 
    19 /*
    20  *  This is supposed to be an assembly file.  This means that system.h
    21  *  and cpu.h should not be included in a "real" cpu_asm file.  An
    22  *  implementation in assembly should include "cpu_asm.h>
    2317 */
    2418
     
    2923#include <rtems/system.h>
    3024#include <rtems/score/cpu.h>
    31 /* #include "cpu_asm.h> */
    32 
    33 /*
    34  *  _CPU_Context_save_fp_context
    35  *
    36  *  This routine is responsible for saving the FP context
    37  *  at *fp_context_ptr.  If the point to load the FP context
    38  *  from is changed then the pointer is modified by this routine.
    39  *
    40  *  Sometimes a macro implementation of this is in cpu.h which dereferences
    41  *  the ** and a similarly named routine in this file is passed something
    42  *  like a (Context_Control_fp *).  The general rule on making this decision
    43  *  is to avoid writing assembly language.
    44  *
    45  *  NO_CPU Specific Information:
    46  *
    47  *  XXX document implementation including references if appropriate
    48  */
    4925
    5026void _CPU_Context_save_fp(
     
    5430}
    5531
    56 /*
    57  *  _CPU_Context_restore_fp_context
    58  *
    59  *  This routine is responsible for restoring the FP context
    60  *  at *fp_context_ptr.  If the point to load the FP context
    61  *  from is changed then the pointer is modified by this routine.
    62  *
    63  *  Sometimes a macro implementation of this is in cpu.h which dereferences
    64  *  the ** and a similarly named routine in this file is passed something
    65  *  like a (Context_Control_fp *).  The general rule on making this decision
    66  *  is to avoid writing assembly language.
    67  *
    68  *  NO_CPU Specific Information:
    69  *
    70  *  XXX document implementation including references if appropriate
    71  */
    72 
    7332void _CPU_Context_restore_fp(
    7433  Context_Control_fp **fp_context_ptr
     
    7635{
    7736}
    78 
    79 /*  _CPU_Context_switch
    80  *
    81  *  This routine performs a normal non-FP context switch.
    82  *
    83  *  NO_CPU Specific Information:
    84  *
    85  *  XXX document implementation including references if appropriate
    86  */
    8737
    8838void _CPU_Context_switch(
     
    9343}
    9444
    95 /*
    96  *  _CPU_Context_restore
    97  *
    98  *  This routine is generally used only to restart self in an
    99  *  efficient manner.  It may simply be a label in _CPU_Context_switch.
    100  *
    101  *  NOTE: May be unnecessary to reload some registers.
    102  *
    103  *  NO_CPU Specific Information:
    104  *
    105  *  XXX document implementation including references if appropriate
    106  */
    107 
    10845void _CPU_Context_restore(
    10946  Context_Control *new_context
     
    11249}
    11350
    114 /*  void __ISR_Handler()
    115  *
    116  *  This routine provides the RTEMS interrupt management.
    117  *
    118  *  NO_CPU Specific Information:
    119  *
    120  *  XXX document implementation including references if appropriate
    121  */
    122 
    12351void _ISR_Handler(void)
    12452{
    125    /*
    126     *  This discussion ignores a lot of the ugly details in a real
    127     *  implementation such as saving enough registers/state to be
    128     *  able to do something real.  Keep in mind that the goal is
    129     *  to invoke a user's ISR handler which is written in C and
    130     *  uses a certain set of registers.
    131     *
    132     *  Also note that the exact order is to a large extent flexible.
    133     *  Hardware will dictate a sequence for a certain subset of
    134     *  _ISR_Handler while requirements for setting
    135     */
    136 
    137   /*
    138    *  At entry to "common" _ISR_Handler, the vector number must be
    139    *  available.  On some CPUs the hardware puts either the vector
    140    *  number or the offset into the vector table for this ISR in a
    141    *  known place.  If the hardware does not give us this information,
    142    *  then the assembly portion of RTEMS for this port will contain
    143    *  a set of distinct interrupt entry points which somehow place
    144    *  the vector number in a known place (which is safe if another
    145    *  interrupt nests this one) and branches to _ISR_Handler.
    146    *
    147    *  save some or all context on stack
    148    *  may need to save some special interrupt information for exit
    149    *
    150    *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
    151    *    if ( _ISR_Nest_level == 0 )
    152    *      switch to software interrupt stack
    153    *  #endif
    154    *
    155    *  _ISR_Nest_level++;
    156    *
    157    *  _Thread_Dispatch_disable_level++;
    158    *
    159    *  (*_ISR_Vector_table[ vector ])( vector );
    160    *
    161    *  _Thread_Dispatch_disable_level--;
    162    *
    163    *  --_ISR_Nest_level;
    164    *
    165    *  if ( _ISR_Nest_level )
    166    *    goto the label "exit interrupt (simple case)"
    167    *
    168    *  if ( _Thread_Dispatch_disable_level )
    169    *    _ISR_Signals_to_thread_executing = FALSE;
    170    *    goto the label "exit interrupt (simple case)"
    171    *
    172    *  if ( _Context_Switch_necessary || _ISR_Signals_to_thread_executing ) {
    173    *    _ISR_Signals_to_thread_executing = FALSE;
    174    *    call _Thread_Dispatch() or prepare to return to _ISR_Dispatch
    175    *    prepare to get out of interrupt
    176    *    return from interrupt  (maybe to _ISR_Dispatch)
    177    *
    178    *  LABEL "exit interrupt (simple case):
    179    *  #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE )
    180    *    if outermost interrupt
    181    *      restore stack
    182    *  #endif
    183    *  prepare to get out of interrupt
    184    *  return from interrupt
    185    */
    18653}
  • schedsim/rtems/sched_cpu/rtems/score/cpu.h

    r9a34e3a r726b27c  
    292292 *  XXX document implementation including references if appropriate
    293293 */
    294 #define CPU_USE_DEFERRED_FP_SWITCH       TRUE
     294#define CPU_USE_DEFERRED_FP_SWITCH       FALSE
    295295
    296296/**
     
    461461 *  XXX document implementation including references if appropriate
    462462 */
     463
     464typedef struct {
     465  /* There is no CPU specific per-CPU state */
     466} CPU_Per_CPU_control;
    463467
    464468/**
     
    835839 */
    836840#define _CPU_Context_Initialize( _the_context, _stack_base, _size, \
    837                                  _isr, _entry_point, _is_fp ) \
     841                                 _isr, _entry_point, _is_fp, tls_area ) \
    838842  { \
    839843  }
     
    11241128void _CPU_Install_interrupt_stack( void );
    11251129
     1130typedef uint32_t CPU_Counter_ticks;
     1131
     1132CPU_Counter_ticks _CPU_Counter_read( void );
     1133
     1134CPU_Counter_ticks _CPU_Counter_difference(
     1135  CPU_Counter_ticks second,
     1136  CPU_Counter_ticks first
     1137);
     1138
    11261139/**
    11271140 *  This routine is the CPU dependent IDLE thread body.
     
    12051218);
    12061219
     1220#ifdef RTEMS_SMP
     1221  #define _CPU_Context_switch_to_first_task_smp(_context )
     1222
     1223  RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
     1224    _CPU_SMP_Get_current_processor( void )
     1225  {
     1226    return 0;
     1227  }
     1228
     1229  #define _CPU_SMP_Send_interrupt( dest);
     1230
     1231  static inline void _CPU_SMP_Processor_event_broadcast( void )
     1232  {
     1233  }
     1234
     1235  static inline void _CPU_SMP_Processor_event_receive( void )
     1236  {
     1237  }
     1238#endif
    12071239typedef struct {
    12081240  uint32_t trap;
     
    12841316  } while (0)
    12851317
    1286 #define _CPU_Context_switch_to_first_task_smp(_ignored)
    1287 
    12881318#ifdef __cplusplus
    12891319}
  • schedsim/rtems/sched_cpu/rtems/score/types.h

    r9a34e3a r726b27c  
    3232 */
    3333
    34 /** This defines the type for a priority bit map entry. */
    35 typedef uint16_t Priority_bit_map_Control;
     34typedef uint16_t Priority_bit_map_Word;
    3635
    3736/** This defines the return type for an ISR entry point. */
  • schedsim/rtems/wkspace.c

    r9a34e3a r726b27c  
    2121
    2222#include <stdlib.h>
     23#include <malloc.h>
    2324
     25#define DEBUG_WORKSPACE
    2426#if defined(DEBUG_WORKSPACE)
    2527  #include <stdio.h>
     
    5961  return memory;
    6062}
     63
     64void *_Workspace_Allocate_aligned( size_t size, size_t alignment )
     65{
     66  void *memory;
     67  int   sc;
     68
     69  memory = memalign( alignment, size );
     70  #if defined(DEBUG_WORKSPACE)
     71    fprintf(
     72      stderr,
     73      "Workspace_Allocate_aligned(%d, %d) from %p/%p -> %p\n",
     74      size,
     75      alignment,
     76      __builtin_return_address( 0 ),
     77      __builtin_return_address( 1 ),
     78      memory
     79    );
     80  #endif
     81  return memory;
     82}
     83
    6184
    6285/*
  • schedsim/shell/schedsim_priority/Makefile.am

    r9a34e3a r726b27c  
    2727endif
    2828
    29 schedsim_priority_LDFLAGS =-Wl,--wrap=_Thread_Dispatch
     29## Ensure all linker provided symbols are available
     30schedsim_priority_LDFLAGS =
     31schedsim_priority_LDFLAGS += -Wl,--defsym=_TLS_Data_begin=0
     32schedsim_priority_LDFLAGS += -Wl,--defsym=_TLS_BSS_end=0
     33schedsim_priority_LDFLAGS += -Wl,--defsym=_TLS_Alignment=4
     34
     35## Wrap _Thread_Dispatch so we can see context switches
     36schedsim_priority_LDFLAGS += -Wl,--wrap=_Thread_Dispatch
     37
     38## Link in all support libraries
    3039## schedsim_priorityLDADD +=-Wl,--start-group
    3140schedsim_priority_LDADD = ../shared/libschedsim.a
  • schedsim/shell/schedsim_priority/smp_stub.c

    r9a34e3a r726b27c  
    2525}
    2626
    27 int bsp_smp_initialize(
    28   int maximum
     27uint32_t bsp_smp_initialize(
     28  uint32_t configured_cpu_count
    2929)
    3030{
    3131  /* return the number of CPUs */
    32   return maximum;
     32  return configured_cpu_count;
    3333}
    3434
  • schedsim/shell/schedsim_smpsimple/main_dispatch.c

    r9a34e3a r726b27c  
    3232  current_cpu = Schedsim_Current_cpu;
    3333  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
    34     if ( _Per_CPU_Information[cpu].dispatch_necessary ) {
     34    if ( _Per_CPU_Information[cpu].per_cpu.dispatch_necessary ) {
    3535      printf( "=== Invoke Thread Dispatch on CPU %d\n", cpu );
    3636       Schedsim_Current_cpu = cpu;
  • schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c

    r9a34e3a r726b27c  
    3737  );
    3838  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
    39     e = _Per_CPU_Information[cpu].executing;
    40     h = _Per_CPU_Information[cpu].heir;
    41     i = _Per_CPU_Information[cpu].idle;
     39    e = _Per_CPU_Information[cpu].per_cpu.executing;
     40    h = _Per_CPU_Information[cpu].per_cpu.heir;
    4241    printf(
    43       "  CPU %d: 0x%08x @%3ld / 0x%08x @%3ld / 0x%08x @%3ld         %s\n",
     42      "  CPU %d: 0x%08x @%3ld / 0x%08x @%3ld          %s\n",
    4443      cpu,
    4544      e->Object.id, (long) e->current_priority,
    4645      h->Object.id, (long) h->current_priority,
    47       i->Object.id, (long) i->current_priority,
    48       ((_Per_CPU_Information[cpu].dispatch_necessary) ? "true" : "false")
     46      ((_Per_CPU_Information[cpu].per_cpu.dispatch_necessary) ?
     47        "true" : "false")
    4948    );
    5049  }
  • schedsim/shell/schedsim_smpsimple/main_dump_ready_tasks.c

    r9a34e3a r726b27c  
    1616#include "shell.h"
    1717#include "rtems_sched.h"
     18#include <rtems/score/chainimpl.h>
     19#include <rtems/score/thread.h>
    1820
    1921#include <rtems/score/schedulerpriority.h>
  • schedsim/shell/schedsim_smpsimple/smp_stub.c

    r9a34e3a r726b27c  
    1616
    1717uint32_t Schedsim_Current_cpu;
     18extern uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
    1819
    1920void bsp_smp_secondary_cpu_initialize(int cpu)
     
    2728}
    2829
    29 int bsp_smp_initialize(
    30   int maximum
     30uint32_t bsp_smp_initialize(
     31  uint32_t configured_cpu_count
    3132)
    3233{
     34  if ( configured_cpu_count < Schedsim_Maximum_CPUs_From_Command_Line ) {
     35    printf(
     36      "ERROR - Maximum cores per confdefs.h is %d\n",
     37      configured_cpu_count
     38    );
     39    exit( 1 );
     40  }
     41
    3342  /* return the number of CPUs */
    34   return maximum;
     43  return Schedsim_Maximum_CPUs_From_Command_Line;
    3544}
    3645
  • schedsim/shell/shared/main_rtemsinit.c

    r9a34e3a r726b27c  
    2323#if defined(RTEMS_SMP)
    2424  #include <rtems/score/smp.h>
     25
     26  uint32_t Schedsim_Maximum_CPUs_From_Command_Line;
    2527#endif
     28
    2629
    2730int rtems_shell_main_rtems_init(
     
    3841      return -1;
    3942    }
    40     rtems_configuration_smp_maximum_processors = cpus;
     43    Schedsim_Maximum_CPUs_From_Command_Line = cpus;
    4144  }
    4245#endif
  • schedsim/shell/shared/schedsim_shell.h

    r9a34e3a r726b27c  
    1414
    1515#include <rtems.h>
     16#include <rtems/score/sysstate.h>
    1617
    1718#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.