summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libc/inc')
-rw-r--r--usr/src/lib/libc/inc/thr_inlines.h12
-rw-r--r--usr/src/lib/libc/inc/thr_uberdata.h28
2 files changed, 35 insertions, 5 deletions
diff --git a/usr/src/lib/libc/inc/thr_inlines.h b/usr/src/lib/libc/inc/thr_inlines.h
index f7cdc6a6bd..66d811f25b 100644
--- a/usr/src/lib/libc/inc/thr_inlines.h
+++ b/usr/src/lib/libc/inc/thr_inlines.h
@@ -47,17 +47,19 @@
extern __GNU_INLINE ulwp_t *
_curthread(void)
{
-#if defined(__amd64)
ulwp_t *__value;
- __asm__ __volatile__("movq %%fs:0, %0" : "=r" (__value));
+ __asm__ __volatile__(
+#if defined(__amd64)
+ "movq %%fs:0, %0\n\t"
#elif defined(__i386)
- ulwp_t *__value;
- __asm__ __volatile__("movl %%gs:0, %0" : "=r" (__value));
+ "movl %%gs:0, %0\n\t"
#elif defined(__sparc)
- register ulwp_t *__value __asm__("g7");
+ ".register %%g7, #scratch\n\t"
+ "mov %%g7, %0\n\t"
#else
#error "port me"
#endif
+ : "=r" (__value));
return (__value);
}
diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h
index 42c08049b2..5f67e760e2 100644
--- a/usr/src/lib/libc/inc/thr_uberdata.h
+++ b/usr/src/lib/libc/inc/thr_uberdata.h
@@ -22,6 +22,9 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
#ifndef _THR_UBERDATA_H
#define _THR_UBERDATA_H
@@ -488,6 +491,28 @@ typedef struct {
#endif /* _SYSCALL32 */
/*
+ * As part of per-thread caching libumem (ptcumem), we add a small amount to the
+ * thread's uberdata to facilitate it. The tm_roots are the roots of linked
+ * lists which is used by libumem to chain together allocations. tm_size is used
+ * to track the total amount of data stored across those linked lists.
+ */
+#define NTMEMBASE 16
+
+typedef struct {
+ size_t tm_size;
+ void *tm_roots[NTMEMBASE];
+} tumem_t;
+
+#ifdef _SYSCALL32
+typedef struct {
+ uint32_t tm_size;
+ caddr32_t tm_roots[NTMEMBASE];
+} tumem32_t;
+#endif
+
+typedef void (*tmem_func_t)(void *, int);
+
+/*
* Maximum number of read locks allowed for one thread on one rwlock.
* This could be as large as INT_MAX, but the SUSV3 test suite would
* take an inordinately long time to complete. This is big enough.
@@ -653,6 +678,7 @@ typedef struct ulwp {
#if defined(sparc)
void *ul_unwind_ret; /* used only by _ex_clnup_handler() */
#endif
+ tumem_t ul_tmem; /* used only by umem */
} ulwp_t;
#define ul_cursig ul_cp.s.cursig /* deferred signal number */
@@ -1083,6 +1109,7 @@ typedef struct ulwp32 {
#if defined(sparc)
caddr32_t ul_unwind_ret; /* used only by _ex_clnup_handler() */
#endif
+ tumem32_t ul_tmem; /* used only by umem */
} ulwp32_t;
#define REPLACEMENT_SIZE32 ((size_t)&((ulwp32_t *)NULL)->ul_sigmask)
@@ -1205,6 +1232,7 @@ extern ulwp_t *find_lwp(thread_t);
extern void finish_init(void);
extern void update_sched(ulwp_t *);
extern void queue_alloc(void);
+extern void tmem_exit(void);
extern void tsd_exit(void);
extern void tsd_free(ulwp_t *);
extern void tls_setup(void);