diff mbox

linux-user: Fix target_stat and target_stat64 for OpenRISC

Message ID 1373143493-16919-1-git-send-email-peter.maydell@linaro.org
State Accepted
Headers show

Commit Message

Peter Maydell July 6, 2013, 8:44 p.m. UTC
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 <peter.maydell@linaro.org>
---
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(-)

Comments

Peter Maydell July 18, 2013, 10:18 a.m. UTC | #1
Ping?

thanks
-- PMM

On 6 July 2013 21:44, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
> ---
> 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
> --
> 1.7.9.5
>
>
Jia Liu July 19, 2013, 12:25 a.m. UTC | #2
Hi Peter,

On Thu, Jul 18, 2013 at 6:18 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping?
>

Thank you, it looks good to me, please push it.

> thanks
> -- PMM
>
> On 6 July 2013 21:44, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 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 <peter.maydell@linaro.org>
>> ---
>> 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
>> --
>> 1.7.9.5
>>
>>

Regards,
Jia
Peter Maydell July 19, 2013, 9:27 a.m. UTC | #3
On 19 July 2013 01:25, Jia Liu <proljc@gmail.com> wrote:
> Hi Peter,
>
> On Thu, Jul 18, 2013 at 6:18 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Ping?
>>
>
> Thank you, it looks good to me, please push it.

The usual way to say this is to add your reviewed-by
or acked-by tag (depending on how thoroughly you
checked it)...

thanks
-- PMM
Jia Liu July 21, 2013, 5:16 a.m. UTC | #4
Hi Peter,

On Fri, Jul 19, 2013 at 5:27 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 19 July 2013 01:25, Jia Liu <proljc@gmail.com> wrote:
>> Hi Peter,
>>
>> On Thu, Jul 18, 2013 at 6:18 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> Ping?
>>>
>>
>> Thank you, it looks good to me, please push it.
>
> The usual way to say this is to add your reviewed-by
> or acked-by tag (depending on how thoroughly you
> checked it)...
>

Got it.

Reviewed-by: Jia Liu <proljc@gmail.com>

> thanks
> -- PMM

Regards,
Jia
diff mbox

Patch

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