From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IpWmh-0003UO-OJ for qemu-devel@nongnu.org; Tue, 06 Nov 2007 17:20:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IpWmg-0003Sm-LF for qemu-devel@nongnu.org; Tue, 06 Nov 2007 17:20:35 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IpWmg-0003ST-Au for qemu-devel@nongnu.org; Tue, 06 Nov 2007 17:20:34 -0500 Received: from grayson.netsweng.com ([207.235.77.11]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IpWmg-0008JT-1l for qemu-devel@nongnu.org; Tue, 06 Nov 2007 17:20:34 -0500 Date: Tue, 6 Nov 2007 17:19:40 -0500 (EST) From: Stuart Anderson Subject: Re: [Qemu-devel] RFC: x86_64 Best way to fix 'cast to pointer from integer of different size' problems? In-Reply-To: <200711062205.34944.paul@codesourcery.com> Message-ID: References: <1194110810.13889.25.camel@hephaestion> <4730C8EC.8030808@bellard.org> <200711062205.34944.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org On Tue, 6 Nov 2007, Paul Brook wrote: > If you're not careful you get double-copying. Once copying the struct from > guest to host space, and then again when converting layout/endianess. Yes, it would be easy to do that by mistake. The approach that has been taken has been to use typed copy_*_user_() routines for the structs instead of using a seperate untyped copy_*_user() followed by a convert_() routine. The copy_*_user_() routines do the copy and convert in a single step. This will never be as fast as an optimized buffer copy, but it will also not be as slow as having seperate routines. Stuart Stuart R. Anderson anderson@netsweng.com Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149