From patchwork Mon Jul 23 18:07:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10179 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F299B23F08 for ; Mon, 23 Jul 2012 18:07:26 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id BEE1DA19938 for ; Mon, 23 Jul 2012 18:07:26 +0000 (UTC) Received: by ghbz12 with SMTP id z12so6100499ghb.11 for ; Mon, 23 Jul 2012 11:07:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=dPPq6m2Wjssa3wua6JuZROrw7XXbgwIWDpomSGI4WKI=; b=g3FL4o5mQ5PgBkMgqO2JvDojfaICUU2iP1Hk/dbL+pAcAYx5ltKBtQ9sovVWnfDwa5 DU/OaOqzjboWQuvmY/t0t0MhoCNtB4dLKYQD+P4UtjR/IvsXpRvp4V5i6hDI5g/nj80D VZyCLVfENuDH8Af11dA8cwKmEYwPzx3NG67Bm2InCUMzYKfGv/pSZPTJgkFKRpm4/GpL 8a1ACxw3teCT2Vd/qfOLF9mVniWA+2WQeScDtGkQscJvuYfOaOedxji17tVRqD1bZG80 dFZa7FYuW+j1hQxsMRpKGDP9o1rChTs+70gw1Hx2RsY5vsavKbffZNlz8GWrBF1rNaUK 4KcQ== Received: by 10.50.242.73 with SMTP id wo9mr11374652igc.1.1343066845645; Mon, 23 Jul 2012 11:07:25 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.153.7 with SMTP id i7csp59947ibw; Mon, 23 Jul 2012 11:07:24 -0700 (PDT) Received: by 10.180.83.66 with SMTP id o2mr32123580wiy.14.1343066844371; Mon, 23 Jul 2012 11:07:24 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id e56si17108892wef.68.2012.07.23.11.07.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jul 2012 11:07:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1StN2Q-0005hz-SE; Mon, 23 Jul 2012 19:07:22 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio Subject: [PATCH] linux-user: Move target_to_host_errno_table[] setup out of ioctl loop Date: Mon, 23 Jul 2012 19:07:22 +0100 Message-Id: <1343066842-21920-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQn88+kaa2Umrcm18ypHJB4q9zaxTl36B8/tGlWwGS129FNR6jLEHU6K63rJi+M/kh2+Iq7g The code to initialise the target_to_host_errno_table[] array was accidentally inside the loop through checking and initialising all the supported ioctls. This was harmless but meant that we reinitialised the array several hundred times on startup. Signed-off-by: Peter Maydell --- The code seems to have been incorrectly placed like this since it was first committed... linux-user/syscall.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 539af3f..9f9ad9a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4594,6 +4594,11 @@ void syscall_init(void) #undef STRUCT #undef STRUCT_SPECIAL + /* Build target_to_host_errno_table[] table from + * host_to_target_errno_table[]. */ + for (i=0; i < ERRNO_TABLE_SIZE; i++) + target_to_host_errno_table[host_to_target_errno_table[i]] = i; + /* we patch the ioctl size if necessary. We rely on the fact that no ioctl has all the bits at '1' in the size field */ ie = ioctl_entries; @@ -4613,11 +4618,6 @@ void syscall_init(void) (size << TARGET_IOC_SIZESHIFT); } - /* Build target_to_host_errno_table[] table from - * host_to_target_errno_table[]. */ - for (i=0; i < ERRNO_TABLE_SIZE; i++) - target_to_host_errno_table[host_to_target_errno_table[i]] = i; - /* automatic consistency check if same arch */ #if (defined(__i386__) && defined(TARGET_I386) && defined(TARGET_ABI32)) || \ (defined(__x86_64__) && defined(TARGET_X86_64))