diff --git a/chan.c b/chan.c index 4b07790..ad617d8 100644 --- a/chan.c +++ b/chan.c @@ -67,8 +67,9 @@ chan_cpu_init(struct ovni_cpu *cpu, struct ovni_chan **update_list, enum chan id, int track, -// int init_st, -// int enabled, + int init_st, + int enabled, + int dirty, int row, FILE *prv, int64_t *clock) @@ -79,11 +80,16 @@ chan_cpu_init(struct ovni_cpu *cpu, chan = &cpu->chan[id]; assert(chan_to_prvtype[id][0] == (int) id); prvcpu = chan_to_prvtype[id][2]; + + chan_init(chan, track, row, prvcpu, prv, clock); + chan->id = id; chan->cpu = cpu; chan->update_list = update_list; - - chan_init(chan, track, row, prvcpu, prv, clock); + chan->enabled = enabled; + chan->stack[chan->n++] = init_st; + if(dirty) + mark_dirty(chan); } static void diff --git a/chan.h b/chan.h index 2408aca..9e4df53 100644 --- a/chan.h +++ b/chan.h @@ -16,7 +16,16 @@ chan_th_init(struct ovni_ethread *th, int64_t *clock); void -chan_cpu_init(struct ovni_cpu *cpu, struct ovni_chan **update_list, enum chan id, int track, int row, FILE *prv, int64_t *clock); +chan_cpu_init(struct ovni_cpu *cpu, + struct ovni_chan **update_list, + enum chan id, + int track, + int row, + int init_st, + int enabled, + int dirty, + FILE *prv, + int64_t *clock); void chan_enable(struct ovni_chan *chan, int enabled); diff --git a/emu_nosv.c b/emu_nosv.c index c0ab27d..791000e 100644 --- a/emu_nosv.c +++ b/emu_nosv.c @@ -50,15 +50,10 @@ hook_init_nosv(struct ovni_emu *emu) row = cpu->gindex + 1; ucpu = &emu->cpu_chan; - chan_cpu_init(cpu, ucpu, CHAN_NOSV_TASKID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); - - chan_enable(&cpu->chan[CHAN_NOSV_TASKID], 1); - chan_set(&cpu->chan[CHAN_NOSV_TASKID], 0); - chan_enable(&cpu->chan[CHAN_NOSV_TASKID], 0); - - chan_cpu_init(cpu, ucpu, CHAN_NOSV_TYPEID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); - chan_cpu_init(cpu, ucpu, CHAN_NOSV_APPID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); - chan_cpu_init(cpu, ucpu, CHAN_NOSV_SUBSYSTEM, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_NOSV_TASKID, CHAN_TRACK_TH_RUNNING, 0, 0, 1, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_NOSV_TYPEID, CHAN_TRACK_TH_RUNNING, 0, 0, 0, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_NOSV_APPID, CHAN_TRACK_TH_RUNNING, 0, 0, 0, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_NOSV_SUBSYSTEM, CHAN_TRACK_TH_RUNNING, 0, 0, 0, row, prv_cpu, clock); } } diff --git a/emu_openmp.c b/emu_openmp.c index 9295d43..75130c4 100644 --- a/emu_openmp.c +++ b/emu_openmp.c @@ -41,7 +41,7 @@ hook_init_openmp(struct ovni_emu *emu) row = cpu->gindex + 1; ucpu = &emu->cpu_chan; - chan_cpu_init(cpu, ucpu, CHAN_OPENMP_MODE, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_OPENMP_MODE, CHAN_TRACK_TH_RUNNING, 0, 0, 1, row, prv_cpu, clock); } } diff --git a/emu_ovni.c b/emu_ovni.c index afa1330..d847850 100644 --- a/emu_ovni.c +++ b/emu_ovni.c @@ -46,20 +46,10 @@ hook_init_ovni(struct ovni_emu *emu) row = cpu->gindex + 1; ucpu = &emu->cpu_chan; - chan_cpu_init(cpu, ucpu, CHAN_OVNI_TID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); - chan_cpu_init(cpu, ucpu, CHAN_OVNI_PID, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); - chan_cpu_init(cpu, ucpu, CHAN_OVNI_NRTHREADS, CHAN_TRACK_NONE, row, prv_cpu, clock); - chan_cpu_init(cpu, ucpu, CHAN_OVNI_FLUSH, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); - - /* FIXME: Use extended initialization for CPUs too */ - chan_enable(&cpu->chan[CHAN_OVNI_TID], 1); - chan_set(&cpu->chan[CHAN_OVNI_TID], 0); - - chan_enable(&cpu->chan[CHAN_OVNI_PID], 1); - chan_set(&cpu->chan[CHAN_OVNI_PID], 0); - - chan_enable(&cpu->chan[CHAN_OVNI_NRTHREADS], 1); - chan_set(&cpu->chan[CHAN_OVNI_NRTHREADS], 0); + chan_cpu_init(cpu, ucpu, CHAN_OVNI_TID, CHAN_TRACK_TH_RUNNING, 0, 1, 1, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_OVNI_PID, CHAN_TRACK_TH_RUNNING, 0, 1, 1, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_OVNI_NRTHREADS, CHAN_TRACK_NONE, 0, 1, 1, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_OVNI_FLUSH, CHAN_TRACK_TH_RUNNING, 0, 0, 0, row, prv_cpu, clock); } } diff --git a/emu_tampi.c b/emu_tampi.c index 4167a7a..3fb9552 100644 --- a/emu_tampi.c +++ b/emu_tampi.c @@ -41,7 +41,7 @@ hook_init_tampi(struct ovni_emu *emu) row = cpu->gindex + 1; ucpu = &emu->cpu_chan; - chan_cpu_init(cpu, ucpu, CHAN_TAMPI_MODE, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); + chan_cpu_init(cpu, ucpu, CHAN_TAMPI_MODE, CHAN_TRACK_TH_RUNNING, 0, 0, 1, row, prv_cpu, clock); } }