Date: Tue, 2 Mar 2004 20:46:22 +0000 From: Daniela <dgw@liwest.at> To: hackers@freebsd.org Subject: Strange behaviour in assembly language program Message-ID: <200403022046.22882.dgw@liwest.at>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403022046.22882.dgw>