Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee2dd4a

Browse files
committed
Merged revisions 75984 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r75984 | mark.dickinson | 2009-10-31 10:18:44 +0000 (Sat, 31 Oct 2009) | 12 lines Merged revisions 75982 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r75982 | mark.dickinson | 2009-10-31 10:11:28 +0000 (Sat, 31 Oct 2009) | 5 lines Issue #6603: Fix --with-tsc build failures on x86-64 that resulted from a gcc inline assembler peculiarity. (gcc's "A" constraint apparently means 'rax or rdx' in 64-bit mode, not edx:eax or rdx:rax as one might expect.) ........ ................
1 parent aa8be96 commit ee2dd4a

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ Tests
130130
Build
131131
-----
132132

133+
- Issue #6603: Change READ_TIMESTAMP macro in ceval.c so that it
134+
compiles correctly under gcc on x86-64. This fixes a reported
135+
problem with the --with-tsc build on x86-64.
136+
133137
- Issue #6802: Fix build issues on MacOSX 10.6
134138

135139
- Issue #6801 : symmetric_difference_update also accepts |.

Python/ceval.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,29 @@ ppc_getcounter(uint64 *v)
5151
((long*)(v))[1] = tb;
5252
}
5353

54-
#else /* this is for linux/x86 (and probably any other GCC/x86 combo) */
54+
#elif defined(__i386__)
55+
56+
/* this is for linux/x86 (and probably any other GCC/x86 combo) */
5557

5658
#define READ_TIMESTAMP(val) \
5759
__asm__ __volatile__("rdtsc" : "=A" (val))
5860

61+
#elif defined(__x86_64__)
62+
63+
/* for gcc/x86_64, the "A" constraint in DI mode means *either* rax *or* rdx;
64+
not edx:eax as it does for i386. Since rdtsc puts its result in edx:eax
65+
even in 64-bit mode, we need to use "a" and "d" for the lower and upper
66+
32-bit pieces of the result. */
67+
68+
#define READ_TIMESTAMP(val) \
69+
__asm__ __volatile__("rdtsc" : \
70+
"=a" (((int*)&(val))[0]), "=d" (((int*)&(val))[1]));
71+
72+
73+
#else
74+
75+
#error "Don't know how to implement timestamp counter for this architecture"
76+
5977
#endif
6078

6179
void dump_tsc(int opcode, int ticked, uint64 inst0, uint64 inst1,

0 commit comments

Comments
 (0)