diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 14:10:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 14:10:41 -0400 |
commit | ac3ee84c604502240122c47b52f0542ec8774f15 (patch) | |
tree | fa74b50e310af6cef3298a052514b2d42b260d6b /arch/x86/kernel/cpu/common.c | |
parent | 90b9a32d8f441369b2f97a765d2d957b531eb653 (diff) | |
parent | 4fe1da4ebc18c4c42fa56c228447f68033fce5f0 (diff) |
Merge branch 'dbg-early-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb
* 'dbg-early-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
echi-dbgp: Add kernel debugger support for the usb debug port
earlyprintk,vga,kdb: Fix \b and \r for earlyprintk=vga with kdb
kgdboc: Add ekgdboc for early use of the kernel debugger
x86,early dr regs,kgdb: Allow kernel debugger early dr register access
x86,kgdb: Implement early hardware breakpoint debugging
x86, kgdb, init: Add early and late debug states
x86, kgdb: early trap init for early debug
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index c1c00d0b1692..cc83a002786e 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1084,6 +1084,20 @@ static void clear_all_debug_regs(void) | |||
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | #ifdef CONFIG_KGDB | ||
1088 | /* | ||
1089 | * Restore debug regs if using kgdbwait and you have a kernel debugger | ||
1090 | * connection established. | ||
1091 | */ | ||
1092 | static void dbg_restore_debug_regs(void) | ||
1093 | { | ||
1094 | if (unlikely(kgdb_connected && arch_kgdb_ops.correct_hw_break)) | ||
1095 | arch_kgdb_ops.correct_hw_break(); | ||
1096 | } | ||
1097 | #else /* ! CONFIG_KGDB */ | ||
1098 | #define dbg_restore_debug_regs() | ||
1099 | #endif /* ! CONFIG_KGDB */ | ||
1100 | |||
1087 | /* | 1101 | /* |
1088 | * cpu_init() initializes state that is per-CPU. Some data is already | 1102 | * cpu_init() initializes state that is per-CPU. Some data is already |
1089 | * initialized (naturally) in the bootstrap process, such as the GDT | 1103 | * initialized (naturally) in the bootstrap process, such as the GDT |
@@ -1174,18 +1188,8 @@ void __cpuinit cpu_init(void) | |||
1174 | load_TR_desc(); | 1188 | load_TR_desc(); |
1175 | load_LDT(&init_mm.context); | 1189 | load_LDT(&init_mm.context); |
1176 | 1190 | ||
1177 | #ifdef CONFIG_KGDB | 1191 | clear_all_debug_regs(); |
1178 | /* | 1192 | dbg_restore_debug_regs(); |
1179 | * If the kgdb is connected no debug regs should be altered. This | ||
1180 | * is only applicable when KGDB and a KGDB I/O module are built | ||
1181 | * into the kernel and you are using early debugging with | ||
1182 | * kgdbwait. KGDB will control the kernel HW breakpoint registers. | ||
1183 | */ | ||
1184 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) | ||
1185 | arch_kgdb_ops.correct_hw_break(); | ||
1186 | else | ||
1187 | #endif | ||
1188 | clear_all_debug_regs(); | ||
1189 | 1193 | ||
1190 | fpu_init(); | 1194 | fpu_init(); |
1191 | 1195 | ||
@@ -1239,6 +1243,7 @@ void __cpuinit cpu_init(void) | |||
1239 | #endif | 1243 | #endif |
1240 | 1244 | ||
1241 | clear_all_debug_regs(); | 1245 | clear_all_debug_regs(); |
1246 | dbg_restore_debug_regs(); | ||
1242 | 1247 | ||
1243 | /* | 1248 | /* |
1244 | * Force FPU initialization: | 1249 | * Force FPU initialization: |