[PATCH 13/30] cr: i386 LDT support

From: Alexey Dobriyan
Date: Thu Apr 09 2009 - 22:39:32 EST


FIXME: LDT actual restoration

Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
---

kernel/cr/cr-x86_32.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

--- a/kernel/cr/cr-x86_32.c
+++ b/kernel/cr/cr-x86_32.c
@@ -1,6 +1,7 @@
/* Copyright (C) 2000-2009 Parallels Holdings, Ltd. */
#include <linux/sched.h>
#include <asm/i387.h>
+#include <asm/ldt.h>

#include <linux/cr.h>
#include "cr.h"
@@ -226,21 +227,25 @@ int cr_arch_restore_task_struct(struct task_struct *tsk, struct cr_image_task_st

int cr_arch_check_mm_struct(struct mm_struct *mm)
{
- mutex_lock(&mm->context.lock);
- if (mm->context.ldt || mm->context.size != 0) {
- mutex_unlock(&mm->context.lock);
- WARN_ON(1);
- return -EINVAL;
- }
return 0;
}

unsigned int cr_arch_len_mm_struct(struct mm_struct *mm)
{
- return 0;
+ unsigned int len;
+
+ mutex_lock(&mm->context.lock);
+ len = mm->context.size * LDT_ENTRY_SIZE;
+ mutex_unlock(&mm->context.lock);
+ return len;
}

int cr_arch_dump_mm_struct(struct cr_context *ctx, struct mm_struct *mm)
{
- return 0;
+ int rv;
+
+ mutex_lock(&mm->context.lock);
+ rv = cr_write(ctx, mm->context.ldt, mm->context.size * LDT_ENTRY_SIZE);
+ mutex_unlock(&mm->context.lock);
+ return rv;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/