lkml.org 
[lkml]   [2014]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/7] KVM: x86: Function for determining exception type
Il 21/07/2014 13:37, Nadav Amit ha scritto:
> +int kvm_exception_type(unsigned int nr)

The manual calls this the exception class.

Please open code this as an if like this

int mask;

/* This should never happen, right? */
if (WARN_ON(nr > 31))
return EXCPT_INTERRUPT;

mask = 1 << nr;
if (mask &
((1 << DB_VECTOR) | (1 << BP_VECTOR) |
(1 << OF_VECTOR)))
return EXCPT_TRAP;

...

/*
* If it is reserved, assume it is a fault and
* set RF.
*/
return EXCPT_FAULT;

> + case VE_VECTOR:
> + return EXCPT_FAULT;
> + case DB_VECTOR:
> + return EXCPT_FAULT_OR_TRAP;

It is only a fault for instruction fetch breakpoints. You can modify
kvm_vcpu_check_breakpoint to set RF, add a comment here that fault
handling is done elsewhere, and return EXCPT_TRAP.

Paolo


\
 
 \ /
  Last update: 2014-07-21 15:01    [W:0.024 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site