Strange behaviour in assembly language program
Daniela
dgw at liwest.at
Tue Mar 2 13:16:31 PST 2004
On Tuesday 02 March 2004 20:15, ari wrote:
> dgw at liwest.at said this stuff:
> > Finally I came up with the simplest ASM program that reproduces the
> > error. Here it is:
> >
> > .text
> > .global _start
> > _start:
> > pushl $0
> > movl $1, %eax
> > int $0x80
> >
> > I looked everywhere (Developer's handbook, Google, ...) to find the
> > solution, but all resources I consulted tell me this is the right way to
> > do it. This program, however, always exits with 1 regardless of the value
> > I push.
>
> .text
> .global _start
> _start:
> pushl $8
> pushl $0
> movl $1, %eax
> int $0x80
With this suggestion, it always returns 0 instead of 1.
Shouldn't pushl place 4 bytes on the stack? It translates into the instruction
0x6A (pushes only one byte).
BTW, when I assemble it with as(1), there is always an extra instruction after
my code, and it's a different one each time (and it's always one that
effectively does nothing). Who ordered that? Is it because of alignment
constraints in the ELF file?
More information about the freebsd-hackers
mailing list