qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Khansa Butt <khansa@kics.edu.pk>
To: Aurelien Jarno <aurelien@aurel32.net>, Riku Voipio <riku.voipio@iki.fi>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] Support for Cavium-Octeon specific instruction
Date: Wed, 13 Apr 2011 12:26:01 +0500	[thread overview]
Message-ID: <BANLkTinWzoE6VbNAxZWo8khqFypo2Xs7rQ@mail.gmail.com> (raw)
In-Reply-To: <20110412213221.GA4800@volta.aurel32.net>

[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]

We ported MIPS64 r2 user mode emulation. When a binary is given to
qemu-mips64, our code first check whether it is Octeon binary or not if yes
it  enable Octeon specific Instructions for. The following code snippet do
this job:

>
> > diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> > index 2832a33..9399e44 100644
> > --- a/linux-user/elfload.c
> > +++ b/linux-user/elfload.c
> > @@ -1662,6 +1662,11 @@ int load_elf_binary(struct linux_binprm * bprm,
> > struct target_pt_regs * regs,
> >         when we load the interpreter.  */
> >      elf_ex = *(struct elfhdr *)bprm->buf;
> >
> > +#if defined(TARGET_MIPS64)
> > +    if ((elf_ex.e_flags & EF_MIPS_MARCH) == E_MIPS_MACH_OCTEON) {
> > +        info->elf_arch = 1;
> > +    }
> > +#endif
> > +++ b/linux-user/main.c
> > @@ -3348,6 +3348,11 @@ int main(int argc, char **argv, char **envp)
> >          if (regs->cp0_epc & 1) {
> >              env->hflags |= MIPS_HFLAG_M16;
> >          }
> > +#if defined(TARGET_MIPS64)
> > +        if (info->elf_arch) {
> > +            env->insn_flags |=  INSN_OCTEON;
> > +        }
> > +#endif
> >      }
>

where we put elf_arch in image_info

and INSN_OCTEON is in target_mips/mips-defs.h as follows
  #define INSN_LOONGSON2E  0x20000000
  #define INSN_LOONGSON2F  0x40000000
  #define INSN_VR54XX 0x80000000
+#define            INSN_OCTEON 0x10000000

Is this solution acceptable for you?

[-- Attachment #2: Type: text/html, Size: 2145 bytes --]

  reply	other threads:[~2011-04-13  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 11:05 [Qemu-devel] [PATCH 2/2] Support for Cavium-Octeon specific instruction Khansa Butt
2011-04-12 21:32 ` Aurelien Jarno
2011-04-13  7:26   ` Khansa Butt [this message]
2011-04-13 18:17     ` Aurelien Jarno

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=BANLkTinWzoE6VbNAxZWo8khqFypo2Xs7rQ@mail.gmail.com \
    --to=khansa@kics.edu.pk \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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.
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).