diff --git a/doc/emu_events.txt b/doc/emu_events.txt index 209c85f..614481d 100644 --- a/doc/emu_events.txt +++ b/doc/emu_events.txt @@ -47,8 +47,10 @@ VS] Ends the scheduler server mode VU[ Starts to submit a task VU] Ends the submission of a task -VM[ Starts allocating memory -VM] Ends allocating memory +VMa Starts allocating memory +VMA Ends allocating memory +VMf Starts freeing memory +VMF Ends freeing memory VAs Enters nosv_submit() VAS Exits nosv_submit() diff --git a/emu.h b/emu.h index 3e23bae..dbedec5 100644 --- a/emu.h +++ b/emu.h @@ -50,20 +50,21 @@ enum error_values { enum nosv_ss_values { ST_NULL = 0, ST_NOSV_SCHED_HUNGRY = 6, - ST_NOSV_SCHED_SERVING = 7, - ST_NOSV_SCHED_SUBMITTING = 8, - ST_NOSV_MEM_ALLOCATING = 9, - ST_NOSV_TASK_RUNNING = 10, - ST_NOSV_CODE = 11, - ST_NOSV_API_SUBMIT = 12, - ST_NOSV_API_PAUSE = 13, - ST_NOSV_API_YIELD = 14, - ST_NOSV_API_WAITFOR = 15, - ST_NOSV_API_SCHEDPOINT = 16, + ST_NOSV_SCHED_SERVING, + ST_NOSV_SCHED_SUBMITTING, + ST_NOSV_MEM_ALLOCATING, + ST_NOSV_MEM_FREEING, + ST_NOSV_TASK_RUNNING, + ST_NOSV_CODE, + ST_NOSV_API_SUBMIT, + ST_NOSV_API_PAUSE, + ST_NOSV_API_YIELD, + ST_NOSV_API_WAITFOR, + ST_NOSV_API_SCHEDPOINT, - EV_NOSV_SCHED_RECV = 50, - EV_NOSV_SCHED_SEND = 51, - EV_NOSV_SCHED_SELF = 52, + EV_NOSV_SCHED_RECV, + EV_NOSV_SCHED_SEND, + EV_NOSV_SCHED_SELF, }; enum nosv_tampi_state { diff --git a/emu_nosv.c b/emu_nosv.c index 791000e..327fd58 100644 --- a/emu_nosv.c +++ b/emu_nosv.c @@ -371,6 +371,25 @@ pre_api(struct ovni_emu *emu) } } +static void +pre_mem(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + struct ovni_chan *chan_th; + + th = emu->cur_thread; + chan_th = &th->chan[CHAN_NOSV_SUBSYSTEM]; + + switch(emu->cur_ev->header.value) + { + case 'a': chan_push(chan_th, ST_NOSV_MEM_ALLOCATING); break; + case 'A': chan_pop (chan_th, ST_NOSV_MEM_ALLOCATING); break; + case 'f': chan_push(chan_th, ST_NOSV_MEM_FREEING); break; + case 'F': chan_pop (chan_th, ST_NOSV_MEM_FREEING); break; + default: break; + } +} + static void pre_ss(struct ovni_emu *emu, int st) { @@ -412,7 +431,7 @@ hook_pre_nosv(struct ovni_emu *emu) case 'Y': pre_type(emu); break; case 'S': pre_sched(emu); break; case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); break; - case 'M': pre_ss(emu, ST_NOSV_MEM_ALLOCATING); break; + case 'M': pre_mem(emu); break; case 'C': pre_ss(emu, ST_NOSV_CODE); break; case 'A': pre_api(emu); break; default: diff --git a/pcf.c b/pcf.c index a382ef5..1f61473 100644 --- a/pcf.c +++ b/pcf.c @@ -270,6 +270,8 @@ struct event_value nosv_ss_values[] = { { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" }, { ST_NOSV_TASK_RUNNING, "Task: Running" }, { ST_NOSV_CODE, "nOS-V code" }, + { ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" }, + { ST_NOSV_MEM_FREEING, "Memory: Freeing" }, { ST_NOSV_API_SUBMIT, "API: Submit" }, { ST_NOSV_API_PAUSE, "API: Pause" }, { ST_NOSV_API_YIELD, "API: Yield" }, @@ -278,7 +280,6 @@ struct event_value nosv_ss_values[] = { { EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" }, { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" }, { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" }, - { ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" }, { -1, NULL }, };