On 1 Jul 2000, H. Peter Anvin wrote:
> Followup to: <[EMAIL PROTECTED]>
> By author: "Mark H. Wood" <[EMAIL PROTECTED]>
> In newsgroup: linux.dev.gcc
> >
> > On Thu, 29 Jun 2000, Martin v. Loewis wrote:
> > [snip]
> > > > On the i386 platform relative jumps are limited to an 8 bit signed
> > > > offset. In order to jump further than this the jumps must be threaded (I
> > > > may be wrong about this, in truth it has been a while since I did any
> > > > assembly on the Intels).
> > >
> > > No. On the i386 platform, *all* jumps are PC-relative (except for the
> > > indirect ones), so you can jump relatively to about any location you
[I read right over the exception. Oops.]
> > > want.
> >
> > My Intel Software Developer's Manual: Instruction Set Reference seems to
> > be saying that things are more complex than that. Conditional jumps can
> > be relative to CS (near jump) or relative to CS:EIP (short jump).
> > Unconditional jumps can be relative to CS, relative to CS:EIP, or relative
> > to a new value that the jump will load into CS (far jump). Only short
> > jumps take any notice of the current EIP value. So all jumps are
> > *segment*-relative, but not all are PC-relative.
> >
>
> Uh, no.
>
> Only far jumps are absolute. Near jumps, may they be 8- (short), 16-
> or 32-bit, are always PC-relative. Far jumps (those that include a
> CS) are always absolute.
I reread the material and found that I was being confused by the way the
various modes are being presented. There are indeed PC-relative near
jumps. But either I'm still confused, or there is still more complexity:
opcode E9 is a PC-relative near jump, but FF/4 (also near) seems to be
what Intel calls "absolute". The text (page 3-245 of the 1997 edition),
under the heading "Near and Short Jumps", discusses "absolute offsets",
and the opcode table on that page calls FF/4 "Jump near, absolute
indirect,..."
Regardless of my earlier error, the situation is more complex than what
was presented by either of the postings I quoted. It is not true that
relative jumps are constrained by an 8-bit displacement; 16- and 32-bit
forms are provided by opcode E9. It is not true that all nonindirect jumps
are PC-relative; opcode EA is "absolute" but not indirect.
I'll try to shut up now. :-/
--
Mark H. Wood, Lead System Programmer [EMAIL PROTECTED]
I'd like to find the person who coined "short jump" but forgot "medium
jump" and "long jump".