kgdb.c (82ffd0454bd9bd57780966d47bfd56d579dd4fb3) | kgdb.c (ed1cd6deb013a11959d17a94e35ce159197632da) |
---|---|
1/* 2 * PowerPC backend to the KGDB stub. 3 * 4 * 1998 (c) Michael AK Tesch (tesch@cs.wisc.edu) 5 * Copyright (C) 2003 Timesys Corporation. 6 * Copyright (C) 2004-2006 MontaVista Software, Inc. 7 * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com) 8 * PPC32 support restored by Vitaly Wool <vwool@ru.mvista.com> and --- 137 unchanged lines hidden (view full) --- 146 return 0; 147 148 if (*(u32 *)regs->nip == BREAK_INSTR) 149 regs->nip += BREAK_INSTR_SIZE; 150 151 return 1; 152} 153 | 1/* 2 * PowerPC backend to the KGDB stub. 3 * 4 * 1998 (c) Michael AK Tesch (tesch@cs.wisc.edu) 5 * Copyright (C) 2003 Timesys Corporation. 6 * Copyright (C) 2004-2006 MontaVista Software, Inc. 7 * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com) 8 * PPC32 support restored by Vitaly Wool <vwool@ru.mvista.com> and --- 137 unchanged lines hidden (view full) --- 146 return 0; 147 148 if (*(u32 *)regs->nip == BREAK_INSTR) 149 regs->nip += BREAK_INSTR_SIZE; 150 151 return 1; 152} 153 |
154static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info); | |
155static int kgdb_singlestep(struct pt_regs *regs) 156{ | 154static int kgdb_singlestep(struct pt_regs *regs) 155{ |
157 struct thread_info *thread_info, *exception_thread_info; 158 struct thread_info *backup_current_thread_info = 159 this_cpu_ptr(&kgdb_thread_info); 160 | |
161 if (user_mode(regs)) 162 return 0; 163 | 156 if (user_mode(regs)) 157 return 0; 158 |
164 /* 165 * On Book E and perhaps other processors, singlestep is handled on 166 * the critical exception stack. This causes current_thread_info() 167 * to fail, since it it locates the thread_info by masking off 168 * the low bits of the current stack pointer. We work around 169 * this issue by copying the thread_info from the kernel stack 170 * before calling kgdb_handle_exception, and copying it back 171 * afterwards. On most processors the copy is avoided since 172 * exception_thread_info == thread_info. 173 */ 174 thread_info = (struct thread_info *)(regs->gpr[1] & ~(THREAD_SIZE-1)); 175 exception_thread_info = current_thread_info(); 176 177 if (thread_info != exception_thread_info) { 178 /* Save the original current_thread_info. */ 179 memcpy(backup_current_thread_info, exception_thread_info, sizeof *thread_info); 180 memcpy(exception_thread_info, thread_info, sizeof *thread_info); 181 } 182 | |
183 kgdb_handle_exception(0, SIGTRAP, 0, regs); 184 | 159 kgdb_handle_exception(0, SIGTRAP, 0, regs); 160 |
185 if (thread_info != exception_thread_info) 186 /* Restore current_thread_info lastly. */ 187 memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info); 188 | |
189 return 1; 190} 191 192static int kgdb_iabr_match(struct pt_regs *regs) 193{ 194 if (user_mode(regs)) 195 return 0; 196 --- 329 unchanged lines hidden --- | 161 return 1; 162} 163 164static int kgdb_iabr_match(struct pt_regs *regs) 165{ 166 if (user_mode(regs)) 167 return 0; 168 --- 329 unchanged lines hidden --- |