diff options
author | Roland McGrath <roland@redhat.com> | 2008-01-30 07:30:50 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:50 -0500 |
commit | 7122ec8158b0f88befd94f4da8feae2c8d08d1b4 (patch) | |
tree | 17aa91add10e04cf27e93ba2b673fcb651ed39ba /arch/x86/kernel/step.c | |
parent | 5f76cb1f6c42e7575256595f85b8b97d84ec669e (diff) |
x86: single_step: share code
This removes the single-step code from ptrace_32.c and uses the step.c code
shared with the 64-bit kernel. The two versions of the code were nearly
identical already, so the shared code has only a couple of simple #ifdef's.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/step.c')
-rw-r--r-- | arch/x86/kernel/step.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c index 6a93b93f91f..6732272e347 100644 --- a/arch/x86/kernel/step.c +++ b/arch/x86/kernel/step.c | |||
@@ -5,12 +5,24 @@ | |||
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <linux/ptrace.h> | 6 | #include <linux/ptrace.h> |
7 | 7 | ||
8 | #ifdef CONFIG_X86_32 | ||
9 | static | ||
10 | #endif | ||
8 | unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs) | 11 | unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs) |
9 | { | 12 | { |
10 | unsigned long addr, seg; | 13 | unsigned long addr, seg; |
11 | 14 | ||
15 | #ifdef CONFIG_X86_64 | ||
12 | addr = regs->rip; | 16 | addr = regs->rip; |
13 | seg = regs->cs & 0xffff; | 17 | seg = regs->cs & 0xffff; |
18 | #else | ||
19 | addr = regs->eip; | ||
20 | seg = regs->xcs & 0xffff; | ||
21 | if (regs->eflags & X86_EFLAGS_VM) { | ||
22 | addr = (addr & 0xffff) + (seg << 4); | ||
23 | return addr; | ||
24 | } | ||
25 | #endif | ||
14 | 26 | ||
15 | /* | 27 | /* |
16 | * We'll assume that the code segments in the GDT | 28 | * We'll assume that the code segments in the GDT |
@@ -69,12 +81,14 @@ static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs) | |||
69 | case 0xf0: case 0xf2: case 0xf3: | 81 | case 0xf0: case 0xf2: case 0xf3: |
70 | continue; | 82 | continue; |
71 | 83 | ||
84 | #ifdef CONFIG_X86_64 | ||
72 | case 0x40 ... 0x4f: | 85 | case 0x40 ... 0x4f: |
73 | if (regs->cs != __USER_CS) | 86 | if (regs->cs != __USER_CS) |
74 | /* 32-bit mode: register increment */ | 87 | /* 32-bit mode: register increment */ |
75 | return 0; | 88 | return 0; |
76 | /* 64-bit mode: REX prefix */ | 89 | /* 64-bit mode: REX prefix */ |
77 | continue; | 90 | continue; |
91 | #endif | ||
78 | 92 | ||
79 | /* CHECKME: f2, f3 */ | 93 | /* CHECKME: f2, f3 */ |
80 | 94 | ||