support vsyscall_getcpu() vsyscall. refs #385

This version simply calls getcpu() system call, so that it's not fast.
This commit is contained in:
NAKAMURA Gou
2015-02-10 15:59:23 +09:00
parent d30d8fe71c
commit a4a806bef7
5 changed files with 26 additions and 0 deletions

View File

@ -58,3 +58,17 @@ long vsyscall_time(void *tp)
return t;
}
extern int vsyscall_getcpu(unsigned *cpup, unsigned *nodep, void *tcachep)
__attribute__ ((section (".vsyscall.getcpu")));
int vsyscall_getcpu(unsigned *cpup, unsigned *nodep, void *tcachep)
{
int error;
asm ("syscall" : "=a" (error)
: "a" (__NR_getcpu), "D" (cpup), "S" (nodep), "d" (tcachep)
: "%rcx", "%r11", "memory");
return error;
}