123 # include <link.h> |
123 # include <link.h> |
124 # include <stdint.h> |
124 # include <stdint.h> |
125 # include <inttypes.h> |
125 # include <inttypes.h> |
126 # include <sys/ioctl.h> |
126 # include <sys/ioctl.h> |
127 |
127 |
128 #ifdef AMD64 |
|
129 #include <asm/vsyscall.h> |
|
130 #endif |
|
131 |
|
132 #define MAX_PATH (2 * K) |
128 #define MAX_PATH (2 * K) |
133 |
129 |
134 // for timer info max values which include all bits |
130 // for timer info max values which include all bits |
135 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) |
131 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) |
136 #define SEC_IN_NANOSECS 1000000000LL |
132 #define SEC_IN_NANOSECS 1000000000LL |
2598 int os::Linux::sched_getcpu_syscall(void) { |
2594 int os::Linux::sched_getcpu_syscall(void) { |
2599 unsigned int cpu; |
2595 unsigned int cpu; |
2600 int retval = -1; |
2596 int retval = -1; |
2601 |
2597 |
2602 #if defined(IA32) |
2598 #if defined(IA32) |
|
2599 # ifndef SYS_getcpu |
|
2600 # define SYS_getcpu 318 |
|
2601 # endif |
2603 retval = syscall(SYS_getcpu, &cpu, NULL, NULL); |
2602 retval = syscall(SYS_getcpu, &cpu, NULL, NULL); |
2604 #elif defined(AMD64) |
2603 #elif defined(AMD64) |
|
2604 // Unfortunately we have to bring all these macros here from vsyscall.h |
|
2605 // to be able to compile on old linuxes. |
|
2606 # define __NR_vgetcpu 2 |
|
2607 # define VSYSCALL_START (-10UL << 20) |
|
2608 # define VSYSCALL_SIZE 1024 |
|
2609 # define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr)) |
2605 typedef long (*vgetcpu_t)(unsigned int *cpu, unsigned int *node, unsigned long *tcache); |
2610 typedef long (*vgetcpu_t)(unsigned int *cpu, unsigned int *node, unsigned long *tcache); |
2606 vgetcpu_t vgetcpu = (vgetcpu_t)VSYSCALL_ADDR(__NR_vgetcpu); |
2611 vgetcpu_t vgetcpu = (vgetcpu_t)VSYSCALL_ADDR(__NR_vgetcpu); |
2607 retval = vgetcpu(&cpu, NULL, NULL); |
2612 retval = vgetcpu(&cpu, NULL, NULL); |
2608 #endif |
2613 #endif |
2609 |
2614 |