From: Kasper Dupont <kasperd@daimi.au.dk>
To: john stultz <johnstul@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
"Martin J. Bligh" <Martin.Bligh@us.ibm.com>
Subject: Re: [RFC] [PATCH] tsc_disable_B2 with "soft" rdtsc
Date: Sat, 22 Jun 2002 03:31:17 +0200 [thread overview]
Message-ID: <3D13D365.A39B1F38@daimi.au.dk> (raw)
In-Reply-To: 1024613272.5184.176.camel@cog
john stultz wrote:
>
> Hello all,
>
> Here is my next rev of the tsc-disable patch. This one corrects a
> Configure.in typo (Caught by Gabriel Paubert), and probably more
> controversial, implements a soft rdtsc instruction via do_gettimeofday.
>
> This avoids the earlier "box won't boot" problems with i686 optimized
> glibc's that called rdtsc. The rdtsc instruction will now be caught, and
> faked returning to the user program the same value of gettimeofday. Yes,
> its pretty hackish, but it works, albeit slowly.
+#ifdef CONFIG_X86_NUMA
+ /* "soft" rdtsc implementation */
+ if(!cpu_has_tsc)
+ {
+ char rdtsc_inst[2] = {0x0f, 0x31}; /*rdtsc opcode*/
+ char* inst_ptr = (char*)regs->eip;
+ if((inst_ptr[0] == rdtsc_inst[0])
+ &&(inst_ptr[1] == rdtsc_inst[1])){
Any particular reason for puting the opcode in an
array and verify against that instead of just
verifying inst_ptr[i] against the constants?
+ struct timeval tv;
+ do_gettimeofday(&tv);
+ regs->eax = tv.tv_usec;
+ regs->edx = tv.tv_sec;
Looks like the soft tsc is going to be jumping
rather than runing. It is going to be increasing
at a constat rate most of the time, but will make
a big jump ahead every second. Couldn't the jump
easilly be made a lot smaller by using:
regs->eax = tv.tv_usec<<2;
Of course this is not completely accurate either,
are we willing to pay the price for a more
accurate version?
+ regs->eip += 2; /*= size of opcode*/
+ return;
+ }
+ }
+#endif
--
Kasper Dupont -- der bruger for meget tid på usenet.
For sending spam use mailto:razor-report@daimi.au.dk
prev parent reply other threads:[~2002-06-22 1:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-20 22:47 [RFC] [PATCH] tsc_disable_B2 with "soft" rdtsc john stultz
2002-06-22 1:31 ` Kasper Dupont [this message]
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=3D13D365.A39B1F38@daimi.au.dk \
--to=kasperd@daimi.au.dk \
--cc=Martin.Bligh@us.ibm.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox