From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 20565 invoked from network); 1 May 2020 00:13:38 -0000 Received-SPF: pass (minnie.tuhs.org: domain of minnie.tuhs.org designates 45.79.103.53 as permitted sender) receiver=inbox.vuxu.org; client-ip=45.79.103.53 envelope-from= Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 1 May 2020 00:13:38 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 0C69E9C9B9; Fri, 1 May 2020 10:13:34 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id C26689C851; Fri, 1 May 2020 10:13:00 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (1024-bit key; secure) header.d=mxes.net header.i=@mxes.net header.b="wk786yPf"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 91CE89C851; Fri, 1 May 2020 10:12:57 +1000 (AEST) Received: from smtp-out-3.mxes.net (smtp-out-3.mxes.net [198.205.123.68]) by minnie.tuhs.org (Postfix) with ESMTPS id EF10D9C733 for ; Fri, 1 May 2020 10:12:53 +1000 (AEST) Received: from Customer-MUA (mua.mxes.net [10.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 03853759F7; Thu, 30 Apr 2020 20:12:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mxes.net; s=mta; t=1588291972; bh=l1HzTKRHcie5B6KYitHhl2De/ct6TwuV8BEM8/fa6jE=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date: Message-Id:References:To; b=wk786yPfpYSDEShmn6lOWJTToSlU9uq/tESKF+MY23PSlzxaRWfcCw3VFfIcAVCmA SvgDBq2rBcif0uNwmjC1Jdrs+4J7jkjNiypQSNt2PDnWHGPliRdjWpNsQ4Wop7KBZK SDbWuTHO0bmR7vIaO90uJajZiP0OnycIrg6Sc+es= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) From: Ronald Natalie In-Reply-To: Date: Thu, 30 Apr 2020 20:12:50 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <820665B9-4D2E-4B52-95BD-F223A4AF9A6A@ronnatalie.com> References: <9A1BF33E-49C9-4712-BF25-4C0BBC504CD1@planet.nl> To: Alexander Voropay X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Sent-To: Subject: Re: [TUHS] as(1) on Ultrix-11 vs 2.11BSD X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" The syscall skips over a location for reasons not fully clear to me. = I guess if you dug down into the libc functions that call it you=E2=80=99d= figure out why. As far as the kernel is concerned, it just doesn=E2=80=99= t look at it. The zero is just a spacer, other code just does a tst -(sp) there which = just decrs the stack poitner. > On Apr 30, 2020, at 5:49 PM, Alexander Voropay wrote: >=20 > Can anyone please explain the last $0 pushed to the stack ? > Early SysIII ans SYSV on the i386 (and may be on i286) used > similar syscall convention. >=20 > I wrote about this: > https://minnie.tuhs.org/pipermail/tuhs/2019-October/019274.html > https://minnie.tuhs.org/pipermail/tuhs/2019-October/019294.html >=20 > Example: > =3D=3D=3D > .file "test.s" > .version "02.01" > .set WRITE,4 > .set EXIT,1 > .text > .align 4 > .globl entry > entry: > pushl %ebp > movl %esp,%ebp > subl $8,%esp >=20 > pushl $14 /length > pushl $hello > pushl $1 /STDOUT > pushl $0 > movl $WRITE,%eax > lcall $0x07,$0 > addl $16,%esp >=20 > pushl $0 > movl $EXIT,%eax > lcall 0x07,$0 >=20 > .data > .align 4 > hello: > .byte 0x48,0x65,0x6c,0x6c,0x6f,0x2c, 0x20,0x77,0x6f,0x72 > .byte 0x6c,0x64,0x21,0x0a,0x00 >=20 > =D1=81=D1=80, 29 =D0=B0=D0=BF=D1=80. 2020 =D0=B3. =D0=B2 17:19, = : >>=20 >> Thanks for the link. With that help, I fixed the bug in the = program: >>=20 >> mov $6., -(sp) >> mov $1f, -(sp) >> mov $1,-(sp) >> mov $0,-(sp) >> sys 4 >> add $8., sp >> mov $0,-(sp) >> mov $0,-(sp) >> sys 1 >> 1: >>=20 >>=20 >>>> Sorry, I typed that in haste without testing. I don=E2=80=99t have = a 2.11 system >>>> to try it on. However, reading the source code, I did that wrong. = The >>>> args go on the stack, not in line with the code. >>>> mov $6, -(sp) >>>> mov a, -(sp) >>>> mov $1,-(sp) >>>> sys 4 >>>=20 >>> Without suggesting that every helpful post should be tested, I find = the >>> superb https://unix50.org web emulator excellent for such things. >>>=20 >>> Many thanks to the folks hosting & maintaining this great resource! >>>=20 >>>=20 >>=20 >>=20