linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gas jump
@ 2003-08-30 22:46 Fekete Gabor
  2003-08-31  9:38 ` Maciej Hrebien
  0 siblings, 1 reply; 10+ messages in thread
From: Fekete Gabor @ 2003-08-30 22:46 UTC (permalink / raw)
  To: linux-assembly

hi

i want to make a relative jump.
i tried it with "jmp 0x09" and expected it to
jump to the address that comes 9 bytes after
this "jmp".
is it correct?
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.

thanks



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-08-30 22:46 gas jump Fekete Gabor
@ 2003-08-31  9:38 ` Maciej Hrebien
  2003-08-31  9:55   ` Maciej Hrebien
  2003-09-01  3:42   ` Rick Hohensee
  0 siblings, 2 replies; 10+ messages in thread
From: Maciej Hrebien @ 2003-08-31  9:38 UTC (permalink / raw)
  To: linux-assembly

Fekete Gabor wrote:
> 
> hi
> 
> i want to make a relative jump.
> i tried it with "jmp 0x09" and expected it to
> jump to the address that comes 9 bytes after
> this "jmp".
> is it correct?

Nope. Try jmp .+9 as Robert Plantz suggested in his post dated
02.02.2003 ("." means current address that gas is assembling into so ie.
l: .long . gives you l with its own address stored into) or hard code it
as .byte 0xeb, 0x09 (0xeb is jmp rel8). Isn't it better to just label if
your code isn't the fixed one? ;)

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-08-31  9:38 ` Maciej Hrebien
@ 2003-08-31  9:55   ` Maciej Hrebien
  2003-09-01  3:42   ` Rick Hohensee
  1 sibling, 0 replies; 10+ messages in thread
From: Maciej Hrebien @ 2003-08-31  9:55 UTC (permalink / raw)
  To: linux-assembly

Maciej Hrebien wrote:
> 
> Fekete Gabor wrote:
> >
> > hi
> >
> > i want to make a relative jump.
> > i tried it with "jmp 0x09" and expected it to
> > jump to the address that comes 9 bytes after
> > this "jmp".
> > is it correct?
> 
> Nope. Try jmp .+9 as Robert Plantz suggested in his post dated
> 02.02.2003 ("." means current address that gas is assembling into so ie.
> l: .long . gives you l with its own address stored into) or hard code it
> as .byte 0xeb, 0x09 (0xeb is jmp rel8). Isn't it better to just label if
> your code isn't the fixed one? ;)

I missed something, 9 bytes AFTER, so +2 because jmp rel8 encodes with 2
bytes. Sorry!

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
@ 2003-08-31 11:06 peter w krause
  2003-09-01  8:10 ` Maciej Hrebien
  0 siblings, 1 reply; 10+ messages in thread
From: peter w krause @ 2003-08-31 11:06 UTC (permalink / raw)
  To: linux-assembly; +Cc: Linux-assembly

Fekete Gabor am Samstag, 30. August 2003 23:46:
> 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>

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

no.

> 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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-08-31  9:38 ` Maciej Hrebien
  2003-08-31  9:55   ` Maciej Hrebien
@ 2003-09-01  3:42   ` Rick Hohensee
  1 sibling, 0 replies; 10+ messages in thread
From: Rick Hohensee @ 2003-09-01  3:42 UTC (permalink / raw)
  To: m_hrebien; +Cc: linux-assembly

BOO!

Please do tell davem to ban this email addy from linux-kernel. And this
list if he's so inclined. I just paid a fat old bill to get my old ISP
back because they are a Slackware shop, and not likely to be
Transmicrosofties like Torvalds and The Worms From Red Hat such as davem.

Meanwhile, the language that obsoletes C has produced some new stuff in 

ftp://ftp.gwdg.de/linux/clienux/interim/forSomos.tgz

and Forreal.tgz.

Rick Hohensee

:; cLIeNUX /dev/tty8  21:29:26   /
:;d -d */
Ha3sm/       configure/   floppy/      mount/       suite/
blas/        dev/         guest/       owner/       temp/
boot/        device/      help/        source/      vche-1.6.3/
command/     enth04/      log/         subroutine/
:; cLIeNUX /dev/tty8  22:54:29   /
:;



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-08-31 11:06 peter w krause
@ 2003-09-01  8:10 ` Maciej Hrebien
  2003-09-01  9:24   ` peter w krause
  0 siblings, 1 reply; 10+ messages in thread
From: Maciej Hrebien @ 2003-09-01  8:10 UTC (permalink / raw)
  To: linux-assembly

"peter w krause (by way of peter w krause )" wrote:
> 
> Fekete Gabor am Samstag, 30. August 2003 23:46:
> > 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>
> 
> > jump to the address that comes 9 bytes after
> > this "jmp".
> > is it correct?
> 
> no.
> 
> > 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:
^^^^^^

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.

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-09-01  8:10 ` Maciej Hrebien
@ 2003-09-01  9:24   ` peter w krause
  2003-09-03  8:45     ` Maciej Hrebien
  0 siblings, 1 reply; 10+ messages in thread
From: peter w krause @ 2003-09-01  9:24 UTC (permalink / raw)
  To: linux-assembly

Maciej Hrebien am Montag, 1. September 2003 09:10:
> > 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

-- 
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml
  >> hp -at- lxhp -dot- in-berlin -dot- de <<


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-09-01  9:24   ` peter w krause
@ 2003-09-03  8:45     ` Maciej Hrebien
  2003-09-03 11:54       ` peter w krause
  0 siblings, 1 reply; 10+ messages in thread
From: Maciej Hrebien @ 2003-09-03  8:45 UTC (permalink / raw)
  To: linux-assembly

peter w krause wrote:
> 
> Maciej Hrebien am Montag, 1. September 2003 09:10:
> > > 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' :)

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?

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-09-03  8:45     ` Maciej Hrebien
@ 2003-09-03 11:54       ` peter w krause
  2003-09-03 22:22         ` Maciej Hrebien
  0 siblings, 1 reply; 10+ messages in thread
From: peter w krause @ 2003-09-03 11:54 UTC (permalink / raw)
  To: m_hrebien, linux-assembly

Maciej Hrebien am Mittwoch, 3. September 2003 09:45:
>
> 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.

> (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').

> 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
-- 
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml
  >> clf -at- lxhp -dot- in-berlin -dot- de <<


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: gas jump
  2003-09-03 11:54       ` peter w krause
@ 2003-09-03 22:22         ` Maciej Hrebien
  0 siblings, 0 replies; 10+ messages in thread
From: Maciej Hrebien @ 2003-09-03 22:22 UTC (permalink / raw)
  To: linux-assembly

peter w krause wrote:
> 
> Maciej Hrebien am Mittwoch, 3. September 2003 09:45:
> >
> > 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.

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.
 
> > (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.
 
> 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!

-- 
Maciej Hrebien


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-09-03 22:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-30 22:46 gas jump Fekete Gabor
2003-08-31  9:38 ` Maciej Hrebien
2003-08-31  9:55   ` Maciej Hrebien
2003-09-01  3:42   ` Rick Hohensee
  -- strict thread matches above, loose matches on Subject: below --
2003-08-31 11:06 peter w krause
2003-09-01  8:10 ` Maciej Hrebien
2003-09-01  9:24   ` peter w krause
2003-09-03  8:45     ` Maciej Hrebien
2003-09-03 11:54       ` peter w krause
2003-09-03 22:22         ` Maciej Hrebien

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).