提交 254e0a6b 编写于 作者: A Akinobu Mita 提交者: Ingo Molnar

x86: Use get_desc_base()

Use get_desc_base() to get the base address in desc_struct
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
LKML-Reference: <20090718150853.GA11294@localhost.localdomain>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 78af08d9
...@@ -27,9 +27,7 @@ static void doublefault_fn(void) ...@@ -27,9 +27,7 @@ static void doublefault_fn(void)
if (ptr_ok(gdt)) { if (ptr_ok(gdt)) {
gdt += GDT_ENTRY_TSS << 3; gdt += GDT_ENTRY_TSS << 3;
tss = *(u16 *)(gdt+2); tss = get_desc_base((struct desc_struct *)gdt);
tss += *(u8 *)(gdt+4) << 16;
tss += *(u8 *)(gdt+7) << 24;
printk(KERN_EMERG "double fault, tss at %08lx\n", tss); printk(KERN_EMERG "double fault, tss at %08lx\n", tss);
if (ptr_ok(tss)) { if (ptr_ok(tss)) {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <asm/desc.h>
unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs) 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 ...@@ -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. * and APM bios ones we just ignore here.
*/ */
if ((seg & SEGMENT_TI_MASK) == SEGMENT_LDT) { if ((seg & SEGMENT_TI_MASK) == SEGMENT_LDT) {
u32 *desc; struct desc_struct *desc;
unsigned long base; unsigned long base;
seg &= ~7UL; seg &= ~7UL;
...@@ -33,12 +34,10 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re ...@@ -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 */ addr = -1L; /* bogus selector, access would fault */
else { else {
desc = child->mm->context.ldt + seg; desc = child->mm->context.ldt + seg;
base = ((desc[0] >> 16) | base = get_desc_base(desc);
((desc[1] & 0xff) << 16) |
(desc[1] & 0xff000000));
/* 16-bit code segment? */ /* 16-bit code segment? */
if (!((desc[1] >> 22) & 1)) if (!desc->d)
addr &= 0xffff; addr &= 0xffff;
addr += base; addr += base;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册