Found yet another set of accessor functions for descriptors that really
belongs in desc.h - move it there.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.13/arch/i386/kernel/process.c
==================================================================---
linux-2.6.13.orig/arch/i386/kernel/process.c 2005-08-08 20:47:32.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/process.c 2005-08-08 20:53:57.000000000 -0700
@@ -898,26 +898,6 @@
return 0;
}
-/*
- * Get the current Thread-Local Storage area:
- */
-
-#define GET_BASE(desc) ( \
- (((desc)->a >> 16) & 0x0000ffff) | \
- (((desc)->b << 16) & 0x00ff0000) | \
- ( (desc)->b & 0xff000000) )
-
-#define GET_LIMIT(desc) ( \
- ((desc)->a & 0x0ffff) | \
- ((desc)->b & 0xf0000) )
-
-#define GET_32BIT(desc) (((desc)->b >> 22) & 1)
-#define GET_CONTENTS(desc) (((desc)->b >> 10) & 3)
-#define GET_WRITABLE(desc) (((desc)->b >> 9) & 1)
-#define GET_LIMIT_PAGES(desc) (((desc)->b >> 23) & 1)
-#define GET_PRESENT(desc) (((desc)->b >> 15) & 1)
-#define GET_USEABLE(desc) (((desc)->b >> 20) & 1)
-
asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
{
struct user_desc info;
@@ -934,7 +914,7 @@
desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
info.entry_number = idx;
- info.base_addr = GET_BASE(desc);
+ info.base_addr = get_desc_base(desc);
info.limit = GET_LIMIT(desc);
info.seg_32bit = GET_32BIT(desc);
info.contents = GET_CONTENTS(desc);
Index: linux-2.6.13/arch/i386/kernel/ptrace.c
==================================================================---
linux-2.6.13.orig/arch/i386/kernel/ptrace.c 2005-08-08 20:48:06.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/ptrace.c 2005-08-08 20:55:03.000000000 -0700
@@ -285,33 +285,13 @@
struct user_desc info;
struct desc_struct *desc;
-/*
- * Get the current Thread-Local Storage area:
- */
-
-#define GET_BASE(desc) ( \
- (((desc)->a >> 16) & 0x0000ffff) | \
- (((desc)->b << 16) & 0x00ff0000) | \
- ( (desc)->b & 0xff000000) )
-
-#define GET_LIMIT(desc) ( \
- ((desc)->a & 0x0ffff) | \
- ((desc)->b & 0xf0000) )
-
-#define GET_32BIT(desc) (((desc)->b >> 22) & 1)
-#define GET_CONTENTS(desc) (((desc)->b >> 10) & 3)
-#define GET_WRITABLE(desc) (((desc)->b >> 9) & 1)
-#define GET_LIMIT_PAGES(desc) (((desc)->b >> 23) & 1)
-#define GET_PRESENT(desc) (((desc)->b >> 15) & 1)
-#define GET_USEABLE(desc) (((desc)->b >> 20) & 1)
-
if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
return -EINVAL;
desc = child->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
info.entry_number = idx;
- info.base_addr = GET_BASE(desc);
+ info.base_addr = get_desc_base(desc);
info.limit = GET_LIMIT(desc);
info.seg_32bit = GET_32BIT(desc);
info.contents = GET_CONTENTS(desc);
Index: linux-2.6.13/include/asm-i386/desc.h
==================================================================---
linux-2.6.13.orig/include/asm-i386/desc.h 2005-08-08 20:51:54.000000000 -0700
+++ linux-2.6.13/include/asm-i386/desc.h 2005-08-08 20:54:35.000000000 -0700
@@ -184,6 +184,21 @@
put_cpu();
}
+/*
+ * Get the current Thread-Local Storage area:
+ */
+
+#define GET_LIMIT(desc) ( \
+ ((desc)->a & 0x0ffff) | \
+ ((desc)->b & 0xf0000) )
+
+#define GET_32BIT(desc) (((desc)->b >> 22) & 1)
+#define GET_CONTENTS(desc) (((desc)->b >> 10) & 3)
+#define GET_WRITABLE(desc) (((desc)->b >> 9) & 1)
+#define GET_LIMIT_PAGES(desc) (((desc)->b >> 23) & 1)
+#define GET_PRESENT(desc) (((desc)->b >> 15) & 1)
+#define GET_USEABLE(desc) (((desc)->b >> 20) & 1)
+
static inline unsigned long get_desc_base(struct desc_struct *desc)
{
unsigned long base;