From: Brian Gerst <bgerst@didntduck.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] cpu_has_tsc
Date: Mon, 20 May 2002 22:10:27 -0400 [thread overview]
Message-ID: <3CE9AC93.5050107@didntduck.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 132 bytes --]
This patch converts drivers/char/random.c and
drivers/input/joystick/analog.c to use the cpu_has_tsc macro.
--
Brian Gerst
[-- Attachment #2: cpu_has_tsc-1 --]
[-- Type: text/plain, Size: 1479 bytes --]
diff -urN linux-bk/drivers/char/random.c linux/drivers/char/random.c
--- linux-bk/drivers/char/random.c Wed May 15 10:27:26 2002
+++ linux/drivers/char/random.c Mon May 20 22:03:58 2002
@@ -735,18 +735,14 @@
__s32 delta, delta2, delta3;
int entropy = 0;
-#if defined (__i386__)
- if ( test_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability) ) {
+#if defined (__i386__) || defined (__x86_64__)
+ if (cpu_has_tsc)
__u32 high;
rdtsc(time, high);
num ^= high;
} else {
time = jiffies;
}
-#elif defined (__x86_64__)
- __u32 high;
- rdtsc(time, high);
- num ^= high;
#else
time = jiffies;
#endif
diff -urN linux-bk/drivers/input/joystick/analog.c linux/drivers/input/joystick/analog.c
--- linux-bk/drivers/input/joystick/analog.c Thu Mar 7 21:18:24 2002
+++ linux/drivers/input/joystick/analog.c Mon May 20 22:05:48 2002
@@ -137,10 +137,9 @@
*/
#ifdef __i386__
-#define TSC_PRESENT (test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability))
-#define GET_TIME(x) do { if (TSC_PRESENT) rdtscl(x); else x = get_time_pit(); } while (0)
-#define DELTA(x,y) (TSC_PRESENT?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0)))
-#define TIME_NAME (TSC_PRESENT?"TSC":"PIT")
+#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
+#define DELTA(x,y) (cpu_has_tsc?((y)-(x)):((x)-(y)+((x)<(y)?1193180L/HZ:0)))
+#define TIME_NAME (cpu_has_tsc?"TSC":"PIT")
static unsigned int get_time_pit(void)
{
extern spinlock_t i8253_lock;
next reply other threads:[~2002-05-21 2:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-21 2:10 Brian Gerst [this message]
2002-05-21 15:05 ` [PATCH] cpu_has_tsc Martin J. Bligh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3CE9AC93.5050107@didntduck.org \
--to=bgerst@didntduck.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.