Skip to contentSkip to conversation

gas jump

DISCUSSION peter w krause (by way of peter w krause <[email protected]>) 2 participants 6 messages Aug 31, 2003 – Sep 3, 2003

lore
Share & tools
lore
#0 lore raw

Fekete Gabor am Samstag, 30. August 2003 23:46:

Quoted 4 lines

hi

i want to make a relative jump.
i tried it with "jmp 0x09" and expected it to

the actual displacement is not an argument to <jmp>

Quoted 3 lines

jump to the address that comes 9 bytes after this "jmp".
is it correct?

no.

Quoted 3 lines

i'm asking because when I examined (x/bx) the code with gdb it didn't really show any bytes with value 0x09 when looking at this jump instruction.

should copile a branch to address stored at location 0x09

correct code would be:

		jmp 1f
	...

1f:

best,
hp

--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml

#1 lore raw
Quoted 19 lines · peter w krause (by way of peter w krause )

Fekete Gabor am Samstag, 30. August 2003 23:46:

Quoted 4 lines

hi

i want to make a relative jump.
i tried it with "jmp 0x09" and expected it to

the actual displacement is not an argument to <jmp>

Quoted 3 lines

jump to the address that comes 9 bytes after this "jmp".
is it correct?

no.

Quoted 3 lines

i'm asking because when I examined (x/bx) the code with gdb it didn't really show any bytes with value 0x09 when looking at this jump instruction.

Quoted 6 lines

should copile a branch to address stored at location 0x09

correct code would be:

                jmp 1f
        ...

1f:

^^^^^^

It's "one forward", so the label should be named just "1" without the "f". Don't you think? The semantics for such local symbols is N: where N is any digit.

Signature · 1 line
Maciej Hrebien
#2 lore raw

Maciej Hrebien am Montag, 1. September 2003 09:10:

Quoted 9 lines
Quoted 4 lines

correct code would be:

                jmp 1f
        ...

1f:

^^^^^^

It's "one forward", so the label should be named just "1" without the "f". Don't you think? The semantics for such local symbols is N: where N

certainly! 'typing error' :)

hp

Signature · 1 line
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml
Quoted 1 line
Quoted 1 line

hp -at- lxhp -dot- in-berlin -dot- de <<

#3 lore raw
Quoted 7 lines · peter w krause

Maciej Hrebien am Montag, 1. September 2003 09:10:

Quoted 5 lines
Quoted 4 lines

correct code would be:

                jmp 1f
        ...

1f:

Quoted 6 lines
Quoted 4 lines

^^^^^^

It's "one forward", so the label should be named just "1" without the "f". Don't you think? The semantics for such local symbols is N: where N

certainly! 'typing error' :)

I thinked so ;) But guess what.. i noticed that you may use more digits when creating this local labels, NNN: seams to be correct. Heh, my (obsolete?) info docs say only about 10 bacwards & 10 forwards.
Question: how many digits can you put there? I tried it by hand and when i was assembling this little example below, gas-2.11.90.0.19 seg fault:

jmp 429496729616743212345f
nop
429496729616743212345:
nop

So, how it really is with this "non-standard" digit-labels?

Signature · 1 line
Maciej Hrebien
#4 lore raw

Maciej Hrebien am Mittwoch, 3. September 2003 09:45:

Quoted 3 lines

I thinked so ;) But guess what.. i noticed that you may use more digits when creating this local labels, NNN: seams to be correct. Heh, my

this was since long the case. used (and required) in the linux kernel where a chain of .9999 (or so) implements a linked list. - which was where I 1st noticed the feature, while searching for at least some, minimal feature of setting up a set of run-time asm variables. which -imo- is the one, almost indispensable feature badly missing in the 'as' assembler. those numbered labels can help, in some cases, though.

newer versions docs notice those numeric labels, implicitely, by explaning that the lower 10 being handled in an optimized manner. even newer docs do not mention the limit of 10, any more.

btw, anyone ever manged to utilize those locally valid numeric labels, which are promised by AS 'documentation' as to be defined by a number and a trailing "$" (dollar) instead of the ":" colon. - I did not, no way.

Quoted 1 line

(obsolete?) info docs say only about 10 bacwards & 10 forwards.

never trust those GNU/FSF originating info docs! many (most?) of which are utterly out of date and/or so badly organized that the sparse remarks wrt. those features are easily over-looked (ps or dvi variants are, at least, somewhat 'readable').

Quoted 9 lines

Question: how many digits can you put there? I tried it by hand and when i was assembling this little example below, gas-2.11.90.0.19 seg fault:

jmp 429496729616743212345f
nop
429496729616743212345:
nop

So, how it really is with this "non-standard" digit-labels?

maximal figure not mentioned, anywhere in the docs. probably 63 bit ? i.e. +ve values of 'double' or 'long long' range? anyway, 31 bit seem sufficient - I'm using the higher figures for the linked lists of "F4"-forth, in range of 10000 +10.

best,
hp

Signature · 1 line
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml
Quoted 1 line
Quoted 1 line

clf -at- lxhp -dot- in-berlin -dot- de <<

#5 lore raw
Quoted 6 lines · peter w krause

Maciej Hrebien am Mittwoch, 3. September 2003 09:45:

Quoted 3 lines

I thinked so ;) But guess what.. i noticed that you may use more digits when creating this local labels, NNN: seams to be correct. Heh, my

Quoted 6 lines

this was since long the case. used (and required) in the linux kernel where a chain of .9999 (or so) implements a linked list. - which was where I 1st noticed the feature, while searching for at least some, minimal feature of setting up a set of run-time asm variables. which -imo- is the one, almost indispensable feature badly missing in the 'as' assembler. those numbered labels can help, in some cases, though.

Heh, there are plenty of >1 digit labels in the kernel's *.S files, i think i have never focused on this labels (their names) - just threat them as dest of a jmp or something until now when i noticed it may be useful ;) ok, never mind.

Quoted 6 lines
Quoted 1 line

(obsolete?) info docs say only about 10 bacwards & 10 forwards.

never trust those GNU/FSF originating info docs! many (most?) of which are utterly out of date and/or so badly organized that the sparse remarks wrt. those features are easily over-looked (ps or dvi variants are, at least, somewhat 'readable').

The worst thing is that this obsolete docs come with quite fresh soft. Yes, this is not the first time the info pages seem to be not the best idea.

Quoted 4 lines

maximal figure not mentioned, anywhere in the docs. probably 63 bit ? i.e. +ve values of 'double' or 'long long' range? anyway, 31 bit seem sufficient - I'm using the higher figures for the linked lists of "F4"-forth, in range of 10000 +10.

But from the other hand: who uses 429496729616743212345: as the name of a label? ;)

Thank you for your post!

Signature · 1 line
Maciej Hrebien