From owner-freebsd-platforms Wed Jul 10 10:29:38 2002 Delivered-To: freebsd-platforms@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E9FD437B401 for ; Wed, 10 Jul 2002 10:29:33 -0700 (PDT) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BE2343E31 for ; Wed, 10 Jul 2002 10:29:33 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 703 invoked from network); 10 Jul 2002 17:29:31 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail16.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 10 Jul 2002 17:29:31 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g6AHTU027679; Wed, 10 Jul 2002 13:29:30 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200207102033.25184.tzukanov@narod.ru> Date: Wed, 10 Jul 2002 13:29:34 -0400 (EDT) From: John Baldwin To: Serguei Tzukanov Subject: Re: A question about S/390 port Cc: freebsd-platforms@freebsd.org, freebsd-hackers@freebsd.org Sender: owner-freebsd-platforms@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On 10-Jul-2002 Serguei Tzukanov wrote: > >> td_retval[0] is the low word, and td_retval[1] is the high word, you >> just need to make sure the values from those two words get returned >> properly to userland. > > 1) syscall returns 32-bit value: > r2 = rv[0]; > r3 = rv[1]; > r3 is irrelevant here (ABI: "32-bit values returned in r2") > > 2) syscall returns 64-bit value: > MI code uses something like > *(int64_t *)rv = xxx, so I have to do > r2 = rv[0]; > r3 = rv[1]; > ABI says "long long shall be returned with the lower > addressed half in r2 and the higher in r3" > > 3) syscall folded into __syscall returns 32-bit value (e.g. mmap): > MI code does usual > r[0] = xxx; > svc (syscall) handler does > r2 = rv[0]; > r3 = rv[1]; /* zeroed before */ > then mmap wrapper in userspace casts this 64-bit to 32-bit > (loads r2 with r3 really) and always gets 0. Why does the cast from 32 to 64 treat r3 as the lower 32-bits when a 64-bit return value treats r3 as the upper 32-bits and r2 as the lower 32-bits? That is inconsistent and you are going to have problems with either one or the other. I also don't understand exactly what you mean by "syscall folded into __syscall". -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-platforms" in the body of the message