qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] MIPS 'move' insn emulation


From: Yongbok Kim
Subject: Re: [Qemu-devel] MIPS 'move' insn emulation
Date: Thu, 14 Sep 2017 15:23:57 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0


On 14/09/2017 15:16, Sergey Smolov wrote:
> 
> On 14.09.2017 16:58, Peter Maydell wrote:
>> At translate time it is generating some extra code which at runtime
>> will call the helper_trace_reg_access() function, passing it the
>> values in the registers at this point. This will result in poor
>> performance if you do it for frequently executed instructions.

Yes indeed. it will be hitting the performance critically the instruction
is quite often used. :)

> 
> Ok, thank you.
> 
>> That looks like it ought to work. Check you really did save all your
>> files in your editor before compiling? :-)
> 
> Yes, I did. These warnings are very suspicious, because they come with
> strange numbers of MIPS GPR registers that I receive for my program.
> 
> Here is the program:
> 
> .text
>     addiu $8, $zero, 0x7
>     move $9, $8
>     sll $8, $8, 3
>     add $8, $8, $9
> 
> Here is the log that helper functions provide:
> 
> $0 00000007
> $7 00000007
> $0 00000038
> $0 0000003f
> 
> The first value is register name, the second is the value to be written.
> Values are ok, but I expect to see $8 and $9  registers here.
> 
>>
>> PS: there's no point passing the env pointer into the function if
>> you're not going to use it...

Yes you're right. I had further use of the env but it has been chopped for
the example.

> 
> I thought that I need to pass env pointer to helper function because of
> some convention. Again, thank you for the note.
> 

Sergey,

The reason why your modification is failed is because you passed wrong
argument. Remember that you are not just calling the helper function from
translate.c but you are generating some code to let call the helper
function on run time. You have to create a temporal TCGv to pass the
register number.
You could do it like,
TCGv_i32 tmp = tcg_const_i32(rd)
gen_helper_trace_reg_access(cpu_env, tmp, cpu_gpr[rs);
tcg_temp_free_i32(tmp);

or simply use the predefined macro and fix the order of the arguments.

gen_helper_0e1i(trace_reg_access, cpu_gpr[rs], rd);

Regards,
Yongbok



reply via email to

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