From owner-freebsd-questions@FreeBSD.ORG Wed Mar 3 06:06:56 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3C68A16A4CE for ; Wed, 3 Mar 2004 06:06:56 -0800 (PST) Received: from mx.tele-kom.ru (mx.tele-kom.ru [213.80.148.6]) by mx1.FreeBSD.org (Postfix) with SMTP id A864043D39 for ; Wed, 3 Mar 2004 06:06:54 -0800 (PST) (envelope-from doublef@tele-kom.ru) Received: (qmail 82819 invoked by uid 555); 3 Mar 2004 17:06:52 +0300 Received: from hal.localdomain (213.80.149.134) by t-k.ru with TeleMail/2 id 1078322811-82798 for dgw@liwest.at; Wed, Mar 3 17:06:51 2004 +0300 (MSK) Date: Wed, 3 Mar 2004 17:02:43 +0300 From: Sergey 'DoubleF' Zaharchenko To: Daniela Message-Id: <20040303170243.545985fc@Hal.localdomain> In-Reply-To: <200403030623.28794.dgw@liwest.at> References: <200403022110.50014.dgw@liwest.at> <20040302211919.GA10074@ergo.nruns.com> <200403030623.28794.dgw@liwest.at> X-Mailer: Sylpheed version 0.9.9claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Wed__3_Mar_2004_17_02_43_+0300_YG9.NVZAAi0l.fsm" cc: jan.muenther@nruns.com cc: questions@freebsd.org Subject: Re: Strange behaviour in assembly language program X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2004 14:06:56 -0000 --Signature=_Wed__3_Mar_2004_17_02_43_+0300_YG9.NVZAAi0l.fsm Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit On Wed, 3 Mar 2004 06:23:28 +0000 Daniela probably wrote: > In this situation, I can only use a single-byte instruction to push 4 bytes, > everything else costs me too much space. The only one I know of, is PUSHA, > but it pushes too many bytes. Quoting from dev-handbook: > But assembly language programmers like to shave off cycles. The above > example requires a call/ret combination. We can eliminate it by > pushing an extra dword: > > open: > push dword mode > push dword flags > push dword path > mov eax, 5 > push eax ; Or any other dword > int 80h > add esp, byte 16 > > The 5 that we have placed in EAX identifies the kernel function, in > this case open. The last time I wrote `push ebp \n mov ebp, esp' the push took 1 byte :). `push ' will work, as the kernel doesn't really care for the value of the dword. -- DoubleF "I'd love to go out with you, but I have to floss my cat." --Signature=_Wed__3_Mar_2004_17_02_43_+0300_YG9.NVZAAi0l.fsm Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD4DBQFAReWcwo7hT/9lVdwRAuc2AJ9aZjNnv2EtaFV6PfUOzJ8LZjOqUwCXWafv +TARx7QEC8s9SJxvSl1VoA== =YHUk -----END PGP SIGNATURE----- --Signature=_Wed__3_Mar_2004_17_02_43_+0300_YG9.NVZAAi0l.fsm--