313 lines
11 KiB
Diff
313 lines
11 KiB
Diff
Enable compatibility mode operation for HYPERVISOR_sysctl.
|
|
|
|
Index: 2007-01-08/xen/arch/x86/sysctl.c
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/arch/x86/sysctl.c 2007-01-08 15:04:23.000000000 +0100
|
|
+++ 2007-01-08/xen/arch/x86/sysctl.c 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -25,10 +25,14 @@
|
|
#include <asm/hvm/support.h>
|
|
#include <asm/processor.h>
|
|
|
|
-long arch_do_sysctl(
|
|
+#ifndef COMPAT
|
|
+typedef long ret_t;
|
|
+#endif
|
|
+
|
|
+ret_t arch_do_sysctl(
|
|
struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
|
|
{
|
|
- long ret = 0;
|
|
+ ret_t ret = 0;
|
|
|
|
switch ( sysctl->cmd )
|
|
{
|
|
Index: 2007-01-08/xen/arch/x86/x86_64/Makefile
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/arch/x86/x86_64/Makefile 2007-01-08 15:20:00.000000000 +0100
|
|
+++ 2007-01-08/xen/arch/x86/x86_64/Makefile 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -7,6 +7,7 @@ obj-$(CONFIG_COMPAT) += compat.o
|
|
obj-$(CONFIG_COMPAT) += domain.o
|
|
obj-$(CONFIG_COMPAT) += physdev.o
|
|
obj-$(CONFIG_COMPAT) += platform_hypercall.o
|
|
+obj-$(CONFIG_COMPAT) += sysctl.o
|
|
|
|
ifeq ($(CONFIG_COMPAT),y)
|
|
# extra dependencies
|
|
@@ -15,5 +16,6 @@ entry.o: compat/entry.S
|
|
mm.o: compat/mm.c
|
|
physdev.o: ../physdev.c
|
|
platform_hypercall.o: ../platform_hypercall.c
|
|
+sysctl.o: ../sysctl.c
|
|
traps.o: compat/traps.c
|
|
endif
|
|
Index: 2007-01-08/xen/arch/x86/x86_64/compat/entry.S
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/arch/x86/x86_64/compat/entry.S 2007-01-08 15:20:29.000000000 +0100
|
|
+++ 2007-01-08/xen/arch/x86/x86_64/compat/entry.S 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -278,7 +278,6 @@ CFIX14:
|
|
|
|
.section .rodata, "a", @progbits
|
|
|
|
-#define compat_sysctl domain_crash_synchronous
|
|
#define compat_domctl domain_crash_synchronous
|
|
|
|
ENTRY(compat_hypercall_table)
|
|
Index: 2007-01-08/xen/arch/x86/x86_64/sysctl.c
|
|
===================================================================
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
+++ 2007-01-08/xen/arch/x86/x86_64/sysctl.c 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -0,0 +1,33 @@
|
|
+/******************************************************************************
|
|
+ * Arch-specific compatibility sysctl.c
|
|
+ */
|
|
+
|
|
+#include <xen/config.h>
|
|
+#include <compat/sysctl.h>
|
|
+
|
|
+DEFINE_XEN_GUEST_HANDLE(compat_sysctl_t);
|
|
+#define xen_sysctl compat_sysctl
|
|
+#define xen_sysctl_t compat_sysctl_t
|
|
+#define arch_do_sysctl(x, h) arch_compat_sysctl(x, _##h)
|
|
+
|
|
+#define xen_sysctl_physinfo compat_sysctl_physinfo
|
|
+#define xen_sysctl_physinfo_t compat_sysctl_physinfo_t
|
|
+
|
|
+#define xen_sysctl_ioport_emulation compat_sysctl_ioport_emulation
|
|
+#define xen_sysctl_ioport_emulation_t compat_sysctl_ioport_emulation_t
|
|
+
|
|
+#define COMPAT
|
|
+#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
|
|
+typedef int ret_t;
|
|
+
|
|
+#include "../sysctl.c"
|
|
+
|
|
+/*
|
|
+ * Local variables:
|
|
+ * mode: C
|
|
+ * c-set-style: "BSD"
|
|
+ * c-basic-offset: 4
|
|
+ * tab-width: 4
|
|
+ * indent-tabs-mode: nil
|
|
+ * End:
|
|
+ */
|
|
Index: 2007-01-08/xen/common/compat/Makefile
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/common/compat/Makefile 2007-01-08 15:19:20.000000000 +0100
|
|
+++ 2007-01-08/xen/common/compat/Makefile 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -2,8 +2,10 @@ obj-y += domain.o
|
|
obj-y += kernel.o
|
|
obj-y += memory.o
|
|
obj-y += multicall.o
|
|
+obj-y += sysctl.o
|
|
obj-y += xlat.o
|
|
|
|
# extra dependencies
|
|
kernel.o: ../kernel.c
|
|
multicall.o: ../multicall.c
|
|
+sysctl.o: ../sysctl.c
|
|
Index: 2007-01-08/xen/common/compat/sysctl.c
|
|
===================================================================
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
|
+++ 2007-01-08/xen/common/compat/sysctl.c 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -0,0 +1,102 @@
|
|
+/******************************************************************************
|
|
+ * compat/sysctl.c
|
|
+ */
|
|
+
|
|
+#include <xen/config.h>
|
|
+#include <compat/sysctl.h>
|
|
+#include <xen/domain.h>
|
|
+#include <xen/guest_access.h>
|
|
+#include <xen/perfc.h>
|
|
+#include <xen/trace.h>
|
|
+
|
|
+DEFINE_XEN_GUEST_HANDLE(compat_sysctl_t);
|
|
+#define xen_sysctl compat_sysctl
|
|
+#define xen_sysctl_t compat_sysctl_t
|
|
+#define do_sysctl(h) compat_sysctl(_##h)
|
|
+#define arch_do_sysctl(x, h) arch_compat_sysctl(x, _##h)
|
|
+
|
|
+#define xen_sysctl_readconsole compat_sysctl_readconsole
|
|
+#define xen_sysctl_readconsole_t compat_sysctl_readconsole_t
|
|
+
|
|
+static int compat_tb_control(struct compat_sysctl_tbuf_op *cmp_tbc)
|
|
+{
|
|
+ struct xen_sysctl_tbuf_op nat_tbc;
|
|
+ int ret;
|
|
+
|
|
+#define XLAT_ctl_cpumap_HNDL_bitmap(_d_, _s_) \
|
|
+ guest_from_compat_handle((_d_)->bitmap, (_s_)->bitmap)
|
|
+ XLAT_sysctl_tbuf_op(&nat_tbc, cmp_tbc);
|
|
+#undef XLAT_ctl_cpumap_HNDL_bitmap
|
|
+ ret = tb_control(&nat_tbc);
|
|
+#define XLAT_ctl_cpumap_HNDL_bitmap(_d_, _s_) ((void)0)
|
|
+ XLAT_sysctl_tbuf_op(cmp_tbc, &nat_tbc);
|
|
+#undef XLAT_ctl_cpumap_HNDL_bitmap
|
|
+ return ret;
|
|
+}
|
|
+#define xen_sysctl_tbuf_op compat_sysctl_tbuf_op
|
|
+#define xen_sysctl_tbuf_op_t compat_sysctl_tbuf_op_t
|
|
+#define tb_control(p) compat_tb_control(p)
|
|
+
|
|
+#define xen_sysctl_sched_id compat_sysctl_sched_id
|
|
+#define xen_sysctl_sched_id_t compat_sysctl_sched_id_t
|
|
+
|
|
+static void compat_getdomaininfo(struct domain *d, struct compat_domctl_getdomaininfo *ci)
|
|
+{
|
|
+ struct xen_domctl_getdomaininfo ni;
|
|
+
|
|
+ getdomaininfo(d, &ni);
|
|
+ XLAT_domctl_getdomaininfo(ci, &ni);
|
|
+}
|
|
+#define xen_sysctl_getdomaininfolist compat_sysctl_getdomaininfolist
|
|
+#define xen_sysctl_getdomaininfolist_t compat_sysctl_getdomaininfolist_t
|
|
+#define xen_domctl_getdomaininfo compat_domctl_getdomaininfo
|
|
+#define xen_domctl_getdomaininfo_t compat_domctl_getdomaininfo_t
|
|
+#define getdomaininfo(d, i) compat_getdomaininfo(d, i)
|
|
+
|
|
+#ifdef PERF_COUNTERS
|
|
+static int compat_perfc_control(struct compat_sysctl_perfc_op *cmp_pc)
|
|
+{
|
|
+ CHECK_sysctl_perfc_desc;
|
|
+ CHECK_TYPE(sysctl_perfc_val);
|
|
+ struct xen_sysctl_perfc_op nat_pc;
|
|
+ int ret;
|
|
+
|
|
+#define XLAT_sysctl_perfc_op_HNDL_desc(_d_, _s_) \
|
|
+ guest_from_compat_handle((_d_)->desc, (_s_)->desc)
|
|
+#define XLAT_sysctl_perfc_op_HNDL_val(_d_, _s_) \
|
|
+ guest_from_compat_handle((_d_)->val, (_s_)->val)
|
|
+ XLAT_sysctl_perfc_op(&nat_pc, cmp_pc);
|
|
+#undef XLAT_sysctl_perfc_op_HNDL_val
|
|
+#undef XLAT_sysctl_perfc_op_HNDL_desc
|
|
+ ret = perfc_control(&nat_pc);
|
|
+#define XLAT_sysctl_perfc_op_HNDL_desc(_d_, _s_)
|
|
+#define XLAT_sysctl_perfc_op_HNDL_val(_d_, _s_)
|
|
+ XLAT_sysctl_perfc_op(cmp_pc, &nat_pc);
|
|
+#undef XLAT_sysctl_perfc_op_HNDL_val
|
|
+#undef XLAT_sysctl_perfc_op_HNDL_desc
|
|
+ return ret;
|
|
+}
|
|
+#define xen_sysctl_perfc_op compat_sysctl_perfc_op
|
|
+#define xen_sysctl_perfc_op_t compat_sysctl_perfc_op_t
|
|
+#define perfc_control(p) compat_perfc_control(p)
|
|
+#endif
|
|
+
|
|
+#define COMPAT
|
|
+#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
|
|
+#define _u_sysctl u_sysctl
|
|
+#undef guest_handle_cast
|
|
+#define guest_handle_cast compat_handle_cast
|
|
+#define copy_to_xxx_offset copy_to_compat_offset
|
|
+typedef int ret_t;
|
|
+
|
|
+#include "../sysctl.c"
|
|
+
|
|
+/*
|
|
+ * Local variables:
|
|
+ * mode: C
|
|
+ * c-set-style: "BSD"
|
|
+ * c-basic-offset: 4
|
|
+ * tab-width: 4
|
|
+ * indent-tabs-mode: nil
|
|
+ * End:
|
|
+ */
|
|
Index: 2007-01-08/xen/common/sysctl.c
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/common/sysctl.c 2007-01-08 15:04:23.000000000 +0100
|
|
+++ 2007-01-08/xen/common/sysctl.c 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -21,14 +21,17 @@
|
|
#include <asm/current.h>
|
|
#include <public/sysctl.h>
|
|
|
|
-extern long arch_do_sysctl(
|
|
+#ifndef COMPAT
|
|
+typedef long ret_t;
|
|
+#define copy_to_xxx_offset copy_to_guest_offset
|
|
+#endif
|
|
+
|
|
+extern ret_t arch_do_sysctl(
|
|
struct xen_sysctl *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
|
|
-extern void getdomaininfo(
|
|
- struct domain *d, struct xen_domctl_getdomaininfo *info);
|
|
|
|
-long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
|
|
+ret_t do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
|
|
{
|
|
- long ret = 0;
|
|
+ ret_t ret = 0;
|
|
struct xen_sysctl curop, *op = &curop;
|
|
static DEFINE_SPINLOCK(sysctl_lock);
|
|
|
|
@@ -98,8 +101,8 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
|
|
|
|
put_domain(d);
|
|
|
|
- if ( copy_to_guest_offset(op->u.getdomaininfolist.buffer,
|
|
- num_domains, &info, 1) )
|
|
+ if ( copy_to_xxx_offset(op->u.getdomaininfolist.buffer,
|
|
+ num_domains, &info, 1) )
|
|
{
|
|
ret = -EFAULT;
|
|
break;
|
|
@@ -123,7 +126,6 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
|
|
#ifdef PERF_COUNTERS
|
|
case XEN_SYSCTL_perfc_op:
|
|
{
|
|
- extern int perfc_control(xen_sysctl_perfc_op_t *);
|
|
ret = perfc_control(&op->u.perfc_op);
|
|
if ( copy_to_guest(u_sysctl, op, 1) )
|
|
ret = -EFAULT;
|
|
Index: 2007-01-08/xen/include/xen/domain.h
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/include/xen/domain.h 2007-01-08 15:04:23.000000000 +0100
|
|
+++ 2007-01-08/xen/include/xen/domain.h 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -11,6 +11,10 @@ struct vcpu *alloc_idle_vcpu(unsigned in
|
|
struct domain *alloc_domain(domid_t domid);
|
|
void free_domain(struct domain *d);
|
|
|
|
+struct xen_domctl_getdomaininfo;
|
|
+void getdomaininfo(
|
|
+ struct domain *d, struct xen_domctl_getdomaininfo *info);
|
|
+
|
|
/*
|
|
* Arch-specifics.
|
|
*/
|
|
Index: 2007-01-08/xen/include/xen/perfc.h
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/include/xen/perfc.h 2007-01-08 15:04:23.000000000 +0100
|
|
+++ 2007-01-08/xen/include/xen/perfc.h 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -102,6 +102,9 @@ extern struct perfcounter perfcounters;
|
|
#else
|
|
#define perfc_incr_histo(_x,_v,_n) ((void)0)
|
|
#endif
|
|
+
|
|
+struct xen_sysctl_perfc_op;
|
|
+int perfc_control(struct xen_sysctl_perfc_op *);
|
|
|
|
#else /* PERF_COUNTERS */
|
|
|
|
Index: 2007-01-08/xen/include/xlat.lst
|
|
===================================================================
|
|
--- 2007-01-08.orig/xen/include/xlat.lst 2007-01-08 15:20:29.000000000 +0100
|
|
+++ 2007-01-08/xen/include/xlat.lst 2007-01-08 15:20:32.000000000 +0100
|
|
@@ -10,6 +10,8 @@
|
|
! trap_info arch-@arch@/xen.h
|
|
! vcpu_guest_context arch-@arch@/xen.h
|
|
? acm_getdecision acm_ops.h
|
|
+! ctl_cpumap domctl.h
|
|
+! domctl_getdomaininfo domctl.h
|
|
? evtchn_alloc_unbound event_channel.h
|
|
? evtchn_bind_interdomain event_channel.h
|
|
? evtchn_bind_ipi event_channel.h
|
|
@@ -37,6 +39,9 @@
|
|
! sched_poll sched.h
|
|
? sched_remote_shutdown sched.h
|
|
? sched_shutdown sched.h
|
|
+? sysctl_perfc_desc sysctl.h
|
|
+! sysctl_perfc_op sysctl.h
|
|
+! sysctl_tbuf_op sysctl.h
|
|
! vcpu_runstate_info vcpu.h
|
|
? xenoprof_init xenoprof.h
|
|
? xenoprof_passive xenoprof.h
|