ia64/xen-unstable

view xen/xsm/xsm_policy.c @ 17062:0769835cf50f

x86 shadow: Reduce scope of shadow lock.

emulate_map_dest doesn't require holding lock, since
only shadow related operation possibly involved is to
remove shadow which is less frequent and can acquire
lock inside. Rest are either guest table walk or
per-vcpu monitor table manipulation

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 14 10:33:12 2008 +0000 (2008-02-14)
parents 1438f3255384
children
line source
1 /*
2 * Copyright (C) 2005 IBM Corporation
3 *
4 * Authors:
5 * Reiner Sailer, <sailer@watson.ibm.com>
6 * Stefan Berger, <stefanb@watson.ibm.com>
7 *
8 * Contributors:
9 * Michael LeMay, <mdlemay@epoch.ncsc.mil>
10 * George Coker, <gscoker@alpha.ncsc.mil>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2,
14 * as published by the Free Software Foundation.
15 *
16 *
17 * This file contains the XSM policy init functions for Xen.
18 * This file is based on the ACM functions of the same name.
19 *
20 */
22 #include <xsm/xsm.h>
23 #include <xen/multiboot.h>
25 char *policy_buffer = NULL;
26 u32 policy_size = 0;
28 int xsm_policy_init(unsigned int *initrdidx, const multiboot_info_t *mbi,
29 unsigned long initial_images_start)
30 {
31 int i;
32 module_t *mod = (module_t *)__va(mbi->mods_addr);
33 int rc = 0;
34 u32 *_policy_start;
35 unsigned long start, _policy_len;
37 /*
38 * Try all modules and see whichever could be the binary policy.
39 * Adjust the initrdidx if module[1] is the binary policy.
40 */
41 for ( i = mbi->mods_count-1; i >= 1; i-- )
42 {
43 start = initial_images_start + (mod[i].mod_start-mod[0].mod_start);
44 #if defined(__i386__)
45 _policy_start = (u32 *)start;
46 #elif defined(__x86_64__)
47 _policy_start = maddr_to_virt(start);
48 #else
49 _policy_start = NULL;
50 #endif
51 _policy_len = mod[i].mod_end - mod[i].mod_start;
53 if ( (xsm_magic_t)(*_policy_start) == XSM_MAGIC )
54 {
55 policy_buffer = (char *)_policy_start;
56 policy_size = _policy_len;
58 printk("Policy len 0x%lx, start at %p.\n",
59 _policy_len,_policy_start);
61 if ( i == 1 )
62 *initrdidx = (mbi->mods_count > 2) ? 2 : 0;
63 break;
65 }
66 }
68 return rc;
69 }