add lookup_user_context(). refs #420

This commit is contained in:
NAKAMURA Gou
2015-02-25 19:47:29 +09:00
parent b66b950129
commit 305ebfed0e

View File

@ -22,6 +22,7 @@
#include <march.h>
#include <signal.h>
#include <process.h>
#include <cls.h>
#define LAPIC_ID 0x020
#define LAPIC_TIMER 0x320
@ -887,3 +888,28 @@ int ihk_mc_interrupt_cpu(int cpu, int vector)
x86_issue_ipi(cpu, vector);
return 0;
}
ihk_mc_user_context_t *lookup_user_context(struct process *proc)
{
ihk_mc_user_context_t *uctx = proc->uctx;
if ((!(proc->ftn->status & (PS_INTERRUPTIBLE | PS_UNINTERRUPTIBLE
| PS_STOPPED | PS_TRACED))
&& (proc != cpu_local_var(current)))
|| !uctx->is_gpr_valid) {
return NULL;
}
if (!uctx->is_sr_valid) {
uctx->sr.fs_base = proc->thread.tlsblock_base;
uctx->sr.gs_base = 0;
uctx->sr.ds = 0;
uctx->sr.es = 0;
uctx->sr.fs = 0;
uctx->sr.gs = 0;
uctx->is_sr_valid = 1;
}
return uctx;
} /* lookup_user_context() */