Add support for sfree in nosv subsystems

This commit is contained in:
Rodrigo Arias 2021-10-25 12:35:05 +02:00
parent 87f3f7851b
commit be7375a69b
4 changed files with 40 additions and 17 deletions

View File

@ -47,8 +47,10 @@ VS] Ends the scheduler server mode
VU[ Starts to submit a task VU[ Starts to submit a task
VU] Ends the submission of a task VU] Ends the submission of a task
VM[ Starts allocating memory VMa Starts allocating memory
VM] Ends allocating memory VMA Ends allocating memory
VMf Starts freeing memory
VMF Ends freeing memory
VAs Enters nosv_submit() VAs Enters nosv_submit()
VAS Exits nosv_submit() VAS Exits nosv_submit()

27
emu.h
View File

@ -50,20 +50,21 @@ enum error_values {
enum nosv_ss_values { enum nosv_ss_values {
ST_NULL = 0, ST_NULL = 0,
ST_NOSV_SCHED_HUNGRY = 6, ST_NOSV_SCHED_HUNGRY = 6,
ST_NOSV_SCHED_SERVING = 7, ST_NOSV_SCHED_SERVING,
ST_NOSV_SCHED_SUBMITTING = 8, ST_NOSV_SCHED_SUBMITTING,
ST_NOSV_MEM_ALLOCATING = 9, ST_NOSV_MEM_ALLOCATING,
ST_NOSV_TASK_RUNNING = 10, ST_NOSV_MEM_FREEING,
ST_NOSV_CODE = 11, ST_NOSV_TASK_RUNNING,
ST_NOSV_API_SUBMIT = 12, ST_NOSV_CODE,
ST_NOSV_API_PAUSE = 13, ST_NOSV_API_SUBMIT,
ST_NOSV_API_YIELD = 14, ST_NOSV_API_PAUSE,
ST_NOSV_API_WAITFOR = 15, ST_NOSV_API_YIELD,
ST_NOSV_API_SCHEDPOINT = 16, ST_NOSV_API_WAITFOR,
ST_NOSV_API_SCHEDPOINT,
EV_NOSV_SCHED_RECV = 50, EV_NOSV_SCHED_RECV,
EV_NOSV_SCHED_SEND = 51, EV_NOSV_SCHED_SEND,
EV_NOSV_SCHED_SELF = 52, EV_NOSV_SCHED_SELF,
}; };
enum nosv_tampi_state { enum nosv_tampi_state {

View File

@ -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 static void
pre_ss(struct ovni_emu *emu, int st) 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 'Y': pre_type(emu); break;
case 'S': pre_sched(emu); break; case 'S': pre_sched(emu); break;
case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); 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 'C': pre_ss(emu, ST_NOSV_CODE); break;
case 'A': pre_api(emu); break; case 'A': pre_api(emu); break;
default: default:

3
pcf.c
View File

@ -270,6 +270,8 @@ struct event_value nosv_ss_values[] = {
{ ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" }, { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" },
{ ST_NOSV_TASK_RUNNING, "Task: Running" }, { ST_NOSV_TASK_RUNNING, "Task: Running" },
{ ST_NOSV_CODE, "nOS-V code" }, { 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_SUBMIT, "API: Submit" },
{ ST_NOSV_API_PAUSE, "API: Pause" }, { ST_NOSV_API_PAUSE, "API: Pause" },
{ ST_NOSV_API_YIELD, "API: Yield" }, { 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_SEND, "EV Scheduler: Send task" },
{ EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" }, { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" },
{ EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" }, { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" },
{ ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" },
{ -1, NULL }, { -1, NULL },
}; };