Switch to edie() for errors
This commit is contained in:
parent
999862e530
commit
f990cd668f
12
emu_kernel.c
12
emu_kernel.c
@ -81,9 +81,8 @@ context_switch(struct ovni_emu *emu)
|
||||
chan_pop(chan, ST_KERNEL_CSOUT);
|
||||
break;
|
||||
default:
|
||||
err("unexpected value '%c' (expecting 'O' or 'I')\n",
|
||||
edie(emu, "unexpected value '%c' (expecting 'O' or 'I')\n",
|
||||
emu->cur_ev->header.value);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,13 +90,16 @@ void
|
||||
hook_pre_kernel(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.model != 'K')
|
||||
die("hook_pre_kernel: unexpected event with model %c\n",
|
||||
edie(emu, "hook_pre_kernel: unexpected event with model %c\n",
|
||||
emu->cur_ev->header.model);
|
||||
|
||||
switch(emu->cur_ev->header.category)
|
||||
{
|
||||
case 'C': context_switch(emu); break;
|
||||
default:
|
||||
case 'C':
|
||||
context_switch(emu);
|
||||
break;
|
||||
default:
|
||||
edie(emu, "hook_pre_kernel: unexpected event with category %c\n",
|
||||
emu->cur_ev->header.category);
|
||||
}
|
||||
}
|
||||
|
55
emu_nanos6.c
55
emu_nanos6.c
@ -104,13 +104,13 @@ chan_task_running(struct ovni_emu *emu, struct task *task, char tr)
|
||||
proc = emu->cur_proc;
|
||||
|
||||
if(task->id == 0)
|
||||
die("task id cannot be 0\n");
|
||||
edie(emu, "task id cannot be 0\n");
|
||||
|
||||
if(task->type->gid == 0)
|
||||
die("task type gid cannot be 0\n");
|
||||
edie(emu, "task type gid cannot be 0\n");
|
||||
|
||||
if(proc->appid <= 0)
|
||||
die("app id must be positive\n");
|
||||
edie(emu, "app id must be positive\n");
|
||||
|
||||
chan_set(&th->chan[CHAN_NANOS6_TASKID], task->id);
|
||||
chan_set(&th->chan[CHAN_NANOS6_TYPE], task->type->gid);
|
||||
@ -130,19 +130,19 @@ chan_task_switch(struct ovni_emu *emu,
|
||||
struct ovni_ethread *th = emu->cur_thread;
|
||||
|
||||
if(!prev || !next)
|
||||
die("cannot switch to or from a NULL task\n");
|
||||
edie(emu, "cannot switch to or from a NULL task\n");
|
||||
|
||||
if(prev == next)
|
||||
die("cannot switch to the same task\n");
|
||||
edie(emu, "cannot switch to the same task\n");
|
||||
|
||||
if(next->id == 0)
|
||||
die("next task id cannot be 0\n");
|
||||
edie(emu, "next task id cannot be 0\n");
|
||||
|
||||
if(next->type->gid == 0)
|
||||
die("next task type id cannot be 0\n");
|
||||
edie(emu, "next task type id cannot be 0\n");
|
||||
|
||||
if(prev->thread != next->thread)
|
||||
die("cannot switch to a task of another thread\n");
|
||||
edie(emu, "cannot switch to a task of another thread\n");
|
||||
|
||||
/* No need to change the rank as we will switch to tasks from
|
||||
* same thread */
|
||||
@ -193,7 +193,7 @@ expand_transition_value(struct ovni_emu *emu, int was_running, int runs_now)
|
||||
|
||||
/* Ensure we don't clobber the value */
|
||||
if(tr == 'X' || tr == 'E')
|
||||
die("unexpected event value %c\n", tr);
|
||||
edie(emu, "unexpected event value %c\n", tr);
|
||||
|
||||
/* Modify the event value to detect nested transitions */
|
||||
if(tr == 'x' && was_running)
|
||||
@ -212,19 +212,19 @@ update_task_channels(struct ovni_emu *emu,
|
||||
{
|
||||
case 'x':
|
||||
case 'r':
|
||||
chan_task_running(emu, next, tr);
|
||||
break;
|
||||
chan_task_running(emu, next, tr);
|
||||
break;
|
||||
case 'e':
|
||||
case 'p':
|
||||
chan_task_stopped(emu, tr);
|
||||
break;
|
||||
/* Additional nested transitions */
|
||||
chan_task_stopped(emu, tr);
|
||||
break;
|
||||
/* Additional nested transitions */
|
||||
case 'X':
|
||||
case 'E':
|
||||
chan_task_switch(emu, prev, next);
|
||||
break;
|
||||
chan_task_switch(emu, prev, next);
|
||||
break;
|
||||
default:
|
||||
edie(emu, "unexpected transition value %c\n", tr);
|
||||
edie(emu, "unexpected transition value %c\n", tr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ static void
|
||||
create_task(struct ovni_emu *emu)
|
||||
{
|
||||
if(ovni_payload_size(emu->cur_ev) != 8)
|
||||
die("cannot create task: unexpected payload size\n");
|
||||
edie(emu, "cannot create task: unexpected payload size\n");
|
||||
|
||||
uint32_t task_id = emu->cur_ev->payload.u32[0];
|
||||
uint32_t type_id = emu->cur_ev->payload.u32[1];
|
||||
@ -285,9 +285,10 @@ pre_task(struct ovni_emu *emu)
|
||||
static void
|
||||
pre_type(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.value != 'c')
|
||||
edie(emu, "unexpected event value %c\n",
|
||||
emu->cur_ev->header.value);
|
||||
uint8_t value = emu->cur_ev->header.value;
|
||||
|
||||
if(value != 'c')
|
||||
edie(emu, "unexpected event value %c\n", value);
|
||||
|
||||
if((emu->cur_ev->header.flags & OVNI_EV_JUMBO) == 0)
|
||||
edie(emu, "expecting a jumbo event\n");
|
||||
@ -478,8 +479,11 @@ check_affinity(struct ovni_emu *emu)
|
||||
if(cpu->nrunning_threads > 1)
|
||||
{
|
||||
eerr(emu, "cpu %s has more than one thread running\n", cpu->name);
|
||||
if(emu->enable_linter)
|
||||
abort();
|
||||
|
||||
/* Only abort in linter mode so we can still see the
|
||||
* trace to find out what was happening */
|
||||
if(emu->enable_linter)
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,13 +491,12 @@ void
|
||||
hook_pre_nanos6(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.model != '6')
|
||||
die("hook_pre_nanos6: unexpected event with model %c\n",
|
||||
edie(emu, "hook_pre_nanos6: unexpected event with model %c\n",
|
||||
emu->cur_ev->header.model);
|
||||
|
||||
if(!emu->cur_thread->is_active) {
|
||||
eerr(emu, "hook_pre_nanos6: current thread %d not active\n",
|
||||
edie(emu, "hook_pre_nanos6: current thread %d not active\n",
|
||||
emu->cur_thread->tid);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(emu->cur_ev->header.category)
|
||||
|
@ -80,8 +80,8 @@ pre_subsystem(struct ovni_emu *emu, int st)
|
||||
chan_pop(chan, st);
|
||||
break;
|
||||
default:
|
||||
err("unexpected value '%c' (expecting '[' or ']')\n", emu->cur_ev->header.value);
|
||||
abort();
|
||||
edie(emu, "unexpected value '%c' (expecting '[' or ']')\n",
|
||||
emu->cur_ev->header.value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +89,11 @@ void
|
||||
hook_pre_nodes(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.model != 'D')
|
||||
die("hook_pre_nodes: unexpected event with model %c\n",
|
||||
edie(emu, "hook_pre_nodes: unexpected event with model %c\n",
|
||||
emu->cur_ev->header.model);
|
||||
|
||||
if(!emu->cur_thread->is_running)
|
||||
die("hook_pre_nodes: current thread %d not running\n",
|
||||
edie(emu, "hook_pre_nodes: current thread %d not running\n",
|
||||
emu->cur_thread->tid);
|
||||
|
||||
switch(emu->cur_ev->header.category)
|
||||
|
43
emu_nosv.c
43
emu_nosv.c
@ -111,13 +111,13 @@ chan_task_running(struct ovni_emu *emu, struct task *task)
|
||||
proc = emu->cur_proc;
|
||||
|
||||
if(task->id == 0)
|
||||
die("task id cannot be 0\n");
|
||||
edie(emu, "task id cannot be 0\n");
|
||||
|
||||
if(task->type->gid == 0)
|
||||
die("task type gid cannot be 0\n");
|
||||
edie(emu, "task type gid cannot be 0\n");
|
||||
|
||||
if(proc->appid <= 0)
|
||||
die("app id must be positive\n");
|
||||
edie(emu, "app id must be positive\n");
|
||||
|
||||
chan_set(&th->chan[CHAN_NOSV_TASKID], task->id);
|
||||
chan_set(&th->chan[CHAN_NOSV_TYPE], task->type->gid);
|
||||
@ -136,19 +136,19 @@ chan_task_switch(struct ovni_emu *emu,
|
||||
struct ovni_ethread *th = emu->cur_thread;
|
||||
|
||||
if(!prev || !next)
|
||||
die("cannot switch to or from a NULL task\n");
|
||||
edie(emu, "cannot switch to or from a NULL task\n");
|
||||
|
||||
if(prev == next)
|
||||
die("cannot switch to the same task\n");
|
||||
edie(emu, "cannot switch to the same task\n");
|
||||
|
||||
if(next->id == 0)
|
||||
die("next task id cannot be 0\n");
|
||||
edie(emu, "next task id cannot be 0\n");
|
||||
|
||||
if(next->type->gid == 0)
|
||||
die("next task type id cannot be 0\n");
|
||||
edie(emu, "next task type id cannot be 0\n");
|
||||
|
||||
if(prev->thread != next->thread)
|
||||
die("cannot switch to a task of another thread\n");
|
||||
edie(emu, "cannot switch to a task of another thread\n");
|
||||
|
||||
/* No need to change the rank or app ID, as we can only switch
|
||||
* to tasks of the same thread */
|
||||
@ -166,7 +166,7 @@ static void
|
||||
update_task_state(struct ovni_emu *emu)
|
||||
{
|
||||
if(ovni_payload_size(emu->cur_ev) < 4)
|
||||
die("missing task id in payload\n");
|
||||
edie(emu, "missing task id in payload\n");
|
||||
|
||||
uint32_t task_id = emu->cur_ev->payload.u32[0];
|
||||
|
||||
@ -179,7 +179,7 @@ update_task_state(struct ovni_emu *emu)
|
||||
struct task *task = task_find(info->tasks, task_id);
|
||||
|
||||
if(task == NULL)
|
||||
die("cannot find task with id %u\n", task_id);
|
||||
edie(emu, "cannot find task with id %u\n", task_id);
|
||||
|
||||
switch(emu->cur_ev->header.value)
|
||||
{
|
||||
@ -188,8 +188,8 @@ update_task_state(struct ovni_emu *emu)
|
||||
case 'p': task_pause(stack, task); break;
|
||||
case 'r': task_resume(stack, task); break;
|
||||
default:
|
||||
die("unexpected Nanos6 task event value %c\n",
|
||||
emu->cur_ev->header.value);
|
||||
edie(emu, "unexpected Nanos6 task event value %c\n",
|
||||
emu->cur_ev->header.value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ expand_transition_value(struct ovni_emu *emu, int was_running, int runs_now)
|
||||
|
||||
/* Ensure we don't clobber the value */
|
||||
if(tr == 'X' || tr == 'E')
|
||||
die("unexpected event value %c\n", tr);
|
||||
edie(emu, "unexpected event value %c\n", tr);
|
||||
|
||||
/* Modify the event value to detect nested transitions */
|
||||
if(tr == 'x' && was_running)
|
||||
@ -225,7 +225,7 @@ update_task_channels(struct ovni_emu *emu,
|
||||
case 'X': chan_task_switch(emu, prev, next); break;
|
||||
case 'E': chan_task_switch(emu, prev, next); break;
|
||||
default:
|
||||
die("unexpected transition value %c\n", tr);
|
||||
edie(emu, "unexpected transition value %c\n", tr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ static void
|
||||
create_task(struct ovni_emu *emu)
|
||||
{
|
||||
if(ovni_payload_size(emu->cur_ev) != 8)
|
||||
die("cannot create task: unexpected payload size\n");
|
||||
edie(emu, "cannot create task: unexpected payload size\n");
|
||||
|
||||
uint32_t task_id = emu->cur_ev->payload.u32[0];
|
||||
uint32_t type_id = emu->cur_ev->payload.u32[1];
|
||||
@ -279,7 +279,7 @@ pre_task(struct ovni_emu *emu)
|
||||
update_task(emu);
|
||||
break;
|
||||
default:
|
||||
die("unexpected event value %c\n",
|
||||
edie(emu, "unexpected task event value %c\n",
|
||||
emu->cur_ev->header.value);
|
||||
}
|
||||
}
|
||||
@ -288,11 +288,11 @@ static void
|
||||
pre_type(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.value != 'c')
|
||||
die("unexpected event value %c\n",
|
||||
edie(emu, "unexpected event value %c\n",
|
||||
emu->cur_ev->header.value);
|
||||
|
||||
if((emu->cur_ev->header.flags & OVNI_EV_JUMBO) == 0)
|
||||
die("expecting a jumbo event\n");
|
||||
edie(emu, "expecting a jumbo event\n");
|
||||
|
||||
uint8_t *data = &emu->cur_ev->payload.jumbo.data[0];
|
||||
uint32_t typeid = *(uint32_t *) data;
|
||||
@ -447,9 +447,8 @@ check_affinity(struct ovni_emu *emu)
|
||||
|
||||
if(cpu->nrunning_threads > 1)
|
||||
{
|
||||
err("cpu %s has more than one thread running\n",
|
||||
edie(emu, "cpu %s has more than one thread running\n",
|
||||
cpu->name);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,11 +456,11 @@ void
|
||||
hook_pre_nosv(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.model != 'V')
|
||||
die("hook_pre_nosv: unexpected event with model %c\n",
|
||||
edie(emu, "hook_pre_nosv: unexpected event with model %c\n",
|
||||
emu->cur_ev->header.model);
|
||||
|
||||
if(!emu->cur_thread->is_active)
|
||||
die("hook_pre_nosv: current thread %d not active\n",
|
||||
edie(emu, "hook_pre_nosv: current thread %d not active\n",
|
||||
emu->cur_thread->tid);
|
||||
|
||||
switch(emu->cur_ev->header.category)
|
||||
|
12
emu_ovni.c
12
emu_ovni.c
@ -312,7 +312,7 @@ pre_thread_execute(struct ovni_emu *emu, struct ovni_ethread *th)
|
||||
|
||||
/* The thread cannot be already running */
|
||||
if(th->state == TH_ST_RUNNING)
|
||||
die("pre_thread_execute: thread %d already running\n",
|
||||
edie(emu, "pre_thread_execute: thread %d already running\n",
|
||||
th->tid);
|
||||
|
||||
cpuid = emu->cur_ev->payload.i32[0];
|
||||
@ -456,11 +456,11 @@ pre_affinity_set(struct ovni_emu *emu)
|
||||
cpuid = emu->cur_ev->payload.i32[0];
|
||||
|
||||
if(th->cpu == NULL)
|
||||
die("pre_affinity_set: thread %d doesn't have a CPU\n",
|
||||
edie(emu, "pre_affinity_set: thread %d doesn't have a CPU\n",
|
||||
th->tid);
|
||||
|
||||
if(!th->is_active)
|
||||
die("pre_affinity_set: thread %d is not active\n",
|
||||
edie(emu, "pre_affinity_set: thread %d is not active\n",
|
||||
th->tid);
|
||||
|
||||
/* Migrate current cpu to the one at cpuid */
|
||||
@ -521,16 +521,16 @@ pre_affinity_remote(struct ovni_emu *emu)
|
||||
|
||||
/* The remote_th cannot be in states dead or unknown */
|
||||
if(remote_th->state == TH_ST_DEAD)
|
||||
die("pre_affinity_remote: remote thread %d in state DEAD\n",
|
||||
edie(emu, "pre_affinity_remote: remote thread %d in state DEAD\n",
|
||||
remote_th->tid);
|
||||
|
||||
if(remote_th->state == TH_ST_UNKNOWN)
|
||||
die("pre_affinity_remote: remote thread %d in state UNKNOWN\n",
|
||||
edie(emu, "pre_affinity_remote: remote thread %d in state UNKNOWN\n",
|
||||
remote_th->tid);
|
||||
|
||||
/* It must have an assigned CPU */
|
||||
if(remote_th->cpu == NULL)
|
||||
die("pre_affinity_remote: remote thread %d has no CPU\n",
|
||||
edie(emu, "pre_affinity_remote: remote thread %d has no CPU\n",
|
||||
remote_th->tid);
|
||||
|
||||
/* Migrate current cpu to the one at cpuid */
|
||||
|
@ -78,7 +78,8 @@ pre_tampi_mode(struct ovni_emu *emu, int state)
|
||||
chan_pop(&th->chan[CHAN_TAMPI_MODE], state);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
edie(emu, "unexpected event value %c for tampi mode\n",
|
||||
emu->cur_ev->header.value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +87,7 @@ void
|
||||
hook_pre_tampi(struct ovni_emu *emu)
|
||||
{
|
||||
if(emu->cur_ev->header.model != 'T')
|
||||
die("hook_pre_tampi: unexpected event with model %c\n",
|
||||
edie(emu, "hook_pre_tampi: unexpected event with model %c\n",
|
||||
emu->cur_ev->header.model);
|
||||
|
||||
switch(emu->cur_ev->header.category)
|
||||
|
Loading…
Reference in New Issue
Block a user