john david gray | 3 Sep 2006 18:39
Picon

argc argv example included


 <linux-assembly <at> vger.kernel.org>

to <majordomo <at> vger.kernel.org>

subscribe linux-assembly

Hi,

I am doing a bit of assembly - for conversion of a Pascal compiler
I'm doing {PQC 68000} . I did some work on it in it's original
Pascal, and have since converted it into C , though it still
currently produces 68k assembler. I have it running in linux {gcc}.
I started doing some x86 assembler using nasm , and then swapped
to as {gas} for its att mode.
There seems to be a problem with argc {or is it just me?}
where an offset has to be manually adjusted to give the correct
number {length of args}.
I'm using Slackware9.1 with gcc 3.2.3

'bye John Gray

p.s.
Here's a program that exhibits this behaviour:
save ascii
cut, save as kat09.s and assemble :

as -o kat09.o  kat09.s
ld -o kat09    kat09.o
echo  "kat09 OK"
(Continue reading)

Frank Kotler | 4 Sep 2006 03:30
Picon

Re: argc argv example included

john david gray wrote:
> Hi,
> 
> I am doing a bit of assembly - for conversion of a Pascal compiler
> I'm doing {PQC 68000} . I did some work on it in it's original
> Pascal, and have since converted it into C , though it still
> currently produces 68k assembler. I have it running in linux {gcc}.
> I started doing some x86 assembler using nasm , and then swapped
> to as {gas} for its att mode.

No accounting for taste! :)

> There seems to be a problem with argc {or is it just me?}
> where an offset has to be manually adjusted to give the correct
> number {length of args}.

I'm not sure what you're trying to do here. It looks like you're 
expecting there to be a return address on the stack when we start up. 
There is not. "_start" is jumped to, not called...

> I'm using Slackware9.1 with gcc 3.2.3

(strictly speaking, it's your binutils version that's relevant here - we 
don't actually use gcc)

[big snip]
> _start:                 # get argc args
>       push  %ebp

Okay, but our "caller" isn't using it.
(Continue reading)

Henio Paszczak | 11 Sep 2006 21:37
Picon
Favicon

Bin and other short question

Hi.
I wont to create bin file with using gas haw can i do
it. 
( fir example in nasm its enough to compile with -f
bin
nasm -f bin -o * *.asm )

Scund question is about closing and opening sections.
If forexample i want to change some thing in section i
have to create it with "w" index ... is it posible to
change this state inside section ? for example wfter
writing what i want to change i wont to close it ...
just for case ( interupt 125 do something like this ,
when i used it in .text section it didn'y made any
changes i mean if i try to write sometning iside i
recived segmentation error)

Lukas

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-
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

mikeos | 11 Sep 2006 22:06
Picon

Re: Bin and other short question

On Mon, Sep 11, 2006 at 12:37:26PM -0700, Henio Paszczak wrote:
> Hi.
> I wont to create bin file with using gas haw can i do
> it. 
> ( fir example in nasm its enough to compile with -f
> bin
> nasm -f bin -o * *.asm )
> 
> Scund question is about closing and opening sections.
> If forexample i want to change some thing in section i
> have to create it with "w" index ... is it posible to
> change this state inside section ? for example wfter
> writing what i want to change i wont to close it ...
> just for case ( interupt 125 do something like this ,
> when i used it in .text section it didn'y made any
> changes i mean if i try to write sometning iside i
> recived segmentation error)
> 
> Lukas

You can create bin file such way:

as -o test.o test.s
ld --oformat binary --omagic -Ttext 0x0 -o test test.o

Where option -Ttext sets start of text section,
for other linker's options - man ld

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
(Continue reading)

Henio Paszczak | 14 Sep 2006 21:58
Picon
Favicon

hint?

Hi.
I've read hint in some magazine that if you are not
using the same registers in following lines new
procesor ( my is quite old PIII(coppermine)600Mhz )
can make commands syumyltaniously ie:

mov %eax,%ebx
mov %ecx,%edx

can be does allmost in the same time. i've check it by
using extremly simple example:

movl $3,%ebx
movl $3,%edx
movl $0b111111111111111111111111111,%ecx

loop:
sall $2,%eax
orl  %ebx,%eax
sall $2,%edi
orl  %edx,%edi
   loop loop

it works ( agains theorem from magazine ) faster then

movl $3,%ebx
movl $3,%edx
movl $0b111111111111111111111111111,%ecx

loop:
(Continue reading)

Marcin Kościelnicki | 15 Sep 2006 00:05
Picon
Favicon

Re: hint?

> Hi.
> I've read hint in some magazine that if you are not
> using the same registers in following lines new
> procesor ( my is quite old PIII(coppermine)600Mhz )
> can make commands syumyltaniously ie:
>
> mov %eax,%ebx
> mov %ecx,%edx
>
> can be does allmost in the same time. i've check it by
> using extremly simple example:
>
> movl $3,%ebx
> movl $3,%edx
> movl $0b111111111111111111111111111,%ecx
>
> loop:
> sall $2,%eax
> orl  %ebx,%eax
> sall $2,%edi
> orl  %edx,%edi
>    loop loop
>
> it works ( agains theorem from magazine ) faster then
>
> movl $3,%ebx
> movl $3,%edx
> movl $0b111111111111111111111111111,%ecx
>
> loop:
(Continue reading)

Robert Plantz | 15 Sep 2006 01:19

Re: hint?

Boy, do I feel stupid. I've been writing assembly language
using the gnu assembler for seven years and have even
written a textbook about it. Although it is not the subject
of this question, the example given:

Henio Paszczak wrote:
>   -----------
> movl $3,%ebx
> movl $3,%edx
> movl $0b111111111111111111111111111,%ecx
>
>   ----------
is the first time I learned that you can specify literals
in binary. I always thought that you had to use the
C syntax and express bit patterns in hexadecimal or
octal.

On the plus side, I'm still eager to learn things.  :-)

-
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

Henio Paszczak | 21 Sep 2006 19:59
Picon
Favicon

Re:hinit?

Thank You for answer ( sorry but i couldn't write
earlier ). It explain me many things but i steel
receive the same results:

1)Program which  uses the same registers one by one
works 
4% faster then when it uses different.

> Second I've always trying not to use memory because
> its extremely slow .
>
> nut again if i exchange value between registers with
> using temporary memory:
>
> movl %eax,temp
> movl %ebx,%eax,
> movl temp,%ebx
>
> it works faster than:
>
> movl %eax,%edx
> movl %ebx,%eax,
> movl %edx,%ebx
>
> WHY? maybe linux is doing something in the mean time
> ... ?

>Where did you get that result? On my machine, the
>version using memory 
>is 1.5x 
(Continue reading)

Ed Reed | 25 Sep 2006 18:26

Question about entry.S RESTORE_REGS macro

I'm looking at the entry / exit routines to the kernel in 
arch/i386/kernel/entry.S, and at the entry conditions for 
ret_from_fork() that is also defined there....

And looking at the assembler macro defined at the top of the file, 
RESTORE_REGS, I'm trying to figure out what the ELF section stuff is 
doing there - have you a clue, or a pointer you give me as to whom to 
ask?  I don't THINK it's relevant to my current efforts, but I'd like to 
understand what's going on.

code:

#define SAVE_ALL \
       cld; \
       pushl %es; \
       pushl %ds; \
       pushl %eax; \
       pushl %ebp; \
       pushl %edi; \
       pushl %esi; \
       pushl %edx; \
       pushl %ecx; \
       pushl %ebx; \
       movl $(__USER_DS), %edx; \
       movl %edx, %ds; \
       movl %edx, %es;

#define RESTORE_INT_REGS \
       popl %ebx;      \
       popl %ecx;      \
(Continue reading)

Henio Paszczak | 25 Sep 2006 21:23
Picon
Favicon

Re: Re:hinit?

Thank You for answer.
Usually when I'm taking time duration of program i
take average of about 20 running one by one ( i don;t
count first one ).
Any way it was said here that for example XCHG
function is not under developing now. Where could I
find list of such function ( i don't wont to check
each one of them ;) ).
Any way I've "lost" some time to check other very
often used functions and i noticed that for example
some times 'loop loop1' is slower then:
loop1: 
.
.
.
decl %ecx
jnz loop1

but of course system is so complex that i should check
every part of it to receive ( or not ) answer why.
Now I'm going to buy Pentium D 805 and for sure i
would like to learn how to use multi core system in
'as' and I'm really pleased that I've found this
forum.

Lukas

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
(Continue reading)


Gmane