|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 for-4.14 1/3] xen/monitor: Control register values
On 02.06.2020 15:01, Roger Pau Monné wrote:
> On Tue, Jun 02, 2020 at 06:40:12AM -0600, Tamas K Lengyel wrote:
>> On Tue, Jun 2, 2020 at 5:08 AM Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
>>> On Wed, May 20, 2020 at 08:31:52PM -0600, Tamas K Lengyel wrote:
>>>> --- a/xen/arch/x86/hvm/hvm.c
>>>> +++ b/xen/arch/x86/hvm/hvm.c
>>>> @@ -2263,7 +2263,8 @@ int hvm_set_cr0(unsigned long value, bool may_defer)
>>>> {
>>>> ASSERT(v->arch.vm_event);
>>>>
>>>> - if ( hvm_monitor_crX(CR0, value, old_value) )
>>>> + if ( hvm_monitor_crX(CR0, value, old_value) &&
>>>> + v->domain->arch.monitor.control_register_values )
>>>> {
>>>> /* The actual write will occur in hvm_do_resume(), if
>>>> permitted. */
>>>> v->arch.vm_event->write_data.do_write.cr0 = 1;
>>>> @@ -2362,7 +2363,8 @@ int hvm_set_cr3(unsigned long value, bool may_defer)
>>>> {
>>>> ASSERT(v->arch.vm_event);
>>>>
>>>> - if ( hvm_monitor_crX(CR3, value, old) )
>>>> + if ( hvm_monitor_crX(CR3, value, old) &&
>>>> + v->domain->arch.monitor.control_register_values )
>>>> {
>>>> /* The actual write will occur in hvm_do_resume(), if
>>>> permitted. */
>>>> v->arch.vm_event->write_data.do_write.cr3 = 1;
>>>> @@ -2443,7 +2445,8 @@ int hvm_set_cr4(unsigned long value, bool may_defer)
>>>> {
>>>> ASSERT(v->arch.vm_event);
>>>>
>>>> - if ( hvm_monitor_crX(CR4, value, old_cr) )
>>>> + if ( hvm_monitor_crX(CR4, value, old_cr) &&
>>>> + v->domain->arch.monitor.control_register_values )
>>>
>>> I think you could return control_register_values in hvm_monitor_crX
>>> instead of having to add the check to each caller?
>>
>> We could, but this way the code is more consistent.
>
> OK, I guess it's a matter of taste. I would rather prefer those checks
> to be confined to hvm_monitor_crX because then the generic code is not
> polluted with monitor checks, but that's likely just my taste.
+1
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |