On Mon, Apr 25, 2011 at 04:54:19PM +0500, Khansa Butt wrote:
> please see inline comments highlighted in red color.
>
> On Wed, Apr 13, 2011 at 2:32 AM, Aurelien Jarno <
address@hidden>wrote:
>
> > [I don't know very well linux-user, it would be nice to Cc: Riku Voipio,
> > the linux-user maintainer for the next version.]
> >
> > On Sat, Apr 09, 2011 at 04:02:31PM +0500, Khansa Butt wrote:
> > > From e96e20e50cada1c9e1b65de5925281cdd5659746 Mon Sep 17 00:00:00 2001
> > > From: Ehsan-ul-Haq & Khansa Butt <
address@hidden>
> > > Date: Sat, 9 Apr 2011 10:51:22 +0500
> > > Subject: [PATCH 1/2] Support for MIPS64 user mode emulation
> > >
> > >
> > > Signed-off-by: Ehsan-ul-Haq, Abdul Qadeer, Abdul Waheed, Khansa Butt <
> > >
address@hidden>
> > > ---
> > > configure | 1 +
> > > default-configs/mips64-linux-user.mak | 1 +
> > > linux-user/elfload.c | 2 +-
> > > linux-user/main.c | 29
> > +++++++++++++++++++++++++++--
> > > linux-user/mips64/syscall.h | 3 +++
> > > linux-user/signal.c | 3 ++-
> > > target-mips/translate.c | 1 +
> > > 7 files changed, 36 insertions(+), 4 deletions(-)
> > > create mode 100644 default-configs/mips64-linux-user.mak
> > >
> > > diff --git a/configure b/configure
> > > index ae97e11..d1f7867 100755
> > > --- a/configure
> > > +++ b/configure
> > > @@ -1039,6 +1039,7 @@ m68k-linux-user \
> > > microblaze-linux-user \
> > > microblazeel-linux-user \
> > > mips-linux-user \
> > > +mips64-linux-user \
> > > mipsel-linux-user \
> > > ppc-linux-user \
> > > ppc64-linux-user \
> > > diff --git a/default-configs/mips64-linux-user.mak
> > > b/default-configs/mips64-linux-user.mak
> > > new file mode 100644
> > > index 0000000..1598bfc
> > > --- /dev/null
> > > +++ b/default-configs/mips64-linux-user.mak
> > > @@ -0,0 +1 @@
> > > +# Default configuration for mips64-linux-user
> > > diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> > > index fe5410e..2832a33 100644
> > > --- a/linux-user/elfload.c
> > > +++ b/linux-user/elfload.c
> > > @@ -1384,7 +1384,7 @@ static void load_elf_image(const char *image_name,
> > int
> > > image_fd,
> > > vaddr_po = TARGET_ELF_PAGEOFFSET(vaddr);
> > > vaddr_ps = TARGET_ELF_PAGESTART(vaddr);
> > >
> > > - error = target_mmap(vaddr_ps, eppnt->p_filesz + vaddr_po,
> > > + error = target_mmap(vaddr_ps, eppnt->p_memsz + vaddr_po,
> >
> > What is the goal of this change? If the mmapped aread is bigger than the
> > file size rounded up to te page size, it will cause a SIGBUS.
> >
> > > elf_prot, MAP_PRIVATE | MAP_FIXED,
> > > image_fd, eppnt->p_offset - vaddr_po);
> > > if (error == -1) {
> > > diff --git a/linux-user/main.c b/linux-user/main.c
> > > index e651bfd..a7f4955 100644
> > > --- a/linux-user/main.c
> > > +++ b/linux-user/main.c
> > > @@ -1937,6 +1937,14 @@ static int do_store_exclusive(CPUMIPSState *env)
> > > int d;
> > >
> > > addr = env->lladdr;
> > > +#if defined(TARGET_MIPS64)
> > > +/* For MIPS64 on 32 bit host there is a need to make
> > > +* the page accessible to which the above 'addr' is belonged */
> > > +#if HOST_LONG_BITS == 32
> > > + int flag = PAGE_VALID | PAGE_READ | PAGE_WRITE | PAGE_WRITE_ORG;
> > > + page_set_flags(addr, addr + 4096, flag);
> > > +#endif
> > > +#endif
> >
> > I don't really see the reason why this should be done that way. Are you
> > trying to run MIPS32 binaries compiled for 8kB page size?
> >
>
>
>
> this change is needed when we run MIPS64 ELF on 32 bit x86 host. MIPS64 ELF
> contains 36 bit address.