debuggers.hg

view xen/arch/ia64/xen/oprofile/xenoprof.c @ 15594:88ab11d8fd1c

[IA64] Don't use hard wired privilege level 2 for domain kernel

PV domains now use CPL 1 instead of 2 for CPL 0 emulation

Signed-off-by: Juergen Gross <juergen.gross@fujitsu-siemens.com>
author Alex Williamson <alex.williamson@hp.com>
date Mon Jul 02 09:29:08 2007 -0600 (2007-07-02)
parents 8ab9b43ad557
children e88253dfefdc
line source
1 /******************************************************************************
2 * xenoprof.c
3 *
4 * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
23 #include <xen/config.h>
24 #include <xen/sched.h>
25 #include <public/xen.h>
26 #include <xen/xenoprof.h>
28 int
29 xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
30 {
31 int mode;
33 // mode
34 // 0: user, 1: kernel, 2: xen
35 switch (ring(regs))
36 {
37 case 3:
38 mode = 0;
39 break;
40 case CONFIG_CPL0_EMUL:
41 mode = 1;
42 break;
43 case 0:
44 mode = 2;
45 break;
46 default:
47 gdprintk(XENLOG_ERR, "%s:%d ring%d is used!\n", __func__,
48 __LINE__, 3 - CONFIG_CPL0_EMUL);
49 mode = 1; /* fall back to kernel mode. */
50 }
51 return mode;
52 }
54 /*
55 * Local variables:
56 * mode: C
57 * c-set-style: "BSD"
58 * c-basic-offset: 4
59 * tab-width: 4
60 * indent-tabs-mode: nil
61 * End:
62 */