support getcpu() system call. refs #385

It appeared on Linux(x86) in kernel 3.1.
This commit is contained in:
NAKAMURA Gou
2015-02-10 15:58:14 +09:00
parent a5bdd41c3d
commit d30d8fe71c
2 changed files with 29 additions and 0 deletions

View File

@@ -3869,6 +3869,34 @@ out:
return ret;
}
SYSCALL_DECLARE(getcpu)
{
const uintptr_t cpup = ihk_mc_syscall_arg0(ctx);
const uintptr_t nodep = ihk_mc_syscall_arg1(ctx);
struct process *proc = cpu_local_var(current);
const int cpu = ihk_mc_get_processor_id();
const int node = 0;
int error;
if (cpup) {
error = copy_to_user(proc, (void *)cpup, &cpu, sizeof(cpu));
if (error) {
goto out;
}
}
if (nodep) {
error = copy_to_user(proc, (void *)nodep, &node, sizeof(node));
if (error) {
goto out;
}
}
error = 0;
out:
return error;
} /* sys_getcpu() */
#ifdef DCFA_KMOD
#ifdef CMD_DCFA