From owner-cvs-all Sat Oct 12 22:30:42 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C65737B401; Sat, 12 Oct 2002 22:30:41 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id E928C43E9C; Sat, 12 Oct 2002 22:30:39 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id PAA12178; Sun, 13 Oct 2002 15:30:37 +1000 Date: Sun, 13 Oct 2002 15:40:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Marcel Moolenaar Cc: cvs-committers@FreeBSD.org, Subject: Re: cvs commit: src/sys/pci agp_amd.c In-Reply-To: <200210122040.g9CKeatu097643@freefall.freebsd.org> Message-ID: <20021013151835.C21098-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 12 Oct 2002, Marcel Moolenaar wrote: > marcel 2002/10/12 13:40:36 PDT > > Modified files: > sys/pci agp_amd.c > Log: > Make this compile on 64-bit architectures (e.g. ia64) by not assuming > pointers (but more precisely vm_offset_t) can be printed with %x. Use > %p instead and cast the argument to caddr_t. This has more printf format errors than before: - vm_offset_t is not a pointer. It is a (typedefed) unsigned integral type, so it should be printed using %#lx or %#jx after casting it to u_long or uintmax_t. vm_offset_t is unlikely to be larger than u_long on any reasonable machine, so using uintmax_t is normally just a pessimization. Anyway, vm_offset_t's are usually printed using %lx elsewhere. - vm_offset_t is cast to a pointer without going through intptr_t or uintptr_t. This is only technically incorrect. vm_offset_t is likely to be the same as uintptr_t in practice. - caddr_t is not void *. The behaviour of %p is undefined unless its arg has type void *. - %p is a little broken in the kernel, so it gives output bug for bug compatible with %8x: it doesn't print an 0x prefix like it does in userland. The kernel printf even does extra work for %#p to kill the prefix. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message