From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKRpL-0002yU-Dn for qemu-devel@nongnu.org; Wed, 29 Jul 2015 09:55:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKRpG-0006RX-Dd for qemu-devel@nongnu.org; Wed, 29 Jul 2015 09:55:23 -0400 Received: from mout.gmx.net ([212.227.17.22]:51857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKRpG-0006RN-3f for qemu-devel@nongnu.org; Wed, 29 Jul 2015 09:55:18 -0400 References: <55B734A7.8040108@gmx.net> <55B8B122.7020406@gmx.net> From: Dennis Luehring Message-ID: <55B8DB46.6070307@gmx.net> Date: Wed, 29 Jul 2015 15:55:18 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Debian 7.8.0 SPARC64 on qemu - anything i can do to speedup the emulation? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Karel Gardas Cc: qemu-devel@nongnu.org Am 29.07.2015 um 14:34 schrieb Karel Gardas: > Once it boots, tell me how to find the asnwers to your > questions. compile with gcc test.cpp and run ----------- #include #include #include #include #include int main() { uint16_t value = 0x1234; { volatile uint8_t* ptr = (uint8_t*)&value; printf("endianess: %s\n", ptr[0]==0x34 ? "little":"big"); } uint8_t buffer[1+sizeof(value)]={0}; uint8_t* ptr = buffer; if(ptrdiff_t(ptr) % 2 == 0) { ++ptr; } uint16_t* unaligned_word = (uint16_t*)ptr; ::memcpy(unaligned_word, &value, sizeof(value)); printf("try to access unaligned word\n"); uint16_t read = *unaligned_word; // here can happen Bus-Errors, Exceptions, whatever your architecture likes printf(" equal to 0x%04X: %s\n", value, read == value ? "YES":"!!NO!!"); // sometimes you get the value - but its still wrong printf(" value: 0x%04X\n", read); printf("done\n"); return 0; } -----------