Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 392 → Rev 393

/shark/trunk/kernel/printk.c
36,11 → 36,11
*/
 
/*
* CVS : $Id: printk.c,v 1.5 2004-01-10 13:24:36 giacomo Exp $
* CVS : $Id: printk.c,v 1.6 2004-01-12 17:23:29 giacomo Exp $
*
* File: $File$
* Revision: $Revision: 1.5 $
* Last update: $Date: 2004-01-10 13:24:36 $
* Revision: $Revision: 1.6 $
* Last update: $Date: 2004-01-12 17:23:29 $
*/
 
#include <ll/i386/cons.h>
68,7 → 68,6
static int vprintk(int flag, char *fmt, va_list ap)
{
static char buf[2048]; /* DANGER !!!!! */
SYS_FLAGS f;
int level;
level = NO_LEVEL;
83,12 → 82,10
vsprintf(buf,(char*)fmt,ap);
 
f=kern_fsave();
if (level != NO_LEVEL)
cprintf("[%s] %s",levelname[level],buf);
else
cprintf("%s",buf);
kern_frestore(f);
return 0;
}
/shark/trunk/include/kernel/func.h
21,11 → 21,11
 
/**
------------
CVS : $Id: func.h,v 1.9 2003-07-22 13:26:09 giacomo Exp $
CVS : $Id: func.h,v 1.10 2004-01-12 17:23:44 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.9 $
Last update: $Date: 2003-07-22 13:26:09 $
Revision: $Revision: 1.10 $
Last update: $Date: 2004-01-12 17:23:44 $
------------
 
Kernel functions:
379,7 → 379,7
/* manage the capacity event */
SUBTIMESPEC(&schedule_time, &cap_lasttime, &ty);
tx = TIMESPEC2USEC(&ty);
proc_table[exec_shadow].avail_time -= tx;
if (proc_table[exec_shadow].control & CONTROL_CAP) proc_table[exec_shadow].avail_time -= tx;
jet_update_slice(tx);
 
/* if the event didn't fire before, we delete it. */
/shark/trunk/ports/first/modules/posixstar.c
64,10 → 64,6
 
int slice; /*+ the level's time slice +*/
 
// the multiboot is not usefull for this module
// struct multiboot_info *multiboot; /*+ used if the level have to insert
// the main task +*/
 
int maxpriority; /*+ the priority are from 0 to maxpriority
(i.e 0 to 31) +*/
 
82,8 → 78,6
} POSIXSTAR_level_des;
 
 
 
static void capacity_handler(void *l)
{
POSIXSTAR_level_des *lev = l;
118,8 → 112,7
}
}
 
if (/* (proc_table[p].control & CONTROL_CAP ) && */
(proc_table[p].avail_time <= 0)) {
if (proc_table[p].avail_time <= 0) {
while (proc_table[p].avail_time<=0)
proc_table[p].avail_time += proc_table[p].wcet;
iq_extract(p,&lev->ready[prio]);
161,18 → 154,16
 
static void POSIXSTAR_account_capacity(POSIXSTAR_level_des *lev, PID p)
{
struct timespec ty;
TIME tx;
struct timespec ty;
TIME tx;
 
SUBTIMESPEC(&schedule_time, &lev->cap_lasttime, &ty);
tx = TIMESPEC2USEC(&ty);
SUBTIMESPEC(&schedule_time, &lev->cap_lasttime, &ty);
tx = TIMESPEC2USEC(&ty);
 
proc_table[p].avail_time -= tx;
//kern_printf("avail time pid %d , %d", p, proc_table[p].avail_time);
proc_table[p].avail_time -= tx;
 
}
 
 
static int POSIXSTAR_public_create(LEVEL l, PID p, TASK_MODEL *m)
{
POSIXSTAR_level_des *lev = (POSIXSTAR_level_des *)(level_table[l]);
202,9 → 193,6
proc_table[p].avail_time = proc_table[exec_shadow].avail_time;
proc_table[p].wcet = proc_table[exec_shadow].wcet;
 
proc_table[p].control = (proc_table[p].control & ~CONTROL_CAP); //|
//(proc_table[exec_shadow].control & CONTROL_CAP);
lev->nact[p] = (lev->nact[exec_shadow] == -1) ? -1 : 0;
}
else {
220,11 → 208,7
proc_table[p].avail_time = lev->slice;
proc_table[p].wcet = lev->slice;
}
/*
if (nrt->policy == NRT_RR_POLICY) {
proc_table[p].control |= CONTROL_CAP;
}
*/
 
#if defined POSIXSTAR_DEBUG
kern_printf("(slice %d)", proc_table[p].wcet);
#endif
235,7 → 219,10
}
 
return 0; /* OK */
proc_table[p].control = (proc_table[p].control & ~CONTROL_CAP);
 
return 0;
 
}
 
static void POSIXSTAR_public_dispatch(LEVEL l, PID p, int nostop)
276,46 → 263,36
#endif
 
if (lev->cap_lev!=NIL) {
kern_event_delete(lev->cap_lev);
lev->cap_lev=NIL;
kern_event_delete(lev->cap_lev);
lev->cap_lev=NIL;
}
 
if (/* p==exec && lev->activated==p */
proc_table[exec].task_level==l ) {
POSIXSTAR_account_capacity(lev,exec);
if (lev->yielding) {
lev->yielding = 0;
iq_extract(p,&lev->ready[lev->priority[exec]]);
iq_insertlast(p,&lev->ready[lev->priority[exec]]);
}
/* check if the slice is finished and insert the task in the coPOSIXect
qqueue position */
else if (/* proc_table[p].control & CONTROL_CAP && */
proc_table[exec].avail_time <= 0) {
if (proc_table[exec].task_level==l ) {
POSIXSTAR_account_capacity(lev,exec);
iq_extract(exec,&lev->ready[lev->priority[exec]]);
iq_insertlast(exec,&lev->ready[lev->priority[exec]]);
if (lev->yielding) {
lev->yielding = 0;
iq_extract(p,&lev->ready[lev->priority[exec]]);
iq_insertlast(p,&lev->ready[lev->priority[exec]]);
}
/* check if the slice is finished and insert the task in the coPOSIXect
qqueue position */
else if (proc_table[exec].avail_time <= 0) {
POSIXSTAR_private_scheduler(lev);
if (exec==lev->activated)
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p);
}
else {
 
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p);
 
//POSIXSTAR_private_scheduler(lev);
 
}
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p);
} else {
level_table[lev->scheduling_level]->private_epilogue(lev->scheduling_level,p);
}
proc_table[exec].status = POSIXSTAR_READY;
proc_table[exec].status = POSIXSTAR_READY;
} else
} else
level_table[proc_table[exec].task_level]->public_epilogue(proc_table[exec].task_level,p);
 
}
 
static void POSIXSTAR_internal_activate(POSIXSTAR_level_des *lev, PID p)
385,7 → 362,6
#endif
iq_extract(p,&lev->ready[lev->priority[p]]);
//if (p==lev->activated) lev->activated = NIL;
POSIXSTAR_private_scheduler(lev);
}
585,11 → 561,7
if (proc_table[p].task_level != l)
return ENOSYS;
 
//if (proc_table[p].control & CONTROL_CAP)
*policy = NRT_RR_POLICY;
//else
// *policy = NRT_FIFO_POLICY;
 
*policy = NRT_RR_POLICY;
*priority = ((POSIXSTAR_level_des *)(level_table[l]))->priority[p];
 
return 0;
605,14 → 577,6
 
if (proc_table[p].task_level != l)
return ENOSYS;
/*
if (policy == SCHED_RR)
proc_table[p].control |= CONTROL_CAP;
else if (policy == SCHED_FIFO)
proc_table[p].control &= ~CONTROL_CAP;
else
return EINVAL;
*/
if (lev->priority[p] != priority) {
if (proc_table[p].status == POSIXSTAR_READY) {
iq_extract(p,&lev->ready[lev->priority[p]]);