Strange behaviour in assembly language program
dgw at liwest.at
Tue Mar 2 12:16:50 PST 2004
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:
movl $1, %eax
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.
More information about the freebsd-questions