debuggers.hg

view xen/arch/ia64/xen/platform_hypercall.c @ 19810:aaab04808ee7

Introduce mechanism to check standard conformance of headers

While pretty simplistic, it appears to serve the purpose at the moment
(i.e. it spotted two places where a GNU extension was used withou
proper preprocessor conditionals). The "simplistic" here includes that
the checking gets only done for native builds, and ia64 gets excluded
due to its arch-specific header intentionally (for whatever reason)
checking that anonymous struct/unions can be used.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 17 07:21:03 2009 +0100 (2009-06-17)
parents d9b70fc0ee0f
children
line source
1 /******************************************************************************
2 * platform_hypercall.c
3 *
4 * Hardware platform operations. Intended for use by domain-0 kernel.
5 *
6 * Copyright (c) 2002-2006, K Fraser
7 */
9 #include <xen/config.h>
10 #include <xen/types.h>
11 #include <xen/lib.h>
12 #include <xen/sched.h>
13 #include <xen/domain.h>
14 #include <xen/guest_access.h>
15 #include <xen/acpi.h>
16 #include <public/platform.h>
17 #include <acpi/cpufreq/processor_perf.h>
19 DEFINE_SPINLOCK(xenpf_lock);
21 extern int set_px_pminfo(uint32_t cpu, struct xen_processor_performance *perf);
22 extern long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power);
24 long do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
25 {
26 long ret = 0;
27 struct xen_platform_op curop, *op = &curop;
29 if ( !IS_PRIV(current->domain) )
30 return -EPERM;
32 if ( copy_from_guest(op, u_xenpf_op, 1) )
33 return -EFAULT;
35 if ( op->interface_version != XENPF_INTERFACE_VERSION )
36 return -EACCES;
38 switch ( op->cmd )
39 {
40 case XENPF_set_processor_pminfo:
41 spin_lock(&xenpf_lock);
42 switch ( op->u.set_pminfo.type )
43 {
44 case XEN_PM_PX:
45 if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
46 {
47 ret = -ENOSYS;
48 break;
49 }
50 ret = set_px_pminfo(op->u.set_pminfo.id,
51 &op->u.set_pminfo.u.perf);
52 break;
54 case XEN_PM_CX:
55 /* Place holder for Cx */
56 ret = -ENOSYS;
57 break;
59 default:
60 ret = -EINVAL;
61 break;
62 }
63 spin_unlock(&xenpf_lock);
64 break;
66 default:
67 printk("Unknown platform hypercall op 0x%x\n", op->cmd);
68 ret = -ENOSYS;
69 break;
70 }
72 return ret;
73 }
75 /*
76 * Local variables:
77 * mode: C
78 * c-set-style: "BSD"
79 * c-basic-offset: 4
80 * tab-width: 4
81 * indent-tabs-mode: nil
82 * End:
83 */