From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 12 07:29:37 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6775106566C for ; Mon, 12 Jul 2010 07:29:37 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7C7378FC0C for ; Mon, 12 Jul 2010 07:29:37 +0000 (UTC) Received: by wyb34 with SMTP id 34so3664381wyb.13 for ; Mon, 12 Jul 2010 00:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gT+smn3/k0h+td/tRLXkGwMA8iG424jQxmY+5wny/98=; b=lAq1B7s/L3NhrmAB9mthGmcDe9oqlwXEy7rrtjpTUcVbrOtZd9GBzdy6SW5I2Shu5z j8i4+cQMDRqBtf2XeSM/qD1wwcvHC4VPP3r0GHVb02aKWapzqeZewFGfYvVEs3emhwnf YBaY44q0F3KyWJklOF88nRHSJ1yUmMgnqUWz4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Hg1B1wGuL2f9FSdMXye40OgOj0KIjtEgJ1uclTSsXpcO01bX7Faps/YObB6HEq76/K 2HXl/VkgRnwlW0+O1rXHOH5cq7xmKJKtCpSmhIU/S5DFNbdXatFGOT4XqkMO9enry8h9 bxpzi/+idPeJ+2Jm2+OUNbmFbMynC7EKxDKFw= MIME-Version: 1.0 Received: by 10.227.5.195 with SMTP id 3mr915140wbw.178.1278918008218; Mon, 12 Jul 2010 00:00:08 -0700 (PDT) Received: by 10.216.27.13 with HTTP; Mon, 12 Jul 2010 00:00:08 -0700 (PDT) In-Reply-To: <4C39DBFF.2000307@FreeBSD.org> References: <4C39D92F.4050605@FreeBSD.org> <4C39DB09.6010808@andric.com> <4C39DBFF.2000307@FreeBSD.org> Date: Mon, 12 Jul 2010 11:00:08 +0400 Message-ID: From: pluknet To: Gabor Kovesdan Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Dimitry Andric , FreeBSD Hackers Subject: Re: strange problem with int64_t variables X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2010 07:29:38 -0000 On 11 July 2010 18:58, Gabor Kovesdan wrote: > Em 2010.07.11. 16:54, Dimitry Andric escreveu: >> >> On 2010-07-11 16:46, Gabor Kovesdan wrote: >> >>> >>> I have two int64_t variables in kernel code, first is stored internally >>> and the second one is passed from a syscall argument. When I print them >>> with printf %lld modifier, the internal one behaves correctly but the >>> other one I pass from a syscall has a corrupted value. If I pass 1, it >>> prints out 3735348794091372545. I'm not doing anything special with it >>> just reading it out from the struct that was generated with make sysent= . >>> >> >> Since 3735348794091372545 is 0x33d69ff000000001, it looks like the upper >> word got corrupted somehow. =A0Maybe some part of it got non-atomically >> assigned? =A0Maybe the wrong word was read? =A0It is hard to tell withou= t >> code... =A0:) >> > > Userland syscall calling: > > killjob(getjid(), SIGINT); =A0//getjid() returns 1 this case, whose type = is > jid_t > Looking at getjid() impl, I see you're trying to put jid_t into the one register_t which are 64-bit vs 32-bit capable respectively. You need to cast so you put 64-bit into two 32-bit as done for e.g. lseek()= . --=20 wbr, pluknet