Re: [PATCH 1/7] KVM: x86 emulator: framework for streamlining arithmetic opcodes

Avi Kivity
2012-12-22T18:18:15Z

On Sat, Dec 22, 2012 at 8:11 PM, Gleb Natapov <gleb@redhat.com> wrote:
> On Sat, Dec 22, 2012 at 08:07:30PM +0200, Avi Kivity wrote:
>> On Sat, Dec 22, 2012 at 8:01 PM, Gleb Natapov <gleb@redhat.com> wrote:
>> > On Sat, Dec 22, 2012 at 07:42:55PM +0200, Avi Kivity wrote:
>> >> On Sat, Dec 22, 2012 at 7:00 PM, Gleb Natapov <gleb@redhat.com> wrote:
>> >> > On Sat, Dec 22, 2012 at 02:26:51PM +0200, Avi Kivity wrote:
>> >> >> +
>> >> >> +/*
>> >> >> + * fastop functions have a special calling convention:
>> >> >> + *
>> >> >> + * dst: [rdx]:rax (in/out)
>> >> > May be I miss something obvious but I do not see why rdx is here.
>> >>
>> >> MUL, DIV, CWD, etc.
>> > Yes, but my question was more about actual fastop() implementation
>> > which does not seams to handle rdx at all.
>>
>>
>> It will be added later. If you like, I can remove it from the comment for now.
> No, I was just truing to make sure I am not missing something :)
> Wouldn't we have to have separate fastop() function to handle rax/rdx
> output instructions?

No. As long as fastop() sets up and writes back rdx correctly (and
also #DE for DIV, IDIV), a single implementation works for everything.
I don't want to add even more layers of indirect dispatch.