[Devel] [PATCH 13/30] cr: i386 LDT support

Alexey Dobriyan adobriyan at gmail.com
Thu Apr 9 19:36:25 PDT 2009


FIXME: LDT actual restoration

Signed-off-by: Alexey Dobriyan <adobriyan at gmail.com>
---

 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;
 }
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list