Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BD7773622145634B952E5B54ACA8E349AA24426F@PUMAIL01.pu.imgtec.org>
Date: Thu, 25 Feb 2016 12:05:33 +0000
From: Jaydeep Patil <Jaydeep.Patil@...tec.com>
To: "dalias@...c.org" <dalias@...c.org>
CC: Mahesh Bodapati <Mahesh.Bodapati@...tec.com>, "musl@...ts.openwall.com"
	<musl@...ts.openwall.com>
Subject: RE: mips n64 porting review

>From: Mahesh Bodapati [mailto:maheshbodapati90@...il.com] 
>Sent: 23 February 2016 11:56
>To: Mahesh Bodapati
>Subject: Fwd: [musl] mips n64 porting review
>
>
>---------- Forwarded message ----------
>From: Rich Felker <dalias@...c.org>
>Date: Tue, Feb 23, 2016 at 9:02 AM
>Subject: Re: [musl] mips n64 porting review
>To: musl@...ts.openwall.com
>
>
>On Mon, Feb 22, 2016 at 10:06:02AM +0000, Mahesh Bodapati wrote:
>> Hi Rich,
>> I have attached the patch which has all the MIPS n64 porting work. I
>> have created mipsn64port_review remote branch on GitHub and please
>> have a look at
>> https://github.com/MaheshBodapati/musl/commits/mipsn64port_review
>> which has the broken down patches and the base revision on which we
>> have prepared patch is d150764
>>
>> We have tested on both little endian and big endian, here are the FAILS
>>
>> Musl mips n64 libc testing on EL :
>>
>> Fails: 17
>> FAIL ./src/api/main.exe [status 1]
>> FAIL ./src/functional/wcstol-static.exe [status 1]
>> FAIL ./src/functional/wcstol.exe [status 1]
>> FAIL ./src/math/acosh.exe [status 1]
>> FAIL ./src/math/asinh.exe [status 1]
>> FAIL ./src/math/j0.exe [status 1]
>> FAIL ./src/math/jn.exe [status 1]
>> FAIL ./src/math/jnf.exe [status 1]
>> FAIL ./src/math/lgamma.exe [status 1]
>> FAIL ./src/math/lgamma_r.exe [status 1]
>> FAIL ./src/math/lgammaf.exe [status 1]
>> FAIL ./src/math/lgammaf_r.exe [status 1]
>> FAIL ./src/math/sinh.exe [status 1]
>> FAIL ./src/math/tgamma.exe [status 1]
>> FAIL ./src/math/y0.exe [status 1]
>> FAIL ./src/math/y0f.exe [status 1]
>> FAIL ./src/math/ynf.exe [status 1]
>>
>> Musl mips n64 libc testing on EB :
>> Fails:17
>> FAIL ./src/api/main.exe [status 1]
>> FAIL ./src/functional/wcstol-static.exe [status 1]
>> FAIL ./src/functional/wcstol.exe [status 1]
>> FAIL ./src/math/acosh.exe [status 1]
>> FAIL ./src/math/asinh.exe [status 1]
>> FAIL ./src/math/j0.exe [status 1]
>> FAIL ./src/math/jn.exe [status 1]
>> FAIL ./src/math/jnf.exe [status 1]
>> FAIL ./src/math/lgamma.exe [status 1]
>> FAIL ./src/math/lgamma_r.exe [status 1]
>> FAIL ./src/math/lgammaf.exe [status 1]
>> FAIL ./src/math/lgammaf_r.exe [status 1]
>> FAIL ./src/math/sinh.exe [status 1]
>> FAIL ./src/math/tgamma.exe [status 1]
>> FAIL ./src/math/y0.exe [status 1]
>> FAIL ./src/math/y0f.exe [status 1]
>> FAIL ./src/math/ynf.exe [status 1]
>These look fairly expected.

<snip>

>> +#include <sys/stat.h>
>> +struct kernel_stat {
>> +    unsigned int st_dev;
>> +    unsigned int __pad1[3];
>> +    unsigned long long st_ino;
>> +    unsigned int st_mode;
>> +    unsigned int st_nlink;
>> +    int st_uid;
>> +    int st_gid;
>> +    unsigned int st_rdev;
>> +    unsigned int __pad2[3];
>> +    long long st_size;
>> +    unsigned int st_atime_sec;
>> +    unsigned int st_atime_nsec;
>> +    unsigned int st_mtime_sec;
>> +    unsigned int st_mtime_nsec;
>> +    unsigned int st_ctime_sec;
>> +    unsigned int st_ctime_nsec;
>> +    unsigned int st_blksize;
>> +    unsigned int __pad3;
>> +    unsigned long long st_blocks;
>> +};
>> +
>> +static void __stat_fix(struct kernel_stat *kst, struct stat *st)
>> +{
>> +     extern void *memset(void *s, int c, size_t n);
>> +
>> +     st->st_dev = kst->st_dev;
>> +     memset (&st->st_pad1, 0, sizeof (st->st_pad1));
>> +     st->st_ino = kst->st_ino;
>> +     st->st_mode = kst->st_mode;
>> +     st->st_nlink = kst->st_nlink;
>> +     st->st_uid = kst->st_uid;
>> +     st->st_gid = kst->st_gid;
>> +     st->st_rdev = kst->st_rdev;
>> +     memset (&st->st_pad2, 0, sizeof (st->st_pad2));
>> +     st->st_size = kst->st_size;
>> +     st->st_pad3 = 0;
>> +     st->st_atim.tv_sec = kst->st_atime_sec;
>> +     st->st_atim.tv_nsec = kst->st_atime_nsec;
>> +     st->st_mtim.tv_sec = kst->st_mtime_sec;
>> +     st->st_mtim.tv_nsec = kst->st_mtime_nsec;
>> +     st->st_ctim.tv_sec = kst->st_ctime_sec;
>> +     st->st_ctim.tv_nsec = kst->st_ctime_nsec;
>> +     st->st_blksize = kst->st_blksize;
>> +     st->st_blocks = kst->st_blocks;
>> +     memset (&st->st_pad5, 0, sizeof (st->st_pad5));
>> +     return;
>> +}
>
>You've made this a lot more complicated than it needs to be. Just
>copying the __stat_fix code from 32-bit mips should work fine. The
>only fixup that needs to be done is for st_dev and st_rdev and it can
>be done in-place.

In case of MIPS64, the stat syscall returns a structure as described by 'struct kernel_stat'. The  ' struct stat' in MIPS64 has following notable difference as compared to 'struct kernel_stat':
The st_nlink is of 8 bytes and all st_*tim members are of 16 bytes (due to sizeof long in 64bit). Thus all members of ' struct stat' starting from st_uid are at different offset than what stat syscall has returned. In case of MIPS32, we just need to adjust dev_t (being long long) as described in __stat_fix. However in case of MIPS64 we need to members from 'struct kernel_stat' to 'struct stat'

Regards,
Jaydeep

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.