From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 2 12:15:54 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 AE3F916A4CE for ; Tue, 2 Mar 2004 12:15:54 -0800 (PST) Received: from episec.com (episec.com [69.55.237.141]) by mx1.FreeBSD.org (Postfix) with SMTP id 78B8E43D1F for ; Tue, 2 Mar 2004 12:15:54 -0800 (PST) (envelope-from edelkind-freebsd-hackers@episec.com) Received: (qmail 15845 invoked by uid 1024); 2 Mar 2004 20:15:54 -0000 Date: Tue, 2 Mar 2004 15:15:54 -0500 From: ari To: Daniela Message-ID: <20040302201554.GA50518@episec.com> Mail-Followup-To: ari , Daniela , hackers@freebsd.org References: <200403022046.22882.dgw@liwest.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200403022046.22882.dgw@liwest.at> cc: hackers@freebsd.org Subject: Re: 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 20:15:54 -0000 dgw@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. The kernel expects the interrupt to take place from within a function. Try: .text .global _start _start: pushl $8 movl $1, %eax call doint doint: int $0x80 Or, if you really want the program as simple as possible, you can push 0, eax, garbage, anything onto the stack in place of the return address: .text .global _start _start: pushl $8 pushl $0 movl $1, %eax int $0x80 ari