[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] x86/xenoprof: fix kernel/user mode detection for HVM
# HG changeset patch # User Jacob Shin <jacob.shin@xxxxxxx> # Date 1351497674 -3600 # Node ID de551622e12493ca8747a69d68cd08103411a220 # Parent 9cedd98b1835418d0a01e116c96fe6b3fb1660cb x86/xenoprof: fix kernel/user mode detection for HVM While trying oprofile under Xen, I noticed that HVM passive domain's kernel addresses were showing up as user application. It turns out under HVM get_cpu_user_regs()->cs contains 0x0000beef. Signed-off-by: Jacob Shin <jacob.shin@xxxxxxx> Don't cast away const-ness. Use SS instead of CS to determine ring. Special-case real and protected mode. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> xen-unstable changeset: 26055:14e32621dbaf xen-unstable date: Mon Oct 15 13:04:51 UTC 2012 --- diff -r 9cedd98b1835 -r de551622e124 xen/arch/x86/oprofile/xenoprof.c --- a/xen/arch/x86/oprofile/xenoprof.c Mon Oct 29 08:59:47 2012 +0100 +++ b/xen/arch/x86/oprofile/xenoprof.c Mon Oct 29 09:01:14 2012 +0100 @@ -82,10 +82,21 @@ int xenoprofile_get_mode(struct vcpu *v, if ( !guest_mode(regs) ) return 2; - if ( is_hvm_vcpu(v) ) - return ((regs->cs & 3) != 3); + if ( !is_hvm_vcpu(v) ) + return guest_kernel_mode(v, regs); - return guest_kernel_mode(v, regs); + switch ( hvm_guest_x86_mode(v) ) + { + struct segment_register ss; + + case 0: /* real mode */ + return 1; + case 1: /* vm86 mode */ + return 0; + default: + hvm_get_segment_register(v, x86_seg_ss, &ss); + return (ss.sel & 3) != 3; + } } /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |