Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jun 2005 02:11:03 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 78508 for review
Message-ID:  <200506140211.j5E2B3d8043223@repoman.freebsd.org>

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

Change 78508 by peter@peter_melody on 2005/06/14 02:10:43

	clean up ldt goop

Affected files ...

.. //depot/projects/hammer/libexec/rtld-elf/i386/reloc.c#9 edit

Differences ...

==== //depot/projects/hammer/libexec/rtld-elf/i386/reloc.c#9 (text+ko) ====

@@ -327,8 +327,6 @@
 allocate_initial_tls(Obj_Entry *objs)
 {
     void* tls;
-    union descriptor ldt;
-    int error, sel;
 
     /*
      * Fix the size of the static TLS block by using the maximum
@@ -337,21 +335,7 @@
      */
     tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
     tls = allocate_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr));
-    error = i386_set_gsbase(tls);
-    if (error < 0) {
-	memset(&ldt, 0, sizeof(ldt));
-	ldt.sd.sd_lolimit = 0xffff;	/* 4G limit */
-	ldt.sd.sd_lobase = ((Elf_Addr)tls) & 0xffffff;
-	ldt.sd.sd_type = SDT_MEMRWA;
-	ldt.sd.sd_dpl = SEL_UPL;
-	ldt.sd.sd_p = 1;		/* present */
-	ldt.sd.sd_hilimit = 0xf;	/* 4G limit */
-	ldt.sd.sd_def32 = 1;	/* 32 bit */
-	ldt.sd.sd_gran = 1;		/* limit in pages */
-	ldt.sd.sd_hibase = (((Elf_Addr)tls) >> 24) & 0xff;
-	sel = i386_set_ldt(LDT_AUTO_ALLOC, &ldt, 1);
-	__asm __volatile("movl %0,%%gs" : : "rm" ((sel << 3) | 7));
-    }
+    i386_set_gsbase(tls);
 }
 
 /* GNU ABI */



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