@@ -46,6 +46,14 @@ void print_trace(void *data, unsigned long addr, int reliable)
46
46
(void * ) addr );
47
47
}
48
48
49
+ static void print_data (unsigned long base_addr , unsigned long word , int i )
50
+ {
51
+ if (i == 0 )
52
+ printk ("(%08lx:)\t%08lx" , base_addr + (i * 4 ), word );
53
+ else
54
+ printk (" %08lx:\t%08lx" , base_addr + (i * 4 ), word );
55
+ }
56
+
49
57
/* displays a short stack trace */
50
58
void show_stack (struct task_struct * task , unsigned long * esp , const char * loglvl )
51
59
{
@@ -99,22 +107,36 @@ void show_registers(struct pt_regs *regs)
99
107
printk ("\nStack: " );
100
108
show_stack (NULL , (unsigned long * )esp , KERN_EMERG );
101
109
110
+ if (esp < PAGE_OFFSET )
111
+ goto bad_stack ;
112
+
113
+ printk ("\n" );
114
+ for (i = -8 ; i < 24 ; i += 1 ) {
115
+ unsigned long word ;
116
+
117
+ if (__get_user (word , & ((unsigned long * )esp )[i ])) {
118
+ bad_stack :
119
+ printk (" Bad Stack value." );
120
+ break ;
121
+ }
122
+
123
+ print_data (esp , word , i );
124
+ }
125
+
102
126
printk ("\nCode: " );
103
127
if (regs -> pc < PAGE_OFFSET )
104
128
goto bad ;
105
129
106
- for (i = -24 ; i < 24 ; i ++ ) {
107
- unsigned char c ;
108
- if (__get_user (c , & ((unsigned char * )regs -> pc )[i ])) {
130
+ for (i = -6 ; i < 6 ; i += 1 ) {
131
+ unsigned long word ;
132
+
133
+ if (__get_user (word , & ((unsigned long * )regs -> pc )[i ])) {
109
134
bad :
110
135
printk (" Bad PC value." );
111
136
break ;
112
137
}
113
138
114
- if (i == 0 )
115
- printk ("(%02x) " , c );
116
- else
117
- printk ("%02x " , c );
139
+ print_data (regs -> pc , word , i );
118
140
}
119
141
}
120
142
printk ("\n" );
@@ -185,13 +207,11 @@ void nommu_dump_state(struct pt_regs *regs,
185
207
printk ("\nCode: " );
186
208
187
209
for (i = -24 ; i < 24 ; i ++ ) {
188
- unsigned char c ;
189
- c = ((unsigned char * )(__pa (regs -> pc )))[i ];
210
+ unsigned long word ;
211
+
212
+ word = ((unsigned long * )(__pa (regs -> pc )))[i ];
190
213
191
- if (i == 0 )
192
- printk ("(%02x) " , c );
193
- else
194
- printk ("%02x " , c );
214
+ print_data (regs -> pc , word , i );
195
215
}
196
216
printk ("\n" );
197
217
}
0 commit comments