diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2008-04-09 17:15:40 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-04-17 02:01:40 -0400 |
commit | 4eaddb4d7ec380abe95523ba0bdbbe8558f7fef4 (patch) | |
tree | fa7b3d5f464185b8c05fa4defeff98abee5c8a45 /arch/powerpc/kernel/entry_32.S | |
parent | 3dd82a1ea72438a545634b3ef90c53313d2caffa (diff) |
[POWERPC] Make Book-E debug handling SMP safe
global_dbcr0 needs to be a per cpu set of save areas instead of a single
global on all processors.
Also, we switch to using DBCR0_IDM to determine if the user space app is
being debugged as its a more consistent way. In the future we should
support features like hardware breakpoint and watchpoints which will
have DBCR0_IDM set but not necessarily DBCR0_IC (single step).
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_32.S')
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 69a91bd46115..84c868633068 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -110,9 +110,9 @@ transfer_to_handler: | |||
110 | stw r11,PT_REGS(r12) | 110 | stw r11,PT_REGS(r12) |
111 | #if defined(CONFIG_40x) || defined(CONFIG_BOOKE) | 111 | #if defined(CONFIG_40x) || defined(CONFIG_BOOKE) |
112 | /* Check to see if the dbcr0 register is set up to debug. Use the | 112 | /* Check to see if the dbcr0 register is set up to debug. Use the |
113 | single-step bit to do this. */ | 113 | internal debug mode bit to do this. */ |
114 | lwz r12,THREAD_DBCR0(r12) | 114 | lwz r12,THREAD_DBCR0(r12) |
115 | andis. r12,r12,DBCR0_IC@h | 115 | andis. r12,r12,DBCR0_IDM@h |
116 | beq+ 3f | 116 | beq+ 3f |
117 | /* From user and task is ptraced - load up global dbcr0 */ | 117 | /* From user and task is ptraced - load up global dbcr0 */ |
118 | li r12,-1 /* clear all pending debug events */ | 118 | li r12,-1 /* clear all pending debug events */ |
@@ -120,6 +120,12 @@ transfer_to_handler: | |||
120 | lis r11,global_dbcr0@ha | 120 | lis r11,global_dbcr0@ha |
121 | tophys(r11,r11) | 121 | tophys(r11,r11) |
122 | addi r11,r11,global_dbcr0@l | 122 | addi r11,r11,global_dbcr0@l |
123 | #ifdef CONFIG_SMP | ||
124 | rlwinm r9,r1,0,0,(31-THREAD_SHIFT) | ||
125 | lwz r9,TI_CPU(r9) | ||
126 | slwi r9,r9,3 | ||
127 | add r11,r11,r9 | ||
128 | #endif | ||
123 | lwz r12,0(r11) | 129 | lwz r12,0(r11) |
124 | mtspr SPRN_DBCR0,r12 | 130 | mtspr SPRN_DBCR0,r12 |
125 | lwz r12,4(r11) | 131 | lwz r12,4(r11) |
@@ -238,10 +244,10 @@ ret_from_syscall: | |||
238 | stw r11,_CCR(r1) | 244 | stw r11,_CCR(r1) |
239 | syscall_exit_cont: | 245 | syscall_exit_cont: |
240 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) | 246 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) |
241 | /* If the process has its own DBCR0 value, load it up. The single | 247 | /* If the process has its own DBCR0 value, load it up. The internal |
242 | step bit tells us that dbcr0 should be loaded. */ | 248 | debug mode bit tells us that dbcr0 should be loaded. */ |
243 | lwz r0,THREAD+THREAD_DBCR0(r2) | 249 | lwz r0,THREAD+THREAD_DBCR0(r2) |
244 | andis. r10,r0,DBCR0_IC@h | 250 | andis. r10,r0,DBCR0_IDM@h |
245 | bnel- load_dbcr0 | 251 | bnel- load_dbcr0 |
246 | #endif | 252 | #endif |
247 | #ifdef CONFIG_44x | 253 | #ifdef CONFIG_44x |
@@ -666,10 +672,10 @@ user_exc_return: /* r10 contains MSR_KERNEL here */ | |||
666 | 672 | ||
667 | restore_user: | 673 | restore_user: |
668 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) | 674 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) |
669 | /* Check whether this process has its own DBCR0 value. The single | 675 | /* Check whether this process has its own DBCR0 value. The internal |
670 | step bit tells us that dbcr0 should be loaded. */ | 676 | debug mode bit tells us that dbcr0 should be loaded. */ |
671 | lwz r0,THREAD+THREAD_DBCR0(r2) | 677 | lwz r0,THREAD+THREAD_DBCR0(r2) |
672 | andis. r10,r0,DBCR0_IC@h | 678 | andis. r10,r0,DBCR0_IDM@h |
673 | bnel- load_dbcr0 | 679 | bnel- load_dbcr0 |
674 | #endif | 680 | #endif |
675 | 681 | ||
@@ -879,6 +885,12 @@ load_dbcr0: | |||
879 | mfspr r10,SPRN_DBCR0 | 885 | mfspr r10,SPRN_DBCR0 |
880 | lis r11,global_dbcr0@ha | 886 | lis r11,global_dbcr0@ha |
881 | addi r11,r11,global_dbcr0@l | 887 | addi r11,r11,global_dbcr0@l |
888 | #ifdef CONFIG_SMP | ||
889 | rlwinm r9,r1,0,0,(31-THREAD_SHIFT) | ||
890 | lwz r9,TI_CPU(r9) | ||
891 | slwi r9,r9,3 | ||
892 | add r11,r11,r9 | ||
893 | #endif | ||
882 | stw r10,0(r11) | 894 | stw r10,0(r11) |
883 | mtspr SPRN_DBCR0,r0 | 895 | mtspr SPRN_DBCR0,r0 |
884 | lwz r10,4(r11) | 896 | lwz r10,4(r11) |
@@ -891,7 +903,7 @@ load_dbcr0: | |||
891 | .section .bss | 903 | .section .bss |
892 | .align 4 | 904 | .align 4 |
893 | global_dbcr0: | 905 | global_dbcr0: |
894 | .space 8 | 906 | .space 8*NR_CPUS |
895 | .previous | 907 | .previous |
896 | #endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ | 908 | #endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ |
897 | 909 | ||