source: rtems-schedsim/schedsim/shell/schedsim_smpsimple/wrap_thread_dispatch.c @ b38dbcc

Last change on this file since b38dbcc was b38dbcc, checked in by Joel Sherrill <joel.sherrill@…>, on May 14, 2014 at 2:55:21 PM

Many files: rm white space at EOL and EOF

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Thread Dispatch Wrapper Implmentation
3 *
4 *  COPYRIGHT (c) 1989-2013.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#include "shell.h"
13#include <schedsim_shell.h>
14
15#include <stdlib.h>
16#include <stdio.h>
17#include <rtems.h>
18
19typedef Thread_Control * Thread_Control_ptr;
20extern uint32_t Schedsim_Current_cpu;
21
22Thread_Control_ptr *last_heir = NULL;
23Thread_Control_ptr *last_executing = NULL;
24
25extern void __real__Thread_Dispatch(void);
26
27void Init__wrap__Thread_Dispatch()
28{
29  last_heir = (Thread_Control_ptr *) calloc(
30    sizeof( Thread_Control_ptr ),
31    _SMP_Processor_count
32  );
33  last_executing =  (Thread_Control_ptr *) calloc(
34    sizeof( Thread_Control_ptr ),
35    _SMP_Processor_count
36  );
37}
38
39void check_heir_and_executing(void)
40{
41  uint32_t level;
42
43  _ISR_Disable_without_giant( level );
44    if ( last_heir[Schedsim_Current_cpu] != _Thread_Heir )
45      PRINT_HEIR();
46
47    if ( last_executing[Schedsim_Current_cpu] != _Thread_Executing )
48      PRINT_EXECUTING();
49
50    last_heir[Schedsim_Current_cpu] = _Thread_Heir;
51    last_executing[Schedsim_Current_cpu] = _Thread_Executing;
52  _ISR_Enable_without_giant( level );
53}
54
55void __wrap__Thread_Dispatch(void)
56{
57  uint32_t   cpu;
58  uint32_t   current_cpu;
59
60  current_cpu = Schedsim_Current_cpu;
61  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
62    Schedsim_Current_cpu = cpu;
63    check_heir_and_executing();
64    __real__Thread_Dispatch();
65    check_heir_and_executing();
66  }
67
68  Schedsim_Current_cpu = current_cpu;
69}
Note: See TracBrowser for help on using the repository browser.