Subversion Repositories shark

Rev

Rev 207 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
38 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   (see the web pages for full authors list)
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/**
20
 ------------
21
 CVS :        $Id: tskmsg.c,v 1.1 2003-01-07 17:09:24 pj Exp $
22
 
23
 File:        $File$
24
 Revision:    $Revision: 1.1 $
25
 Last update: $Date: 2003-01-07 17:09:24 $
26
 ------------
27
 
28
**/
29
 
30
/*
31
 * Copyright (C) 2002 Paolo Gai
32
 *
33
 * This program is free software; you can redistribute it and/or modify
34
 * it under the terms of the GNU General Public License as published by
35
 * the Free Software Foundation; either version 2 of the License, or
36
 * (at your option) any later version.
37
 *
38
 * This program is distributed in the hope that it will be useful,
39
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
41
 * GNU General Public License for more details.
42
 *
43
 * You should have received a copy of the GNU General Public License
44
 * along with this program; if not, write to the Free Software
45
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
46
 *
47
 */
48
 
49
#include <stdarg.h>
50
#include <ll/ll.h>
51
#include <ll/stdlib.h>
52
#include <ll/stdio.h>
53
#include <ll/string.h>
54
#include <kernel/config.h>
55
#include <kernel/model.h>
56
#include <kernel/const.h>
57
#include <sys/types.h>
58
#include <kernel/types.h>
59
#include <kernel/descr.h>
60
#include <errno.h>
61
#include <kernel/var.h>
62
#include <kernel/func.h>
63
#include <kernel/trace.h>
64
 
65
 
66
/*
67
  The running task (pointed by exec_shadow) sent a message m to the
68
  scheduling module that handle the task p.
69
 
70
  If the message has value NULL the behavior should be the
71
  task_endcycle primitive behavior, and an endcycle tracer event is
72
  generated.
73
 
74
*/
75
int task_message(void *m, int reschedule)
76
{
77
  LEVEL l;            /* for readableness only */
78
 
79
  int retvalue;
80
 
81
  if (reschedule) {
82
    proc_table[exec_shadow].context = kern_context_save();
83
 
84
    kern_epilogue_macro();
85
 
86
    l = proc_table[exec_shadow].task_level;
87
    retvalue = level_table[l]->public_message(l,exec_shadow,m);
88
 
89
    exec = exec_shadow = -1;
90
    scheduler();
91
 
92
    kern_context_load(proc_table[exec_shadow].context);
93
 
94
  } else {
95
    SYS_FLAGS f;
96
 
97
    f = kern_fsave();
98
    l = proc_table[exec_shadow].task_level;
99
    retvalue = level_table[l]->public_message(l,exec_shadow,m);
100
    kern_frestore(f);
101
  }
102
 
103
  return retvalue;
104
}