From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 2 11:52:23 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D9C3E16A4CE for ; Tue, 2 Mar 2004 11:52:23 -0800 (PST) Received: from lilzmailso01.liwest.at (lilzmailso01.liwest.at [212.33.55.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6D6CF43D2D for ; Tue, 2 Mar 2004 11:52:23 -0800 (PST) (envelope-from dgw@liwest.at) Received: from cm58-27.liwest.at ([212.33.58.27]) by lilzmailso01.liwest.at with esmtp (Exim 4.24) id 1AyFwD-0001jg-LF for hackers@freebsd.org; Tue, 02 Mar 2004 20:52:21 +0100 From: Daniela To: hackers@freebsd.org Date: Tue, 2 Mar 2004 20:46:22 +0000 User-Agent: KMail/1.5.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200403022046.22882.dgw@liwest.at> Subject: Strange behaviour in assembly language program X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2004 19:52:24 -0000 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