Anticipating a Reply | 1 Aug 2002 06:43

)

Hi Frederic ,

  Thanks again .

  Let me do some more investigation and 
study before I ask anymore questions on 
AT&T syntax and Assembly .

With Best Regards

 --- Frederic Marmond <fmarmond <at> eprocess.fr> wrote: >
hum, well...
> I don't use the AT&T syntax, so, I may be wrong, but
> I think your code 
> is not right again:
> you don't specify any segment! (only the bx
> register)
> So, how do you think the CPU will know where to put
> your 0x411f ?
> You have to specify the segment after having fill it
> with a value.
> movw 0xb800,%bx
> movw %bx,%ds
> movw $0x411f,(%bx)        <= I'm not sure (perhapse
> a AT&T guru may help us)
>                                             Here, we
> assume that DS is 
> the default segment token by the as compiler
> 
> if I take your origin-code:
(Continue reading)

Anticipating a Reply | 1 Aug 2002 14:09

)

Hello Emanuele ,

    Thank you very much for the explanation
given by you , which has cleared my doubt 
about 16-bit mode addressing totally .

    Actually , I was fooled by the Video
memory address 0xb800 which is loaded into
the segment register in the orignal code . 

    Now I understand that its lower 4 bits
are left-shifted & the offset is added to 
produce the 20 bit address . 

    Thanks again for the help .

With Best Regards

 --- Emanuele Altieri <ealtieri <at> hampshire.edu> wrote:
> Hi,
> 
> My reply comes a bit late. I hope it is still
> helpful. 
> This is the code that you wrote:
> 
>  .code16
>  .globl _start 
>  _start: 
>          movw $0xb800,%bx  # Video Memory address   
>          movb $0x41,(%bx)  # ASCII value to be
(Continue reading)

m_hrebien | 4 Aug 2002 22:28
Picon
Favicon

gas' nop(s)

Hi there,

did You noticed that GNU as adds some padding nop(s) like:

lea (%esi),%esi
mov %esi,%esi
nop

at the end of .text section? Is this really necessary? The .text section
mustn't be padded to 4 like it seems to be or am i wrong? How can i
avoid this? Is there any gas option to switch this off?

Sorry if this topic is doubled by me but i couldn't find something
similar in the archive :(

--

-- 
Maciej Hrebien

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

m_hrebien | 5 Aug 2002 11:23
Picon
Favicon

Re: gas' nop(s)

Jani Monoses wrote:
> 
> Hi
> look at the .align directive in info gas

.align, oh, of course!! :) Thank You!!

> there is no requirement for text to be packed at 4

I thought so. Thanks for Your confirmation!

> but it is the default (or maybe even 16)

16? Possibly it depends on system/compilation, don't You think so? On my
gas it seems to be 4 as i wrote.

--

-- 
Maciej Hrebien

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

h-peter recktenwald | 5 Aug 2002 12:20
Picon

Re: gas' nop(s)

On Sun, 04 Aug 2002 22:28:47 +0200
m_hrebien <at> wp.pl wrote:

> Hi there,
> 
> did You noticed that GNU as adds some padding nop(s) like:
> 
> lea (%esi),%esi
> mov %esi,%esi
> nop
> 
> at the end of .text section? Is this really necessary? The .text section
> mustn't be padded to 4 like it seems to be or am i wrong? How can i
> avoid this? Is there any gas option to switch this off?

some time back, i tried AS as an intermediate program, w. piped i/o, and 
encountered the same problem, which i didn't manage to solve, too. there 
is no option + no other idea. those gods of gnu binutils devel might know 
but, i myself never received an answer to any AS related question...

anyway, AS wsn't meant to do plain, stand alone assembly but is designed 
to produceing a set of data which can be combined to something, probably 
executeable, with the "ld" linker. so the implicite alignment might even 
be very helpful for faster processing.

i'd (highly) recommend the "fasm" assembler for the more 'direct' work:)
	http://fasm.metro-nt.pl/

> Sorry if this topic is doubled by me but i couldn't find something
> similar in the archive :(
(Continue reading)

m_hrebien | 5 Aug 2002 19:53
Picon
Favicon

Re: gas' nop(s)

h-peter recktenwald wrote:
> 
> > Hi there,
> >
> > did You noticed that GNU as adds some padding nop(s) like:
> >
> > lea (%esi),%esi
> > mov %esi,%esi
> > nop
> >
> > at the end of .text section? Is this really necessary? The .text section
> > mustn't be padded to 4 like it seems to be or am i wrong? How can i
> > avoid this? Is there any gas option to switch this off?
> 
> some time back, i tried AS as an intermediate program, w. piped i/o, and
> encountered the same problem, which i didn't manage to solve, too. there
> is no option + no other idea. those gods of gnu binutils devel might know
> but, i myself never received an answer to any AS related question...
>
> anyway, AS wsn't meant to do plain, stand alone assembly but is designed
> to produceing a set of data which can be combined to something, probably
> executeable, with the "ld" linker.

Yes, it's gcc's back-end rather then stand alone assembler.

> so the implicite alignment might even
> be very helpful for faster processing.
>
> i'd (highly) recommend the "fasm" assembler for the more 'direct' work:)
>         http://fasm.metro-nt.pl/
(Continue reading)

h-peter recktenwald | 6 Aug 2002 00:21
Picon

Re: gas' nop(s)

On Mon, 05 Aug 2002 19:53:41 +0200
m_hrebien <at> wp.pl wrote:

> Guess what? I've tried this .align directive as Jani Monoses suggested
> like this:
> 
> .text
> 
> .align 1
> 
> .globl _start
> _start:
> 	mov	$1,%eax
> 	xor	%ebx,%ebx
> 	int	$0x80
> 
> and it's not working as i wish - gas adds lea (%esi),%esi after int
> $0x80 to the output :( I've tried with 2, 4, 8 & 16 and it seems that
> .align x works good if x is greater equal than 4 :( But why??

.text section for ELF format defined to be page aligned, so it's always a 
multiple of 4, and the end-alignment added for what "bu" gnu-ers seem to 
think is #the# appropriate thing or, just more convenient to further asm 
output processing - just guessing, has anyone else a more thorough idea?

a work-around for piped output may be defining a label at code end and 
taking the actually assmbled code length from the listing file. tested:

echo ".att_syntax noprefix;.global XLAB;jnc XLAB;movl eax,ebx;\
      movl ebx,edx;XLAB:;.end"|as -achnlsd m=l --gstabs |tee t
(Continue reading)

m_hrebien | 6 Aug 2002 11:30
Picon
Favicon

Re: gas' nop(s)

h-peter recktenwald wrote:
> 
> > .text
> >
> > .align 1
> >
> > .globl _start
> > _start:
> >       mov     $1,%eax
> >       xor     %ebx,%ebx
> >       int     $0x80
> >
> 
> echo ".att_syntax noprefix;.global XLAB;jnc XLAB;movl eax,ebx;\
>       movl ebx,edx;XLAB:;.end"|as -achnlsd m=l --gstabs |tee t
> 
> the listing:
> ----------------------------------------------------
>    1 0000 0F83FCFF      .att_syntax noprefix
>    1      FFFF89C3
>    1      89DA89F6
> DEFINED SYMBOLS
>     {standard input}:1      .text:0000000a XLAB
> 
> NO UNDEFINED SYMBOLS
> --------------------------------------------------
> asm 4 bytes shorter w/o the ".global" statement, <jnc> then w. byte disp.

Yes, right! But it still adds "89F6" padding which stands for "mov
%esi,%esi" & my question was how to avoid this.
(Continue reading)

h-peter recktenwald | 7 Aug 2002 09:41
Picon

Re: gas' nop(s)

On Tue, 06 Aug 2002 11:30:56 +0200
m_hrebien <at> wp.pl wrote:

> > asm 4 bytes shorter w/o the ".global" statement, <jnc> then w. byte disp.
> 
> Yes, right! But it still adds "89F6" padding which stands for "mov
> %esi,%esi" & my question was how to avoid this.

ok. you can not.

hp
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Anticipating a Reply | 8 Aug 2002 09:31
Picon
Favicon

Prblem with AT&T

Hi All !

  I have got the below 16 bit code which is 
in Intel Syntax . 

----------- INTEL SYNTAX CODE ------------------------

entry start 

start: 
	mov ah,#0x03 ; read cursor position. 
	xor bh,bh 
	int 0x10 
	mov cx,#26 ; length of our beautiful string. 
	mov bx,#0x0007 ; page 0, attribute 7 (normal) 
	mov bp,#mymsg 
	mov ax,#0x1301 ; write string, move cursor 
	int 0x10 
	
	loop1: jmp loop1 
	
mymsg: 
	.byte 13,10 
	.ascii "Handling BIOS interrupts"

---------------------------------------------

I am trying to write to the above code in 
AT&T format as given below . 

(Continue reading)


Gmane