From: "Jike Song" <albcamus@gmail.com>
To: gcosta@redhat.com
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com
Subject: questions about rd{msr|tsc|pmc} instruction with x86-64
Date: Thu, 16 Oct 2008 14:30:25 +0800 [thread overview]
Message-ID: <df9815e70810152330h7886c77arb01e1fd308b4a7ae@mail.gmail.com> (raw)
Hi experts,
commit c210d24986dc19e387c10508c0bc2faadadc1a2e introduced such codes
and comments in include/asm-x86/msr.h:
/*
* i386 calling convention returns 64-bit value in edx:eax, while
* x86_64 returns at rax. Also, the "A" constraint does not really
* mean rdx:rax in x86_64, so we need specialized behaviour for each
* architecture
*/
#ifdef CONFIG_X86_64
#define DECLARE_ARGS(val, low, high) unsigned low, high
#define EAX_EDX_VAL(val, low, high) ((low) | ((u64)(high) << 32))
#define EAX_EDX_ARGS(val, low, high) "a" (low), "d" (high)
#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
#else
#define DECLARE_ARGS(val, low, high) unsigned long long val
#define EAX_EDX_VAL(val, low, high) (val)
#define EAX_EDX_ARGS(val, low, high) "A" (val)
#define EAX_EDX_RET(val, low, high) "=A" (val)
#endif
By my reading of Intel & AMD manuals, this comment is wrong. rdmsr of
x86-64 has the same behavior as i386, namely the high 32bit returns in
edx and the low 32bit in eax, not "returns at rax". And the gcc
constraint "A" does mean edx:eax in x86-64 also, at least when testing
on my AMD Turion 64 processor.
So the question is, do we really need these macros? Why a single "A"
won't work? Or do I have anything misunderstood?
--
Thanks,
Jike
next reply other threads:[~2008-10-16 6:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 6:30 Jike Song [this message]
2008-10-16 6:39 ` H. Peter Anvin
2008-10-16 16:31 ` Jike Song
[not found] ` <48F76FA3.1000602@zytor.com>
2008-10-17 5:25 ` Jike Song
2008-10-20 13:47 ` Ingo Molnar
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=df9815e70810152330h7886c77arb01e1fd308b4a7ae@mail.gmail.com \
--to=albcamus@gmail.com \
--cc=gcosta@redhat.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
all inboxes | Powered by JetHome®