Strange behaviour in assembly language program
Daniela
dgw at liwest.at
Tue Mar 2 11:52:24 PST 2004
Hi!
I'm already a bit experienced with assembly, and started to enter my
executables directly in the hexeditor (for educational purpose only; I know
this is poor programming style).
I do not yet fully understand all aspects of the ELF header, but I managed to
somehow write working ELF executables. I tried first a program that exits
with status 1, and it works. But then I tried other values, and found out
that it always exits with 1 no matter what I enter. I don't think I made a
stupid mistake, because the Linux version (exit value given in EBX and
ELF_OSABI = 03) runs perfectly in emulation mode. The first strange thing is,
that it doesn't run on a real Linux system (tells me it doesn't have enough
core memory for a 96 byte program).
Second strange thing:
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.
Please, can someone tell me that I made a really stupid error? I'm already
pulling my hair out.
Thanks for your time.
Daniela
More information about the freebsd-hackers
mailing list