Implement extended init for CPU channels

This commit is contained in:
Rodrigo Arias 2021-10-21 15:46:32 +02:00
parent 97248c70ea
commit 3c913dd26b
6 changed files with 30 additions and 30 deletions

14
chan.c
View File

@ -67,8 +67,9 @@ chan_cpu_init(struct ovni_cpu *cpu,
struct ovni_chan **update_list, struct ovni_chan **update_list,
enum chan id, enum chan id,
int track, int track,
// int init_st, int init_st,
// int enabled, int enabled,
int dirty,
int row, int row,
FILE *prv, FILE *prv,
int64_t *clock) int64_t *clock)
@ -79,11 +80,16 @@ chan_cpu_init(struct ovni_cpu *cpu,
chan = &cpu->chan[id]; chan = &cpu->chan[id];
assert(chan_to_prvtype[id][0] == (int) id); assert(chan_to_prvtype[id][0] == (int) id);
prvcpu = chan_to_prvtype[id][2]; prvcpu = chan_to_prvtype[id][2];
chan_init(chan, track, row, prvcpu, prv, clock);
chan->id = id; chan->id = id;
chan->cpu = cpu; chan->cpu = cpu;
chan->update_list = update_list; chan->update_list = update_list;
chan->enabled = enabled;
chan_init(chan, track, row, prvcpu, prv, clock); chan->stack[chan->n++] = init_st;
if(dirty)
mark_dirty(chan);
} }
static void static void

11
chan.h
View File

@ -16,7 +16,16 @@ chan_th_init(struct ovni_ethread *th,
int64_t *clock); int64_t *clock);
void 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 void
chan_enable(struct ovni_chan *chan, int enabled); chan_enable(struct ovni_chan *chan, int enabled);

View File

@ -50,15 +50,10 @@ hook_init_nosv(struct ovni_emu *emu)
row = cpu->gindex + 1; row = cpu->gindex + 1;
ucpu = &emu->cpu_chan; ucpu = &emu->cpu_chan;
chan_cpu_init(cpu, ucpu, CHAN_NOSV_TASKID, 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_enable(&cpu->chan[CHAN_NOSV_TASKID], 1); chan_cpu_init(cpu, ucpu, CHAN_NOSV_APPID, CHAN_TRACK_TH_RUNNING, 0, 0, 0, row, prv_cpu, clock);
chan_set(&cpu->chan[CHAN_NOSV_TASKID], 0); chan_cpu_init(cpu, ucpu, CHAN_NOSV_SUBSYSTEM, CHAN_TRACK_TH_RUNNING, 0, 0, 0, row, prv_cpu, clock);
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);
} }
} }

View File

@ -41,7 +41,7 @@ hook_init_openmp(struct ovni_emu *emu)
row = cpu->gindex + 1; row = cpu->gindex + 1;
ucpu = &emu->cpu_chan; 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);
} }
} }

View File

@ -46,20 +46,10 @@ hook_init_ovni(struct ovni_emu *emu)
row = cpu->gindex + 1; row = cpu->gindex + 1;
ucpu = &emu->cpu_chan; 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_TID, CHAN_TRACK_TH_RUNNING, 0, 1, 1, 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_PID, CHAN_TRACK_TH_RUNNING, 0, 1, 1, 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_NRTHREADS, CHAN_TRACK_NONE, 0, 1, 1, row, prv_cpu, clock);
chan_cpu_init(cpu, ucpu, CHAN_OVNI_FLUSH, CHAN_TRACK_TH_RUNNING, row, prv_cpu, clock); chan_cpu_init(cpu, ucpu, CHAN_OVNI_FLUSH, CHAN_TRACK_TH_RUNNING, 0, 0, 0, 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);
} }
} }

View File

@ -41,7 +41,7 @@ hook_init_tampi(struct ovni_emu *emu)
row = cpu->gindex + 1; row = cpu->gindex + 1;
ucpu = &emu->cpu_chan; 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);
} }
} }