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

2017-09-14 Thread Sergey Smolov
On 14.09.2017 17:23, Yongbok Kim wrote: 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 poin

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

2017-09-14 Thread Peter Maydell
On 14 September 2017 at 15:23, Yongbok Kim wrote: > 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 h

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

2017-09-14 Thread Yongbok Kim
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 >>

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

2017-09-14 Thread Sergey Smolov
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 instruct

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

2017-09-14 Thread Peter Maydell
On 14 September 2017 at 14:49, Sergey Smolov wrote: > I've implemented the code you've written. Now I receive values are written > into MIPS registers. > > Could you explain some aspects about the code you propose? > > First, what is the helper function itself? Peter said that it is impossible > t

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

2017-09-14 Thread Sergey Smolov
On 13.09.2017 17:20, Yongbok Kim wrote: (Especially while implementing new instructions), I tended to add couple of helper functions for tracing temporally. op_helper.c: void helper_trace_reg_access(CPUMIPSState *env, target_ulong val) { printf("reg = "TARGET_FMT_lx"\n", val); } helper.h:

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

2017-09-13 Thread Yongbok Kim
On 13/09/2017 12:01, Peter Maydell wrote: > On 13 September 2017 at 08:29, Sergey Smolov wrote: >> -d options are a bit high-level for me, because I just see the execution >> result for every instruction. So it will be a mistake to think that every >> change of some register's value is just a ne

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

2017-09-13 Thread Peter Maydell
On 13 September 2017 at 08:29, Sergey Smolov wrote: > -d options are a bit high-level for me, because I just see the execution > result for every instruction. So it will be a mistake to think that every > change of some register's value is just a new value writing. > > As I understand, at "transla

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

2017-09-13 Thread Sergey Smolov
On 12.09.2017 18:06, Peter Maydell wrote: On 12 September 2017 at 15:53, Sergey Smolov wrote: Generally speaking, is it possible at "run time" to detect write accesses to MIPS GPR registers? If true, which parts of code should I look in? We don't currently support tracing at that level, I'm a

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

2017-09-12 Thread Peter Maydell
On 12 September 2017 at 15:53, Sergey Smolov wrote: > Generally speaking, is it possible at "run time" to detect write accesses to > MIPS GPR registers? > If true, which parts of code should I look in? We don't currently support tracing at that level, I'm afraid. (There are some patches on list s

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

2017-09-12 Thread Sergey Smolov
On 12.09.2017 17:32, Peter Maydell wrote: On 12 September 2017 at 15:14, Sergey Smolov wrote: I've the code I probably need to modify in target/mips/translate.c: [code] static void gen_logic(DisasContext *ctx, uint32_t opc, int rd, int rs, int rt) { ... } else if (rs !

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

2017-09-12 Thread Peter Maydell
On 12 September 2017 at 15:14, Sergey Smolov wrote: > I've the code I probably need to modify in target/mips/translate.c: > > [code] > > static void gen_logic(DisasContext *ctx, uint32_t opc, > int rd, int rs, int rt) > { > ... > } else if (rs != 0 && rt == 0) { >

[Qemu-devel] MIPS 'move' insn emulation

2017-09-12 Thread Sergey Smolov
Hello, List! I run MIPS assembler program on QEMU. The program is just a sample, here is the code: .text addiu $8, $zero, 0x7 move $9, $8 sll $8, $8, 3 add $8, $8, $9 The program finishes on QEMU with the following values for registers, and it's ok: $8 - 0x3f $9 - 0x7 Now