aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPrasanna S. Panchamukhi <prasanna@in.ibm.com>2005-01-14 23:24:36 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-14 23:24:36 -0800
commita87732f39985c8bc44c42caa64ac97161ae4609e (patch)
tree514ba27e001e48bb7ffe817894f145ea34f13d0a /arch
parente0eabf37d0d67c0f132090d8f59f0307743a3084 (diff)
downloadhistory-a87732f39985c8bc44c42caa64ac97161ae4609e.tar.gz
[PATCH] x68: consolidate code segment base calculation
Calculating the base address of the segment is tricky and is used in several places as well. This patch moves this tricky part in a common place as suggested by Andi Kleen. Signed-of-by: Prasanna S Panchamukhi <prasanna@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/kprobes.c7
-rw-r--r--arch/i386/mm/fault.c4
2 files changed, 4 insertions, 7 deletions
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 1879a89d00acaf..50e3fedc53722e 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -31,6 +31,7 @@
#include <linux/spinlock.h>
#include <linux/preempt.h>
#include <asm/kdebug.h>
+#include <asm/desc.h>
/* kprobe_status settings */
#define KPROBE_HIT_ACTIVE 0x00000001
@@ -101,10 +102,8 @@ static int kprobe_handler(struct pt_regs *regs)
if ((regs->xcs & 4) && (current->mm)) {
lp = (unsigned long *) ((unsigned long)((regs->xcs >> 3) * 8)
+ (char *) current->mm->context.ldt);
- addr = (kprobe_opcode_t *) ((((*lp) >> 16 & 0x0000ffff)
- | (*(lp +1) & 0xff000000)
- | ((*(lp +1) << 16) & 0x00ff0000))
- + regs->eip - sizeof(kprobe_opcode_t));
+ addr = (kprobe_opcode_t *) (get_desc_base(lp) + regs->eip -
+ sizeof(kprobe_opcode_t));
} else {
addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));
}
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index e9928368e270fb..a509237c4815ed 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -112,9 +112,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
}
/* Decode the code segment base from the descriptor */
- base = (desc[0] >> 16) |
- ((desc[1] & 0xff) << 16) |
- (desc[1] & 0xff000000);
+ base = get_desc_base((unsigned long *)desc);
if (seg & (1<<2)) {
up(&current->mm->context.sem);