summaryrefslogtreecommitdiff
path: root/ace/gethrtime.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-11 17:49:53 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-11 17:49:53 +0000
commit4752dc39be90f05052f44070c06dffc03e0904a2 (patch)
tree1b6e16bdc322b93d38e8688e01edd33809f130fd /ace/gethrtime.cpp
parentfffb57071262c2d820e9f25e652a4c0f9e29ad1d (diff)
downloadATCD-4752dc39be90f05052f44070c06dffc03e0904a2.tar.gz
added some comments about GHS asm support
Diffstat (limited to 'ace/gethrtime.cpp')
-rw-r--r--ace/gethrtime.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/ace/gethrtime.cpp b/ace/gethrtime.cpp
index 33ae48f61fd..54e3b1abab1 100644
--- a/ace/gethrtime.cpp
+++ b/ace/gethrtime.cpp
@@ -2,8 +2,8 @@
//
// Build this file with g++. It can be linked in to a ACE application
// that was compiled with GreenHills. It wouldn't be necessary if I
-// knew a way to move values from registers to variables in ghs asm
-// code. That's easy with g++ asm.
+// knew a way to correctly move values from registers to a 64-bit variable
+// in GHS asm code. That's easy with g++ asm.
#include "ace/OS.h"
@@ -11,7 +11,7 @@ extern "C"
ACE_hrtime_t
ACE_gethrtime ()
{
-#if defined (__GNUG__) && defined (ACE_HAS_PENTIUM)
+#if defined (ACE_HAS_PENTIUM)
// ACE_TRACE ("ACE_gethrtime");
#if defined (ACE_LACKS_LONGLONG_T)
@@ -25,7 +25,16 @@ ACE_gethrtime ()
//
// Read the high-res tick counter directly into memory variable "now".
// The A constraint signifies a 64-bit int.
+#if defined (__GNUG__)
asm volatile ("rdtsc" : "=A" (now) : : "memory");
+// #elif defined (ghs)
+// The following doesn't work. For now, this file must be compile with g++.
+// asm ("rdtsc");
+// asm ("movl %edx,-16(%ebp)");
+// asm ("movl %eax,-12(%ebp)");
+#else
+# error unsupported compiler
+#endif
#if defined (ACE_LACKS_LONGLONG_T)
// ACE_U_LongLong doesn't have the same layout as now, so construct
@@ -40,7 +49,7 @@ ACE_gethrtime ()
return now;
#endif /* ! ACE_LACKS_LONGLONG_T */
-#else /* ! __GNUG__ || ! ACE_HAS_PENTIUM */
-# error This file can _only_ be compiled with g++, with ACE_HAS_PENTIUM.
-#endif /* ! __GNUG__ || ! ACE_HAS_PENTIUM */
+#else /* ! ACE_HAS_PENTIUM */
+# error This file can _only_ be compiled with ACE_HAS_PENTIUM.
+#endif /* ! ACE_HAS_PENTIUM */
}