From: richard.brunner@amd.com
To: linux-kernel@vger.kernel.org
Subject: RE: Intel vs AMD64
Date: Wed, 25 Feb 2004 22:28:02 -0600 [thread overview]
Message-ID: <99F2150714F93F448942F9A9F112634C0FD3855C@txexmtae.amd.com> (raw)
Not sure about other architectures, but in the
AMD64 architecture, the 66h and 67h prefixes
can be applied to the near branch
instructions and have an *architecturally*
defined action (rather than implementation-defined
action) which all AMD64 processors follow. It's all
described in the AMD64 Architecture Programmer's
Manuals ...
(http://www.amd.com/us-en/Processors/DevelopWithAMD/0,,30_2252_739_7044,00.html)
But, I definitely agree that it is sorta hard to figure
out what a 64-bit general purpose compiler would
actually *do* with some of them. However, there are
embedded/special-purpose scenarios where this might
be just fine.
For example, for JMP (near):
In 64-bit mode, if the JMP target is specified by a
displacement in the instruction, the signed displacement is
added to the rIP (of the following instruction), and the
result is truncated to 16 or 64 bits depending on operand
size. [rb: 64-bit is default, 66h forces 16-bit]. The
signed displacement can be 8 bits, 16 bits, or 32 bits,
depending on the opcode and the operand size. [rb: 8-bit
has its own opcode (EB); for the E9 opcode: 32-bit is
default and 66h forces 16-bit].
] -Rich ...
] AMD Fellow
] richard.brunner at amd com
> -----Original Message-----
> From: Nakajima, Jun [mailto:jun.nakajima@intel.com]
> Sent: Wednesday, February 25, 2004 5:20 PM
> To: H. Peter Anvin; Timothy Miller
> Cc: linux-kernel@vger.kernel.org
> Subject: RE: Intel vs AMD x86-64
>
> Yes, that's the very reason I said "useless for compilers." The way
> IP/RIP is updated is different (and implementation specific) on those
> processors if 66H is used with a near branch. For example, RIP may be
> zero-extended to 64 bits (from IP), as you observed before.
>
> Jun
> >-----Original Message-----
> >From: H. Peter Anvin [mailto:hpa@zytor.com]
> >Sent: Wednesday, February 25, 2004 4:14 PM
> >To: Timothy Miller
> >Cc: Nakajima, Jun; linux-kernel@vger.kernel.org
> >Subject: Re: Intel vs AMD x86-64
> >
> >Timothy Miller wrote:
> >>
> >>
> >> Nakajima, Jun wrote:
> >>
> >>> For near branches (CALL, RET, JCC, JCXZ, JMP, etc.), the operand size is
> >>> forced to 64 bits on both processors in 64-bit mode, basically meaning
> >>> RIP is updated.
> >>>
> >>> Compilers would typically use a JMP short for "intraprocedural jumps",
> >>> which requires just an 8-bit displacement relative to RIP.
> >>
> >> I see. It's too bad you can't have a 16-bit displacement.
> >>
> >> Ummm... so if 66H were used with a near branch, would that affect the
> >> size of the immediate operand which gets added to RIP, or would that
> >> affect the the portion of IP/EIP/RIP affected? If it's the latter,
> >> that's pretty silly.
> >>
> >
> >Yes, that would be pretty silly.
> >
> >I honestly don't remember off the top of my head what "o16 jmp blah"
> >does on i386; I have a vague memory that it zero-extends %eip to 32
> >bits, which makes it useless, of course.
> >
> > -hpa
>
next reply other threads:[~2004-02-26 4:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-26 4:28 richard.brunner [this message]
2004-02-26 5:32 Nakajima, Jun
2004-02-26 13:39 ` Chris Wedgwood
2004-02-26 14:35 ` Richard B. Johnson
2004-02-26 19:25 ` Timothy Miller
2004-02-26 19:46 ` Richard B. Johnson
2004-02-27 18:44 ` H. Peter Anvin
2004-02-26 19:18 ` Timothy Miller
2004-02-26 19:45 ` Scott Robert Ladd
2004-02-27 14:43 ` Timothy Miller
2004-03-03 17:34 ` Pavel Machek
[not found] <7F740D512C7C1046AB53446D37200173EA28A5@scsmsx402.sc.intel.com.suse.lists.linux.kernel>
[not found] ` <403E4681.20603@techsource.com.suse.lists.linux.kernel>
2004-02-26 20:17 ` Andi Kleen
2004-02-27 14:50 ` Timothy Miller
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=99F2150714F93F448942F9A9F112634C0FD3855C@txexmtae.amd.com \
--to=richard.brunner@amd.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®