aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/wait.c
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-11-22 13:00:21 +0000
committerKeir Fraser <keir@xen.org>2011-11-22 13:00:21 +0000
commit28909bdbbe426a7ae3621f82d3dc9d7306bb5e65 (patch)
tree7c4c25e98882bc06c117dbc181194cc786e7f64d /xen/common/wait.c
parent07b6d6bea1b50036fa5df34b946d54851b70e739 (diff)
downloadxen-28909bdbbe426a7ae3621f82d3dc9d7306bb5e65.tar.gz
xen-28909bdbbe426a7ae3621f82d3dc9d7306bb5e65.tar.bz2
xen-28909bdbbe426a7ae3621f82d3dc9d7306bb5e65.zip
x86,waitqueue: Allocate whole page for shadow stack.
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/wait.c')
-rw-r--r--xen/common/wait.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/xen/common/wait.c b/xen/common/wait.c
index a2c7640107..b5b27a7ae0 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -33,7 +33,7 @@ struct waitqueue_vcpu {
* hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
*/
void *esp;
- char stack[3000];
+ char *stack;
#endif
};
@@ -45,6 +45,15 @@ int init_waitqueue_vcpu(struct vcpu *v)
if ( wqv == NULL )
return -ENOMEM;
+#ifdef CONFIG_X86
+ wqv->stack = alloc_xenheap_page();
+ if ( wqv->stack == NULL )
+ {
+ xfree(wqv);
+ return -ENOMEM;
+ }
+#endif
+
INIT_LIST_HEAD(&wqv->list);
wqv->vcpu = v;
@@ -62,6 +71,9 @@ void destroy_waitqueue_vcpu(struct vcpu *v)
return;
BUG_ON(!list_empty(&wqv->list));
+#ifdef CONFIG_X86
+ free_xenheap_page(wqv->stack);
+#endif
xfree(wqv);
v->waitqueue_vcpu = NULL;
@@ -114,7 +126,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
: "=S" (wqv->esp)
: "c" (cpu_info), "D" (wqv->stack)
: "memory" );
- BUG_ON((cpu_info - (char *)wqv->esp) > sizeof(wqv->stack));
+ BUG_ON((cpu_info - (char *)wqv->esp) > PAGE_SIZE);
}
static void __finish_wait(struct waitqueue_vcpu *wqv)