[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH VERY RFC 3/5] tools/fuzz: introduce x86 instruction emulator target



On Fri, Dec 09, 2016 at 01:05:19AM -0700, Jan Beulich wrote:
> >>> On 08.12.16 at 18:25, <wei.liu2@xxxxxxxxxx> wrote:
> > On Thu, Dec 08, 2016 at 08:03:04AM -0700, Jan Beulich wrote:
> > [...]
> >> 
> >> > +static int emul_read_cr(
> >> > +    unsigned int reg,
> >> > +    unsigned long *val,
> >> > +    struct x86_emulate_ctxt *ctxt)
> >> > +{
> >> > +    /* Fake just enough state for the emulator's _get_fpu() to be 
> >> > happy. */
> >> > +    switch ( reg )
> >> > +    {
> >> > +    case 0:
> >> > +        *val = 0x00000001; /* PE */
> >> > +        return X86EMUL_OKAY;
> >> > +
> >> > +    case 4:
> >> > +        /* OSFXSR, OSXMMEXCPT, and maybe OSXSAVE */
> >> > +        *val = 0x00000600 | (cpu_has_xsave ? 0x00040000 : 0);
> >> > +        return X86EMUL_OKAY;
> >> > +    }
> >> > +
> >> > +    return X86EMUL_UNHANDLEABLE;
> >> > +}
> >> 
> >> Looks suspiciously similar to existing code. We may want to share
> >> such stuff, to avoid having to update it in multiple places.
> > 
> > Share with what? Do you mean the real emulator code?
> 
> The real emulator test code, yes.
> 

OK. I will refactor the code a bit. Let's start with sharing the two
places you point out and make further improvements as we go along.

Wei.

> Jan
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.