From owner-freebsd-questions@FreeBSD.ORG Thu Nov 12 01:45:19 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2E14106566C for ; Thu, 12 Nov 2009 01:45:19 +0000 (UTC) (envelope-from corky1951@comcast.net) Received: from QMTA02.westchester.pa.mail.comcast.net (qmta02.westchester.pa.mail.comcast.net [76.96.62.24]) by mx1.freebsd.org (Postfix) with ESMTP id 460C08FC1F for ; Thu, 12 Nov 2009 01:45:18 +0000 (UTC) Received: from OMTA13.westchester.pa.mail.comcast.net ([76.96.62.52]) by QMTA02.westchester.pa.mail.comcast.net with comcast id 3tfg1d00917dt5G521lJsd; Thu, 12 Nov 2009 01:45:18 +0000 Received: from comcast.net ([98.203.142.76]) by OMTA13.westchester.pa.mail.comcast.net with comcast id 41lH1d0011f6R9u3Z1lH8Q; Thu, 12 Nov 2009 01:45:18 +0000 Received: by comcast.net (sSMTP sendmail emulation); Wed, 11 Nov 2009 17:45:15 -0800 Date: Wed, 11 Nov 2009 17:45:15 -0800 From: Charlie Kester To: freebsd-questions@freebsd.org Message-ID: <20091112014515.GB21567@comcast.net> Mail-Followup-To: freebsd-questions@freebsd.org References: <4AFB13D9.9050507@gmail.com> <20091112013240.GA21567@comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20091112013240.GA21567@comcast.net> X-Mailer: Mutt 1.5.20 X-Composer: VIM 7.2 User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: Problems with FreeBSD assembly X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2009 01:45:19 -0000 On Wed 11 Nov 2009 at 17:32:41 PST Charlie Kester wrote: One more thing: >Notice that the system call number (or any other dword) should also be >pushed onto the stack before the int 80h. The reason for this is given at the top of the page: although the kernel is accessed using int 80h, it is assumed the program will call a function that issues int 80h, rather than issuing int 80h directly. So the extra dword pushed onto the stack takes the place of the return address from the function the kernel expects to have been called. And since you're not actually using as a return address, it doesn't matter what value it actually has. The kernel doesn't use it for anything; it just expects it to be there in a properly arranged stack frame.