public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 3/3] add Via Nehemiah ("xstore") rng support
Date: Wed, 12 Mar 2003 00:16:29 -0500	[thread overview]
Message-ID: <3E6EC2AD.7000504@pobox.com> (raw)
In-Reply-To: <200303120427.UAA00323@cesium.transmeta.com>

H. Peter Anvin wrote:
> In article <3E6EA909.9020200@pobox.com> of
> linux.dev.kernel, you write:
> 
>>diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig
>>--- a/drivers/char/Kconfig	Tue Mar 11 21:37:50 2003
>>+++ b/drivers/char/Kconfig	Tue Mar 11 21:37:50 2003
>>@@ -710,7 +710,7 @@
>> 	  If you're not sure, say N.
>> 
>> config HW_RANDOM
>>-	tristate "Intel/AMD H/W Random Number Generator support"
>>+	tristate "Intel/AMD/Via H/W Random Number Generator support"
>> 	depends on (X86 || IA64) && PCI
>> 	---help---
>> 	  This driver provides kernel-side support for the Random Number
> 
> 
> 
> How about changing this to "HW Random Number Generator"?

easily done.


>>+static inline u32 xstore(u32 *addr, u32 edx_in)
>>+{
>>+	u32 eax_out;
>>+
>>+	asm(".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */"
>>+		:"=m"(*addr), "=a"(eax_out)
>>+		:"D"(addr), "d"(edx_in));
>>+
>>+	return eax_out;
>>+}
> 
> 
> Note that your "=m" (*addr) is never actually used here -- it doesn't
> affect the instruction encoding, and it only shows up in a comment.
> Since gcc will generate an instruction mode here, it will be highly
> confused.
> 
> I am assuming 0xC0 is a modr/m byte, in which case the most sane
> interpretation of this instruction would be "xstore %eax"; %edi is
> presumably implicit since you claim it can take a REP prefix...

and yet strangely the asm code seems to be correct :)

         .p2align 4,,15
         .type   via_data_present,@function
via_data_present:
         pushl   %edi
         xorl    %edi, %edi	# zero edi
         movl    $3, %edx        #  edx_in
         movl    %edi, via_rng_datum     #  zero via_rng_datum
         movl    $via_rng_datum, %edi    #  addr
#APP
         .byte 0x0F,0xA7,0xC0 /* xstore %edi (addr=via_rng_datum) */
#NO_APP
         popl    %edi
         andl    $15, %eax       #  eax_out
         setne   %al
         movzbl  %al, %eax
         ret



       reply	other threads:[~2003-03-12  5:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200303120427.UAA00323@cesium.transmeta.com>
2003-03-12  5:16 ` Jeff Garzik [this message]
2003-03-12  5:19   ` [patch 3/3] add Via Nehemiah ("xstore") rng support H. Peter Anvin
2003-03-12  3:27 Jeff Garzik
2003-03-12  3:31 ` Jeff Garzik
2003-03-12 12:55 ` Dave Jones
2003-03-12 15:16   ` Linus Torvalds
2003-03-12 16:21     ` H. Peter Anvin
2003-03-12 17:56     ` Dave Jones

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=3E6EC2AD.7000504@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=hpa@zytor.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