X86 Assembly Short Jump

Kris Lyon goa@rogers.com
Tue Dec 30 13:56:00 GMT 2003

I double checked the Intel documentation
(http://www.intel.com/design/pentiumiii/manuals/), and as far as I can
tell JMP is the only non-conditional jump instruction of this type.
Thanks for the suggestion though.  I just wanted to know if there was
something horribly obvious that I was doing wrong.  If anyone has
anymore suggestions... they'd be appreciated.


-----Original Message-----
From: qinfeng.zhang@philips.com [mailto:qinfeng.zhang@philips.com] 
Sent: Tuesday, December 30, 2003 1:51 AM
To: goa@rogers.com
Cc: gcc-help@gcc.gnu.org; gcc-help-owner@gcc.gnu.org; goa@rogers.com
Subject: Re: X86 Assembly Short Jump

It seems that you should use another jump instruction.

I have the impression that there are several typy jump instructions in
x86 assembly.

For JMP, the destination address is a relative address. There should be
another jump

instruction, which has a absolute address as destination.

Anyway, I am not sure. You can refer the Intel doc.

Regards              /)/)
Qinfeng Zhang

Philips Research East Asia - Shanghai
Tel: (86-21) 6354 1088 Ext. 5356
Fax: (86-21) 6354 4954
Email: qinfeng.zhang@philips.com





                                                    (bcc: Qinfeng

                                                   Subject:    X86
Assembly Short Jump



               Sent by:




               2003-12-30 11:46



I've having a problem using gcc's inline assembly on a Pentium 3 running
redhat linux:

I'm working inside a __asm__("."); block and I'd like to execute a short
(near relative) jump instruction.  It doesn't seem to work.  Instead, I
get a near jump to an absolute position, so I figure that I'm doing
something wrong.  If anyone could help, I'd appreciate it..

When the instruction is executed, eip is set to 0x02, instead of being
set to eip+2.  I looked at the disassembly in gdb and the op-code I
should be getting according to the Intel IA32 Instruction Set Reference
is "EB" but instead I'm instead getting "E9".

Again, any help would be appreciated.  Perhaps there's a better way to
jump to a relative position within an assembly block.


             JMP 0x02          # Should add 0x02 to eip, but instead, it
eip to 0x02.

More information about the Gcc-help mailing list