src/os/linux/vm/os_linux.cpp

changeset 3087
9447b2fb6fcf
parent 3085
3cd0157e1d4d
child 3113
27702f012017
     1.1 --- a/src/os/linux/vm/os_linux.cpp	Mon Aug 29 10:13:06 2011 -0700
     1.2 +++ b/src/os/linux/vm/os_linux.cpp	Mon Aug 29 17:42:39 2011 -0700
     1.3 @@ -125,10 +125,6 @@
     1.4  # include <inttypes.h>
     1.5  # include <sys/ioctl.h>
     1.6  
     1.7 -#ifdef AMD64
     1.8 -#include <asm/vsyscall.h>
     1.9 -#endif
    1.10 -
    1.11  #define MAX_PATH    (2 * K)
    1.12  
    1.13  // for timer info max values which include all bits
    1.14 @@ -2600,8 +2596,17 @@
    1.15    int retval = -1;
    1.16  
    1.17  #if defined(IA32)
    1.18 +# ifndef SYS_getcpu
    1.19 +# define SYS_getcpu 318
    1.20 +# endif
    1.21    retval = syscall(SYS_getcpu, &cpu, NULL, NULL);
    1.22  #elif defined(AMD64)
    1.23 +// Unfortunately we have to bring all these macros here from vsyscall.h
    1.24 +// to be able to compile on old linuxes.
    1.25 +# define __NR_vgetcpu 2
    1.26 +# define VSYSCALL_START (-10UL << 20)
    1.27 +# define VSYSCALL_SIZE 1024
    1.28 +# define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
    1.29    typedef long (*vgetcpu_t)(unsigned int *cpu, unsigned int *node, unsigned long *tcache);
    1.30    vgetcpu_t vgetcpu = (vgetcpu_t)VSYSCALL_ADDR(__NR_vgetcpu);
    1.31    retval = vgetcpu(&cpu, NULL, NULL);

mercurial