From patchwork Mon Apr 16 18:44:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henry Wertz X-Patchwork-Id: 898857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Qgn+Twld"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Py5M4yj5z9ryr for ; Tue, 17 Apr 2018 04:46:15 +1000 (AEST) Received: from localhost ([::1]:36228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f898n-0003b5-Pg for incoming@patchwork.ozlabs.org; Mon, 16 Apr 2018 14:46:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f897b-0002zk-7a for qemu-devel@nongnu.org; Mon, 16 Apr 2018 14:45:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f897a-0004p8-4g for qemu-devel@nongnu.org; Mon, 16 Apr 2018 14:44:59 -0400 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:35461) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f897X-0004m2-75; Mon, 16 Apr 2018 14:44:55 -0400 Received: by mail-wr0-x233.google.com with SMTP id w3so12183289wrg.2; Mon, 16 Apr 2018 11:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=E+6ALRmIY4jVmWdxF+qB9kFqTpzlI+PlIr9vY93iplg=; b=Qgn+TwldM3vtU6kV/ArYSJ6jCglWvg67NQv6eRCZfsqRYs0VdA9Ajeqn6ijIxtG7y2 s5Yi/snVm0vWR/f+7c9Sh8r0njEBdDs9ZqJAA5vBgMIe2suoVAyeIUTTsGSMpr6VWzns SQ3J8u2QSHNufAO86d17TgZGyYs5z9/B5QQQKm66TpDKFj+JGx65bTwCdSb8euwafUrp fq3FV/bRPUZQeDI541di3XKZBqohUSEGOgpDCf5IGP8ElFg2W1gqHOLDXeNmgzzDP9gd TVGCOUnXN1qw7oGr7flTVaaV8L7Pz9ky0cUcUmeMqbOmwlPUdnuGEorNr83c9H4nWshH NxPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=E+6ALRmIY4jVmWdxF+qB9kFqTpzlI+PlIr9vY93iplg=; b=LNERlPR1liCacjpzKASaFedMitaFAykAyclFkQ8u4/J5eaPWKZxRD9lh4Gyzuw4a6r LZbx8J36aFDfOSFwUsW0simkvG4BWNnU5ClaAIb4rekESrJQECIapfxXRouXcBPb9t1v 06EBB1kyrKc3cwAzZxvpBhkdyRJh/RBxikTa5TjNVFaoJMBR86OUL5iGVgnKRx4vcuzA CCUbDaOIWVbGKRPTbmzsMTG6N4/Z7qLboGN8+J5Z6qnXazAGy/4fzEv8GWxL9hTjYSsS Z+G7yuRp5fWf8W2uBmP0ZHC7vWbvLwcZVV8fphg9tmbyj10UNVYmFj8hQgPPc3iaD4B2 uSqw== X-Gm-Message-State: ALQs6tAzSZrOLMnqYugEHu6aR3JFs5I76lybtr1MHRYCb9fwlOnp79fA YJH5XUfKl9ME7XMb07wHDKWBdA4iYRRVXqnX1XlbCdmY X-Google-Smtp-Source: AIpwx48XDiicc7cbII/EHo04BGBQ1yrqGbhQ0PilyBPb+mUxDH5KtGlKe9BVAZbrxRCJsx08SOuE4qVerW+CqaLB93o= X-Received: by 10.28.93.1 with SMTP id r1mr6713199wmb.2.1523904293005; Mon, 16 Apr 2018 11:44:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.129.104 with HTTP; Mon, 16 Apr 2018 11:44:52 -0700 (PDT) From: Henry Wertz Date: Mon, 16 Apr 2018 13:44:52 -0500 Message-ID: To: qemu-arm@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::233 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] Patch for ARM memory barriers and getdent X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Developers Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Please find submitted a patch for ARM memory barriers. This patch is against qemu-2.12-rc2 but I do believe it should apply for anything from 2.11.x to current. I found with qemu 2.11.x or newer that I would get an illegal instruction error running some Intel binaries on my ARM chromebook. On investigation, I found it was quitting on memory barriers. qemu instruction: mb $0x31 was translating as: 0x604050cc: 5bf07ff5 blpl #0x600250a8 After patch it gives: 0x604050cc: f57ff05b dmb ish In short, I found INSN_DMB_ISH (memory barrier for ARMv7) appeared to be correct based on online docs, but due to some endian-related shenanigans it had to be byte-swapped to suit qemu; it appears INSN_DMB_MCR (memory barrier for ARMv6) also should be byte swapped (and this patch does so). I have not checked for correctness of aarch64's barrier instruction. ------------------------------- Please find submitted a patch for getdents (this system call stands for "get directory entries", it is passed a file descriptor pointing to a directory and returns a struct with info on the entries in that directory.) This patch is against qemu-2.10 series but continues to apply cleanly on current as of April 15 2018. If you are running a 32-bit binary on 64-bit target current qemu will convert he getdents struct, but it will NOT in the case of 64-bit binary on 32-bit host. (In my case, I had android SDK's "aapt" for x86-64 error out on 32-bit ARM without this patch, and run fine with it.) This patch simply replaces a "#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64" with "#if TARGET_ABI_BITS != HOST_LONG_BITS". Thanks! *** linux-user/syscall.c~ 2017-03-04 10:31:14.000000000 -0600 --- linux-user/syscall.c 2017-03-07 17:08:24.615399116 -0600 *************** *** 9913,9921 **** #endif #ifdef TARGET_NR_getdents case TARGET_NR_getdents: #ifdef __NR_getdents ! #if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 { struct target_dirent *target_dirp; struct linux_dirent *dirp; abi_long count = arg3; --- 9913,9921 ---- #endif #ifdef TARGET_NR_getdents case TARGET_NR_getdents: #ifdef __NR_getdents ! #if TARGET_ABI_BITS != HOST_LONG_BITS { struct target_dirent *target_dirp; struct linux_dirent *dirp; abi_long count = arg3;