support getcpu() system call. refs #385
It appeared on Linux(x86) in kernel 3.1.
This commit is contained in:
@@ -90,6 +90,7 @@ SYSCALL_HANDLED(289, signalfd4)
|
|||||||
#ifdef DCFA_KMOD
|
#ifdef DCFA_KMOD
|
||||||
SYSCALL_HANDLED(303, mod_call)
|
SYSCALL_HANDLED(303, mod_call)
|
||||||
#endif
|
#endif
|
||||||
|
SYSCALL_HANDLED(309, getcpu)
|
||||||
SYSCALL_HANDLED(601, pmc_init)
|
SYSCALL_HANDLED(601, pmc_init)
|
||||||
SYSCALL_HANDLED(602, pmc_start)
|
SYSCALL_HANDLED(602, pmc_start)
|
||||||
SYSCALL_HANDLED(603, pmc_stop)
|
SYSCALL_HANDLED(603, pmc_stop)
|
||||||
|
|||||||
@@ -3869,6 +3869,34 @@ out:
|
|||||||
return ret;
|
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 DCFA_KMOD
|
||||||
|
|
||||||
#ifdef CMD_DCFA
|
#ifdef CMD_DCFA
|
||||||
|
|||||||
Reference in New Issue
Block a user