aboutsummaryrefslogtreecommitdiff
path: root/src/include/cpu/x86/tsc.h
diff options
context:
space:
mode:
authorEric Biederman <ebiederm@xmission.com>2004-10-14 20:13:01 +0000
committerEric Biederman <ebiederm@xmission.com>2004-10-14 20:13:01 +0000
commitc84c1906b78b767902bf9d8f18ae8a21d2f1f114 (patch)
tree136d8ed19f4cc487e5b7d01416aaab3810ee6659 /src/include/cpu/x86/tsc.h
parentb84166e8e53476f1ef4d49aca17f99d303b4aa67 (diff)
- Renamed cpu header files
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1659 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/include/cpu/x86/tsc.h')
-rw-r--r--src/include/cpu/x86/tsc.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/include/cpu/x86/tsc.h b/src/include/cpu/x86/tsc.h
new file mode 100644
index 0000000000..fdf6d74e64
--- /dev/null
+++ b/src/include/cpu/x86/tsc.h
@@ -0,0 +1,30 @@
+#ifndef CPU_X86_TSC_H
+#define CPU_X86_TSC_H
+
+struct tsc_struct {
+ unsigned lo;
+ unsigned hi;
+};
+typedef struct tsc_struct tsc_t;
+
+static tsc_t rdtsc(void)
+{
+ tsc_t res;
+ __asm__ __volatile__ (
+ "rdtsc"
+ : "=a" (res.lo), "=d"(res.hi) /* outputs */
+ );
+ return res;
+}
+
+#ifndef ROMCC
+static inline unsigned long long rdtscll(void)
+{
+ unsigned long long val;
+ asm volatile ("rdtsc" : "=A" (val));
+ return val;
+}
+#endif
+
+
+#endif /* CPU_X86_TSC_H */