[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] [tls] use real_descriptor instead of descriptor
From: |
Flavio Cruz |
Subject: |
[PATCH] [tls] use real_descriptor instead of descriptor |
Date: |
Thu, 26 Jan 2023 01:49:43 -0500 |
Interface was changed in
https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=b379d5afdf65cce11426ab0349a3778b3fd632f5
where the signature of i386 RPCs are now using real_descriptor.
---
sysdeps/mach/hurd/i386/htl/pt-machdep.c | 14 +------------
sysdeps/mach/hurd/i386/tls.h | 27 +++++++++++--------------
2 files changed, 13 insertions(+), 28 deletions(-)
diff --git a/sysdeps/mach/hurd/i386/htl/pt-machdep.c
b/sysdeps/mach/hurd/i386/htl/pt-machdep.c
index de534582be..152ae9caef 100644
--- a/sysdeps/mach/hurd/i386/htl/pt-machdep.c
+++ b/sysdeps/mach/hurd/i386/htl/pt-machdep.c
@@ -23,19 +23,7 @@
#include <mach/i386/mach_i386.h>
#include <mach/mig_errors.h>
#include <mach/thread_status.h>
-
-#define HURD_TLS_DESC_DECL(desc, tcb) \
- struct descriptor desc = \
- { /* low word: */ \
- 0xffff /* limit 0..15 */ \
- | (((unsigned int) (tcb)) << 16) /* base 0..15 */
\
- , /* high word: */
\
- ((((unsigned int) (tcb)) >> 16) & 0xff) /* base 16..23 */
\
- | ((0x12 | 0x60 | 0x80) << 8) /* access = ACC_DATA_W|ACC_PL_U|ACC_P */ \
- | (0xf << 16) /* limit 16..19 */ \
- | ((4 | 8) << 20) /* granularity = SZ_32|SZ_G */
\
- | (((unsigned int) (tcb)) & 0xff000000) /* base 24..31 */
\
- }
+#include <tls.h>
int
__thread_set_pcsptp (thread_t thread,
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index a6ff0107d4..5447c9d9fa 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -56,9 +56,7 @@ typedef struct
/* Return tcbhead_t from a TLS segment descriptor. */
# define HURD_DESC_TLS(desc) \
({ \
- (tcbhead_t *) ( (desc->low_word >> 16) \
- | ((desc->high_word & 0xff) << 16) \
- | (desc->high_word & 0xff000000)); \
+ (tcbhead_t *) (desc->base_high << 24 | desc->base_med << 16 |
desc->base_low); \
})
/* Return 1 if TLS is not initialized yet. */
@@ -103,16 +101,15 @@ extern unsigned short __init1_desc;
# include <assert.h>
# define HURD_TLS_DESC_DECL(desc, tcb) \
- struct descriptor desc = \
- { /* low word: */ \
- 0xffff /* limit 0..15 */ \
- | (((unsigned int) (tcb)) << 16) /* base 0..15 */
\
- , /* high word: */
\
- ((((unsigned int) (tcb)) >> 16) & 0xff) /* base 16..23 */
\
- | ((0x12 | 0x60 | 0x80) << 8) /* access = ACC_DATA_W|ACC_PL_U|ACC_P */ \
- | (0xf << 16) /* limit 16..19 */ \
- | ((4 | 8) << 20) /* granularity = SZ_32|SZ_G */
\
- | (((unsigned int) (tcb)) & 0xff000000) /* base 24..31 */
\
+ struct real_descriptor desc =
\
+ { \
+ .limit_low = 0xffff, /* limit 0..15 */
\
+ .base_low = (uintptr_t) (tcb) & 0xffff, /* base 0..15 */
\
+ .base_med = (uintptr_t) (tcb) >> 16 & 0xff, /* base 16..23 */
\
+ .access = 0x12 | 0x60 | 0x80, /* ACC_DATA_W|ACC_PL_U|ACC_P */ \
+ .limit_high = 0xf, /* limit */ \
+ .granularity = 4 | 8, /* SZ_32|SZ_G */ \
+ .base_high = (uintptr_t) (tcb) >> 24 & 0xff /* base 24..31 */
\
}
# define HURD_SEL_LDT(sel) (__builtin_expect ((sel) & 4, 0))
@@ -283,7 +280,7 @@ out:
Note: this is expensive. */
# define THREAD_TCB(thread, thread_state) \
({ int __sel = (thread_state)->basic.gs; \
- struct descriptor __desc, *___desc = &__desc; \
+ struct real_descriptor __desc, *___desc = &__desc;
\
unsigned int __count = 1; \
kern_return_t __err; \
if (HURD_SEL_LDT (__sel)) \
@@ -333,7 +330,7 @@ _hurd_tls_fork (thread_t child, thread_t orig, struct
i386_thread_state *state)
if (sel == state->ds) /* _hurd_tls_init was never called. */
return 0;
- struct descriptor desc, *_desc = &desc;
+ struct real_descriptor desc, *_desc = &desc;
error_t err;
unsigned int count = 1;
--
2.39.0
- [PATCH] [tls] use real_descriptor instead of descriptor,
Flavio Cruz <=