From patchwork Sat Jul 6 20:44:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18275 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-fa0-f70.google.com (mail-fa0-f70.google.com [209.85.161.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A573020E0B for ; Sat, 6 Jul 2013 20:45:01 +0000 (UTC) Received: by mail-fa0-f70.google.com with SMTP id m1sf3662711fam.1 for ; Sat, 06 Jul 2013 13:45:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=axNrf0/0e21JrCMBUK3J+SLbzpZaO00t0F9hgQEC8hU=; b=nyfKeHadyYRYb+B8AY6abNCWrtaqtc4rKuCD2gUCoiNGgQjnCMa3DnBhyLYAXzp258 Ux2HQ9aykeeAAKgmQlhCpcVg1M71XWf8aSfcrpEWFPB0Q8Uz/z99hDvvQshIKgZi5fWr Gjui7dgTmLUkiTESRD7JNxgiiEJmzdF7fxeayveB7HqCFn+R4qgnUPO1HvPasIltCi1T EJdH+bp1RN4riCC66hEj/snAlqohwX9T7XFfu1jnnPn9enqNTlW9tWfYWXDnek1cmB6Z 03QrXreBwH8MMsGMWZ+H+RDHm7br+KY0dhuv4O1kstOLMHesmF7CTY/7hjO7WuTI1rpG xzaw== X-Received: by 10.180.182.230 with SMTP id eh6mr11366107wic.3.1373143499961; Sat, 06 Jul 2013 13:44:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.88.193 with SMTP id bi1ls1925582wib.25.canary; Sat, 06 Jul 2013 13:44:59 -0700 (PDT) X-Received: by 10.180.90.240 with SMTP id bz16mr8389113wib.24.1373143499339; Sat, 06 Jul 2013 13:44:59 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id q16si5141839wie.62.2013.07.06.13.44.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 06 Jul 2013 13:44:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id db10so2542920veb.40 for ; Sat, 06 Jul 2013 13:44:57 -0700 (PDT) X-Received: by 10.58.6.210 with SMTP id d18mr10420142vea.96.1373143497856; Sat, 06 Jul 2013 13:44:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.149.77 with SMTP id s13csp108192vcv; Sat, 6 Jul 2013 13:44:57 -0700 (PDT) X-Received: by 10.14.148.133 with SMTP id v5mr18033628eej.81.1373143496804; Sat, 06 Jul 2013 13:44:56 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id g8si11035339eet.243.2013.07.06.13.44.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 06 Jul 2013 13:44:56 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1UvZLh-0004PM-Ss; Sat, 06 Jul 2013 21:44:53 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Jia Liu Subject: [PATCH] linux-user: Fix target_stat and target_stat64 for OpenRISC Date: Sat, 6 Jul 2013 21:44:53 +0100 Message-Id: <1373143493-16919-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQkH3zs/lGSBnLIkxd40+XYXGvcGGCU8vpozXqQdrHMbK1SqtaxCQDUw/KcQe5mtCBRJxvoD X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , OpenRISC uses the asm-generic versions of target_stat and target_stat64, but it was incorrectly using the x86/ARM/etc version due to a misplaced defined(TARGET_OPENRISC). The previously unused OpenRISC section of the ifdef ladder also defined an incorrect target_stat and omitted the target_stat64 definition. Fix target_stat, provide target_stat64, and add a comment noting that these are the asm-generic versions for the benefit of future ports. Signed-off-by: Peter Maydell Reviewed-by: Jia Liu --- This fixes basic problems like "ls -l output is nonsense" and "shell thinks programs aren't executable and won't run them". linux-user/syscall_defs.h | 49 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 92c01a9..cb6341f 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1138,8 +1138,7 @@ struct target_winsize { #endif #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) \ - || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \ - || defined(TARGET_OPENRISC) + || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) struct target_stat { unsigned short st_dev; unsigned short __pad1; @@ -1837,29 +1836,55 @@ struct target_stat { abi_ulong __unused[3]; }; #elif defined(TARGET_OPENRISC) + +/* These are the asm-generic versions of the stat and stat64 structures */ + struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - abi_ulong st_nlink; - unsigned int st_mode; + unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; - unsigned int __pad0; abi_ulong st_rdev; + abi_ulong __pad1; abi_long st_size; - abi_long st_blksize; - abi_long st_blocks; /* Number 512-byte blocks allocated. */ - - abi_ulong target_st_atime; + int st_blksize; + int __pad2; + abi_long st_blocks; + abi_long target_st_atime; abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; + abi_long target_st_mtime; abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; + abi_long target_st_ctime; abi_ulong target_st_ctime_nsec; + unsigned int __unused4; + unsigned int __unused5; +}; - abi_long __unused[3]; +struct target_stat64 { + uint64_t st_dev; + uint64_t st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + uint64_t st_rdev; + uint64_t __pad1; + int64_t st_size; + int st_blksize; + int __pad2; + int64_t st_blocks; + int target_st_atime; + unsigned int target_st_atime_nsec; + int target_st_mtime; + unsigned int target_st_mtime_nsec; + int target_st_ctime; + unsigned int target_st_ctime_nsec; + unsigned int __unused4; + unsigned int __unused5; }; + #else #error unsupported CPU #endif