mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jaydeep Patil <Jaydeep.Patil@imgtec.com>
To: "dalias@libc.org" <dalias@libc.org>
Cc: Mahesh Bodapati <Mahesh.Bodapati@imgtec.com>,
	"musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: RE: mips n64 porting review
Date: Thu, 25 Feb 2016 12:05:33 +0000	[thread overview]
Message-ID: <BD7773622145634B952E5B54ACA8E349AA24426F@PUMAIL01.pu.imgtec.org> (raw)
In-Reply-To: <DE16056458B9894F9D46202EC1BBB28B3BE162B3@PUMAIL01.pu.imgtec.org>

>From: Mahesh Bodapati [mailto:maheshbodapati90@gmail.com] 
>Sent: 23 February 2016 11:56
>To: Mahesh Bodapati
>Subject: Fwd: [musl] mips n64 porting review
>
>
>---------- Forwarded message ----------
>From: Rich Felker <dalias@libc.org>
>Date: Tue, Feb 23, 2016 at 9:02 AM
>Subject: Re: [musl] mips n64 porting review
>To: musl@lists.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


  parent reply	other threads:[~2016-02-25 12:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 10:06 Mahesh Bodapati
2016-02-22 14:16 ` Bobby Bingham
2016-02-23  3:32 ` Rich Felker
     [not found]   ` <CAKd0kD+qQhvhiuaQ483ds2KyGD5qFjqJg4pOT6GyqCaoR9_auA@mail.gmail.com>
     [not found]     ` <DE16056458B9894F9D46202EC1BBB28B3BE16033@PUMAIL01.pu.imgtec.org>
2016-02-24 10:11       ` Jaydeep Patil
2016-02-24 17:53         ` dalias
2016-02-25  8:21           ` Jaydeep Patil
     [not found]     ` <DE16056458B9894F9D46202EC1BBB28B3BE162B3@PUMAIL01.pu.imgtec.org>
2016-02-25 12:05       ` Jaydeep Patil [this message]
2016-02-25 18:01         ` dalias
2016-02-25 18:22           ` dalias
2016-02-26  3:58             ` Jaydeep Patil
2016-02-25 18:23           ` Szabolcs Nagy
2016-02-25 18:29             ` Szabolcs Nagy
2016-02-25 18:31             ` Rich Felker
     [not found] <DE16056458B9894F9D46202EC1BBB28B3BDC3210@PUMAIL01.pu.imgtec.org>
2016-02-03 23:36 ` Rich Felker
2016-02-04  0:45 ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BD7773622145634B952E5B54ACA8E349AA24426F@PUMAIL01.pu.imgtec.org \
    --to=jaydeep.patil@imgtec.com \
    --cc=Mahesh.Bodapati@imgtec.com \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).