step.c (f13bd3e7935f7020f7c622bf3f8cae8eee757a53) step.c (37cd9cf3dafed82f7cf905785883300f6ff7c818)
1/*
2 * x86 single-step support code, common to 32-bit and 64-bit.
3 */
4#include <linux/sched.h>
5#include <linux/mm.h>
6#include <linux/ptrace.h>
7
8#ifdef CONFIG_X86_32

--- 75 unchanged lines hidden (view full) ---

84 *eip_limit = seg_limit;
85 return ip + base;
86}
87#endif
88
89#ifdef CONFIG_X86_32
90static
91#endif
1/*
2 * x86 single-step support code, common to 32-bit and 64-bit.
3 */
4#include <linux/sched.h>
5#include <linux/mm.h>
6#include <linux/ptrace.h>
7
8#ifdef CONFIG_X86_32

--- 75 unchanged lines hidden (view full) ---

84 *eip_limit = seg_limit;
85 return ip + base;
86}
87#endif
88
89#ifdef CONFIG_X86_32
90static
91#endif
92unsigned long convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs)
92unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs)
93{
94 unsigned long addr, seg;
95
96 addr = regs->ip;
97 seg = regs->cs & 0xffff;
98 if (v8086_mode(regs)) {
99 addr = (addr & 0xffff) + (seg << 4);
100 return addr;

--- 30 unchanged lines hidden (view full) ---

131
132 return addr;
133}
134
135static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
136{
137 int i, copied;
138 unsigned char opcode[15];
93{
94 unsigned long addr, seg;
95
96 addr = regs->ip;
97 seg = regs->cs & 0xffff;
98 if (v8086_mode(regs)) {
99 addr = (addr & 0xffff) + (seg << 4);
100 return addr;

--- 30 unchanged lines hidden (view full) ---

131
132 return addr;
133}
134
135static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
136{
137 int i, copied;
138 unsigned char opcode[15];
139 unsigned long addr = convert_rip_to_linear(child, regs);
139 unsigned long addr = convert_ip_to_linear(child, regs);
140
141 copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
142 for (i = 0; i < copied; i++) {
143 switch (opcode[i]) {
144 /* popf and iret */
145 case 0x9d: case 0xcf:
146 return 1;
147

--- 140 unchanged lines hidden ---
140
141 copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
142 for (i = 0; i < copied; i++) {
143 switch (opcode[i]) {
144 /* popf and iret */
145 case 0x9d: case 0xcf:
146 return 1;
147

--- 140 unchanged lines hidden ---