Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2006 10:01:09 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 100128 for review
Message-ID:  <200606271001.k5RA19aY017998@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100128

Change 100128 by rdivacky@rdivacky_witten on 2006/06/27 10:00:32

	Non-functional change - add some real args handler and comment to 
	linux_set_thread_area(), note that this is actually a regression and WIP.

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#5 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#5 (text+ko) ====

@@ -848,11 +848,33 @@
 int
 linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args)
 {
-	/*
-	 * Return an error code instead of raising a SIGSYS so that
-	 * the caller will fall back to simpler LDT methods.
+	struct l_user_desc info;
+	int error;
+	int idx;
+
+	error = copyin(args->desc, &info, sizeof(struct l_user_desc));
+	if (error)
+		return (error);
+
+	idx = info.entry_number;
+	/* Semantics of linux version: every thread in the system has array
+	 * of 3 tls descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. This
+	 * syscall loads one of the selected tls decriptors with a value
+	 * and also loads GDT descriptors 6, 7 and 8 with the content of the per-thread 
+	 * descriptors.
+	 *
+	 * Semantics of fbsd version: I think we can ignore that linux has 3 per-thread
+	 * descriptors and use just the 1st one (TODO: davidxu will report us where we get this).
+	 * The tls_array[] is used only in set/get-thread_area() syscalls and for loading the
+	 * GDT descriptors. In fbsd we use just one GDT descriptor for TLS so we will load
+	 * just one.
 	 */
-	return (ENOSYS);
+
+	/* we support just GLIBC TLS now */
+	if (idx != 6 && idx != -1)
+		return (EINVAL);
+   
+	return (0);
 }
 
 int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606271001.k5RA19aY017998>