ia64/xen-unstable

view xen/arch/x86/sysctl.c @ 13608:30af6cfdb05c

Make domctl/sysctl interfaces 32-/64-bit invariant.
This kills off a fair amount of unpleasant CONFIG_COMPAT shimming and
avoids needing to keep the compat paths in sync as these interfaces
continue to develop.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jan 24 16:33:19 2007 +0000 (2007-01-24)
parents d80684d19ef4
children 6daa91dc9247
line source
1 /******************************************************************************
2 * Arch-specific sysctl.c
3 *
4 * System management operations. For use by node control stack.
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/mm.h>
13 #include <xen/guest_access.h>
14 #include <public/sysctl.h>
15 #include <xen/sched.h>
16 #include <xen/event.h>
17 #include <xen/domain_page.h>
18 #include <asm/msr.h>
19 #include <xen/trace.h>
20 #include <xen/console.h>
21 #include <xen/iocap.h>
22 #include <asm/shadow.h>
23 #include <asm/irq.h>
24 #include <asm/hvm/hvm.h>
25 #include <asm/hvm/support.h>
26 #include <asm/processor.h>
28 long arch_do_sysctl(
29 struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
30 {
31 long ret = 0;
33 switch ( sysctl->cmd )
34 {
36 case XEN_SYSCTL_physinfo:
37 {
38 xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
40 pi->threads_per_core =
41 cpus_weight(cpu_sibling_map[0]);
42 pi->cores_per_socket =
43 cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
44 pi->sockets_per_node =
45 num_online_cpus() / cpus_weight(cpu_core_map[0]);
47 pi->nr_nodes = 1;
48 pi->total_pages = total_pages;
49 pi->free_pages = avail_domheap_pages();
50 pi->scrub_pages = avail_scrub_pages();
51 pi->cpu_khz = cpu_khz;
52 memset(pi->hw_cap, 0, sizeof(pi->hw_cap));
53 memcpy(pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4);
54 ret = 0;
55 if ( copy_to_guest(u_sysctl, sysctl, 1) )
56 ret = -EFAULT;
57 }
58 break;
61 default:
62 ret = -ENOSYS;
63 break;
64 }
66 return ret;
67 }
69 /*
70 * Local variables:
71 * mode: C
72 * c-set-style: "BSD"
73 * c-basic-offset: 4
74 * tab-width: 4
75 * indent-tabs-mode: nil
76 * End:
77 */