ia64/xen-unstable

view xen/xsm/xsm_policy.c @ 15896:42d4313b5fdd

[IA64] update .hgignore for xenitp

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Mon Sep 24 14:21:02 2007 -0600 (2007-09-24)
parents 96f64f4c42f0
children 1438f3255384
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 #endif
49 _policy_len = mod[i].mod_end - mod[i].mod_start;
51 if ( (xsm_magic_t)(*_policy_start) == XSM_MAGIC )
52 {
53 policy_buffer = (char *)_policy_start;
54 policy_size = _policy_len;
56 printk("Policy len 0x%lx, start at %p.\n",
57 _policy_len,_policy_start);
59 if ( i == 1 )
60 *initrdidx = (mbi->mods_count > 2) ? 2 : 0;
61 break;
63 }
64 }
66 return rc;
67 }