patch-2.3.12 linux/include/asm-i386/desc.h

Next file: linux/include/asm-i386/fixmap.h
Previous file: linux/include/asm-i386/apic.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.11/linux/include/asm-i386/desc.h linux/include/asm-i386/desc.h
@@ -69,17 +69,28 @@
 extern void set_ldt_desc(unsigned int n, void *addr, unsigned int size);
 extern void set_tss_desc(unsigned int n, void *addr);
 
+extern inline void clear_LDT(void)
+{
+	int cpu = smp_processor_id();
+	set_ldt_desc(cpu, &default_ldt, 1);
+	__load_LDT(cpu);
+}
+
 /*
  * load one particular LDT into the current CPU
  */
 extern inline void load_LDT (struct mm_struct *mm)
 {
 	int cpu = smp_processor_id();
+	void *segments = mm->segments;
+	int count = LDT_ENTRIES;
 
-	if (mm->segments)
-		set_ldt_desc(cpu, mm->segments, LDT_ENTRIES);
-	else
-		set_ldt_desc(cpu, &default_ldt, 1);
+	if (!segments) {
+		segments = &default_ldt;
+		count = 1;
+	}
+		
+	set_ldt_desc(cpu, segments, count);
 	__load_LDT(cpu);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)