PERFORCE change 106886 for review

Roman Divacky rdivacky at FreeBSD.org
Fri Sep 29 06:57:45 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=106886

Change 106886 by rdivacky at rdivacky_witten on 2006/09/29 13:55:30

	Use the "base_addr" from the given descriptor instead of translating
	it to fbsd one and then back.

Affected files ...

.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#6 edit

Differences ...

==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#6 (text+ko) ====

@@ -635,7 +635,6 @@
 	if (args->flags & CLONE_SETTLS) {
    	   	struct l_user_desc info;
    	   	int idx;
-	   	int a[2];
 		struct segment_descriptor sd;
 
 	   	error = copyin((void *)td->td_frame->tf_rsi, &info, sizeof(struct l_user_desc));
@@ -660,28 +659,10 @@
 	   		   	return (error);
 		}
 
-		a[0] = LDT_entry_a(&info);
-		a[1] = LDT_entry_b(&info);
-
-		memcpy(&sd, &a, sizeof(a));
-#ifdef DEBUG
-	if (ldebug(clone))
-	   	printf("Segment created in clone with CLONE_SETTLS: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase,
-			sd.sd_hibase,
-			sd.sd_lolimit,
-			sd.sd_hilimit,
-			sd.sd_type,
-			sd.sd_dpl,
-			sd.sd_p,
-			sd.sd_xx,
-			sd.sd_def32,
-			sd.sd_gran);
-#endif
-
 		/* this is taken from amd64 version of cpu_set_user_tls() */
 		critical_enter();
 		/* set %gs */
-		td->td_pcb->pcb_gsbase = (register_t)((register_t)sd.sd_hibase << 24 | sd.sd_lobase);
+		td->td_pcb->pcb_gsbase = (register_t)info.base_addr;
 #if 0
 		wrmsr(MSR_KGSBASE, td->td_pcb->pcb_fsbase);
 #endif
@@ -1203,7 +1184,6 @@
 	struct l_user_desc info;
 	int error;
 	int idx;
-	int a[2];
 	struct segment_descriptor sd;
 
 	error = copyin(args->desc, &info, sizeof(struct l_user_desc));
@@ -1259,33 +1239,9 @@
 	if (error)
 		return (error);
 
-	if (LDT_empty(&info)) {
-		a[0] = 0;
-		a[1] = 0;
-	} else {
-		a[0] = LDT_entry_a(&info);
-		a[1] = LDT_entry_b(&info);
-	}
-
-	memcpy(&sd, &a, sizeof(a));
-#ifdef DEBUG
-	if (ldebug(set_thread_area))
-	   	printf("Segment created in set_thread_area: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase,
-			sd.sd_hibase,
-			sd.sd_lolimit,
-			sd.sd_hilimit,
-			sd.sd_type,
-			sd.sd_dpl,
-			sd.sd_p,
-			sd.sd_xx,
-			sd.sd_def32,
-			sd.sd_gran);
-#endif
-
-	/* this is taken from amd64 version of cpu_set_user_tls() */
 	critical_enter();
 	/* set %gs */
-	td->td_pcb->pcb_gsbase = (register_t)((register_t)sd.sd_hibase << 24 | sd.sd_lobase);
+	td->td_pcb->pcb_gsbase = (register_t)info.base_addr;
 	wrmsr(MSR_KGSBASE, td->td_pcb->pcb_gsbase);
 
 	critical_exit();


More information about the p4-projects mailing list