public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] x86: use get_desc_base()
@ 2009-07-18 15:08 Akinobu Mita
  2009-07-18 15:09 ` [PATCH 2/4] x86: remove unused patch_espfix_desc() Akinobu Mita
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Akinobu Mita @ 2009-07-18 15:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, mingo, hpa, x86

Use get_desc_base() to get the base address in desc_struct

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 arch/x86/kernel/doublefault_32.c |    4 +---
 arch/x86/kernel/step.c           |    9 ++++-----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
index b4f14c6..37250fe 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault_32.c
@@ -27,9 +27,7 @@ static void doublefault_fn(void)
 
 	if (ptr_ok(gdt)) {
 		gdt += GDT_ENTRY_TSS << 3;
-		tss = *(u16 *)(gdt+2);
-		tss += *(u8 *)(gdt+4) << 16;
-		tss += *(u8 *)(gdt+7) << 24;
+		tss = get_desc_base((struct desc_struct *)gdt);
 		printk(KERN_EMERG "double fault, tss at %08lx\n", tss);
 
 		if (ptr_ok(tss)) {
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index e8b9863..3149032 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -4,6 +4,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/ptrace.h>
+#include <asm/desc.h>
 
 unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs)
 {
@@ -23,7 +24,7 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re
 	 * and APM bios ones we just ignore here.
 	 */
 	if ((seg & SEGMENT_TI_MASK) == SEGMENT_LDT) {
-		u32 *desc;
+		struct desc_struct *desc;
 		unsigned long base;
 
 		seg &= ~7UL;
@@ -33,12 +34,10 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re
 			addr = -1L; /* bogus selector, access would fault */
 		else {
 			desc = child->mm->context.ldt + seg;
-			base = ((desc[0] >> 16) |
-				((desc[1] & 0xff) << 16) |
-				(desc[1] & 0xff000000));
+			base = get_desc_base(desc);
 
 			/* 16-bit code segment? */
-			if (!((desc[1] >> 22) & 1))
+			if (!desc->d)
 				addr &= 0xffff;
 			addr += base;
 		}
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-08-08 15:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-18 15:08 [PATCH 1/4] x86: use get_desc_base() Akinobu Mita
2009-07-18 15:09 ` [PATCH 2/4] x86: remove unused patch_espfix_desc() Akinobu Mita
2009-07-20 12:01   ` [tip:x86/asm] x86: Remove " tip-bot for Akinobu Mita
2009-07-18 15:11 ` [PATCH 3/4] x86: introduce set_desc_base() and set_desc_limit() Akinobu Mita
2009-07-20 12:01   ` [tip:x86/asm] x86: Introduce " tip-bot for Akinobu Mita
2009-07-18 15:12 ` [PATCH 4/4] x86: introduce GDT_ENTRY_INIT() Akinobu Mita
2009-07-20 12:01   ` [tip:x86/asm] x86: Introduce GDT_ENTRY_INIT() tip-bot for Akinobu Mita
2009-08-03  6:20     ` Ingo Molnar
2009-08-03  6:27       ` H. Peter Anvin
2009-08-03 15:11         ` Akinobu Mita
2009-08-03 15:17           ` H. Peter Anvin
2009-08-04 12:18             ` Ingo Molnar
2009-08-08 15:48   ` tip-bot for Akinobu Mita
2009-07-20 12:01 ` [tip:x86/asm] x86: Use get_desc_base() tip-bot for Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox