Hi Peter,
On 2018/1/13 13:24, gengdongjiu wrote:
>>> +
>>> + /* For the AArch64, instruction length is 32-bit */
>>> + esr |= ARM_EL_IL;
>>> + env->exception.syndrome = esr;
>>> +
>>> + cc->do_interrupt(c);
>>> +
>>> + /* set ESR_EL1 */
>>> + ret = kvm_arm_cpreg_value(cpu, offsetof(CPUARMState, cp15.esr_el[1]));
>> Breakpoint injection doesn't need to do this. Neither should this code.
> As my above explanation, in the KVM mode, it needs to set the ESR_ELx in
> extra method.
> the cc->do_interrupt(c) does not set ESR_ELx. so I use kvm_arm_cpreg_value()
> to set it. whether you have better method to set the ESR_Elx except for my
> method? Thanks.
If QEMU changes the KVM's registers, it needs to call write_list_to_kvmstate()
to write the cpu->cpreg_values[] list
to KVM through KVM_SET_ONE_REG IOCTL[1]. In Qemu, now it should not have
software path to change the cpu->cpreg_values[] list
except write_cpustate_to_list(). Here I can also call write_cpustate_to_list()
instead of kvm_arm_cpreg_value() to change
cpu->cpreg_values[] list, but the write_cpustate_to_list() will write all the
coprocessor state to the cpu->cpreg_values[] list,
we can not sure all the coprocessor states are right, so here I only change
corresponding index value in this list using kvm_arm_cpreg_value().
Breakpoint injection that you mentioned should not change KVM register or not
in the KVM mode.
[1]:
kvm_arch_put_registers()
-> write_list_to_kvmstate()
-> write cpu->cpreg_values[] to the kernel KVM through KVM_SET_ONE_REG
>
>
>>> + if (ret) {
>>> + fprintf(stderr, "<%s> failed to set esr_el1\n", __func__);
>>> + abort();
>>> + }
>>> +}
>>> +
>>> #define AARCH64_CORE_REG(x) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \
>>> KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(x))
>>>
>>> --
>>> 1.8.3.1