qemu-discuss
[Top][All Lists]
Advanced

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

[Qemu-discuss] 答复: Re: Output many return values of some instruction


From: EricSong
Subject: [Qemu-discuss] 答复: Re: Output many return values of some instruction
Date: Mon, 1 Dec 2014 18:25:59 +0800

Hi, Peter
    Thank you for explanation in details.
    I tried it as you suggestion before. I want to perform the function my 
instruction does using generic TCG intermediate code, but it failed. 
    Firstly, I tell you about my instruction -- Getsec (opcode is 0f 37), it is 
about the x86 arch safer mode . I want to emulate it by QEMU.
    Then, the function of Getsec is so complicated. There are many jmp or je/z 
opcode in this function. According to QEMU spirit, if jump instruction occurs, 
it should be jump to next TB. But for me, this is an atomic instruction. I 
cannot separate this function to portions. And It is complicated to modify the 
main sequence of QEMU. If no jump in my function, I think it is simple to add 
some function in Getsec (in disas_insn()).
    Lastly, do our QEMU have a schedule for Getsec implemention?
    Thank you very much!

Best wishes,
Eric

-----邮件原件-----
发件人: Peter Maydell [mailto:address@hidden 
发送时间: 2014年12月1日 17:50
收件人: Eric Song
抄送: qemu-discuss
主题: Re: Re: [Qemu-discuss] Output many return values of some instruction

On 1 December 2014 at 02:53,  <address@hidden> wrote:
> Hi, Peter
>    1) cpu_T[2] and cpu_T[3] have been built by me as same as cpu_[0] &1.

Don't do that. Use local temporaries as I have been suggesting.

>    2) tcg_gen_getsec_tl(R_EAX, R_EBX, R_ECX, cpu_T[1]); I tried it 
> before, but the result is not my expectation. But if I do TCG mov, EAX 
> will get what I want.

Then you should debug it to figure out what is going wrong...

>    3) I know that tcg_out_movi is a function used in the TCG backends. 
> And my aim is to finish one instruction on HW without the instruction. 
> So I must implement it use some code on the backend of QEMU.

No, you are misunderstanding here. The way QEMU works is:

 * frontend code decodes target instructions and converts
   them into generic TCG intermediate operations
 * backend code handles all generic TCG operations and
   writes suitable host code

Your front end needs to write out suitable generic TCG intermediate code to 
perform the function your new guest instruction does. (This might include "call 
this function in the frontend at runtime" if the new instruction is 
complicated.) There is never any need to change the backends, because they all 
can handle the same set of generic operations. Everything the front end needs 
to do can be expressed using those generic ops.

thanks
-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]