From owner-freebsd-mips@FreeBSD.ORG Thu May 27 18:59:55 2010 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F38B71065672 for ; Thu, 27 May 2010 18:59:54 +0000 (UTC) (envelope-from phcoder@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mx1.freebsd.org (Postfix) with ESMTP id 793FC8FC1D for ; Thu, 27 May 2010 18:59:54 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id d23so275049fga.13 for ; Thu, 27 May 2010 11:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=/xjKNrwny7yCG0DBQBBrXl0q1wb12lMEaqitqBp99Gs=; b=pv/VPfbH3K79VATq04pODqptPpjtd5wdsYD6M2yPGnFGUbUZSQQVcWKHM0GxVcMCEB FwNBedMK7gOPlC97D2RXLWjQFcmROl0hnHN7f3w7XUH3uLpVg6vX0nFNU9NNH1qp1kng 8xaTEUGQlrf/2dlC5/2nzjvlAoak8WF7JaAvc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=IQuVYNeG5BlfQScr8ExPyWCSdD/1A/QBqVayVmAnPtcezMKPXvd48jFI4FlDt4RGGe nlJ0+FXqsKjeuZYSEthgOamuyR84G7Gqa1+qkw/tIii8biA8TaVEosAne9feXFHwP3N2 fMV1apX9RzwcxdKUIgMTplaaCIc5pugaaj/z8= Received: by 10.204.154.84 with SMTP id n20mr2331065bkw.151.1274986792885; Thu, 27 May 2010 11:59:52 -0700 (PDT) Received: from debian.bg45.phnet (gprs11.swisscom-mobile.ch [193.247.250.11]) by mx.google.com with ESMTPS id h21sm6651095bkh.5.2010.05.27.11.59.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 27 May 2010 11:59:51 -0700 (PDT) Message-ID: <4BFEC122.9040307@gmail.com> Date: Thu, 27 May 2010 20:59:46 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: "M. Warner Losh" References: <4BFDA036.7080502@gmail.com> <20100527.100314.539398516089941831.imp@bsdimp.com> In-Reply-To: <20100527.100314.539398516089941831.imp@bsdimp.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-mips@freebsd.org Subject: Re: Fix mips64 ddb backtracing X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 May 2010 18:59:55 -0000 M. Warner Losh wrote: > : +static inline register_t > : +kdbpeekD (uintptr_t addr) { > : +#ifdef __MIPSEL__ > : + return ((register_t) kdbpeek ((int *) addr)) > : + | (((register_t) kdbpeek ((int *) addr + 1)) << 32); > : +#else > : + return ((register_t) kdbpeek ((int *) addr + 1)) > : + | (((register_t) kdbpeek ((int *) addr)) << 32); > : +#endif > > This seems wrong. What's wrong with reading the 64-bit quantity > directly? > > =20 Nothing except my ignorance. Is there already a kdbpeek for 64-bit quantities? AFAIU one needs to go through kdbpeek for all reads. > : +} > : =3D20 > : /* > : * Functions ``special'' enough to print by name > : @@ -140,7 +150,7 @@ > : } > : /* check for bad SP: could foul up next frame */ > : /*XXX MIPS64 bad: this hard-coded SP is lame */ > : - if (sp & 3 || sp < 0x80000000) { > : + if (sp & 3 || (uintptr_t) sp < 0xffffffff80000000ULL) { > > This is wrong. sp should be cast to intptr_t to have it still work > with 32-bit debugging. Unsigned sp will be 0x80000000, which will > trigger this case. > > =20 I noticed it myself. Should be fixed in new patch. > : - (*printfn)("%x", args[j]); > : + (*printfn)("%lx", (unsigned long) args[j]); > > These casts aren't right. We should likely be using intmax_t here and > %j. > > =20 Isn't long guaranteed to be at least as long as void * ? Anyway I'm ok with %jx --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko