Re: [PATCH 2/3] i386: use x86_64's desc_def.h

From: Zachary Amsden
Date: Wed Jul 18 2007 - 12:31:16 EST


Rusty Russell wrote:
The main effect is to change the definition of "struct desc_struct" to
a union of more complex types.

Yay! Someone finally killed it. Every time I tried to kill it, I ended up off in the weeds chasing some bug.

diff -r 656f3ff2c9ce arch/i386/kernel/process.c
@@ -880,21 +880,8 @@ asmlinkage int sys_set_thread_area(struc
* 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)
+#define GET_CONTENTS(desc) (((desc)->raw32.b >> 10) & 3)
+#define GET_WRITABLE(desc) (((desc)->raw32.b >> 9) & 1)
diff -r 656f3ff2c9ce arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c Wed Jul 18 16:21:04 2007 +1000
+++ b/arch/i386/kernel/ptrace.c Wed Jul 18 16:21:06 2007 +1000
@@ -283,22 +283,8 @@ ptrace_get_thread_area(struct task_struc
/*
* 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)
+#define GET_CONTENTS(desc) (((desc)->raw32.b >> 10) & 3)
+#define GET_WRITABLE(desc) (((desc)->raw32.b >> 9) & 1)

You got rid of the duplicate definitions here, but then added new duplicates (GET_CONTENTS / WRITABLE). Can you stick them in desc.h?

Zach
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/