45 |
: (frame->es & SEL_PL_U) ? false /* copyout */ |
: (frame->es & SEL_PL_U) ? false /* copyout */ |
46 |
: (frame->gs & SEL_PL_U) ? false : true; /* copyin */ |
: (frame->gs & SEL_PL_U) ? false : true; /* copyin */ |
47 |
|
|
48 |
|
|
49 |
switch (frame->trapno) |
switch (frame->trapno) |
50 |
{ |
{ |
51 |
case TRAP_PAGE_FAULT: |
case TRAP_PAGE_FAULT: |
52 |
kr = vm_fault (THREAD_CURRENT()->task->map, frame->cr2, |
kr = vm_fault (THREAD_CURRENT()->task->map, vm_trunc_page (frame->cr2), |
53 |
frame->err & 0x2 ? VM_PROT_WRITE : VM_PROT_READ, |
frame->err & 0x2 ? VM_PROT_WRITE : VM_PROT_READ, |
54 |
kernel_p); |
kernel_p); |
55 |
if (kr == KERN_SUCCESS) |
if (kr == KERN_SUCCESS) |
166 |
void |
void |
167 |
cpu_stack_trace (void *fp_va) |
cpu_stack_trace (void *fp_va) |
168 |
{ |
{ |
169 |
unsigned int *fp, *top, offset; |
extern char __syscall_frame_address_0; |
170 |
|
unsigned int *fp, *top, offset, address; |
171 |
char *string; |
char *string; |
172 |
int i; |
int i; |
173 |
|
|
174 |
|
address = __builtin_return_address (0); |
175 |
|
|
176 |
|
if (lookup_symbol (address, &string, &offset)) |
177 |
|
printf(" * %08x <%s+%d>\n", address, string, offset); |
178 |
|
else |
179 |
|
printf(" * %08x <?+%d>\n", address, address); |
180 |
|
|
181 |
fp = (unsigned int *) fp_va; |
fp = (unsigned int *) fp_va; |
182 |
top = (unsigned int *) (((int) fp + VM_PAGE_SIZE - 1) & ~VM_PAGE_MASK); |
top = (unsigned int *) (((int) fp + VM_PAGE_SIZE - 1) & ~VM_PAGE_MASK); |
183 |
|
|
184 |
for (i = 0; i < 32; ++i) |
for (i = 0; i < 32; ++i) |
185 |
{ |
{ |
186 |
unsigned int address = (unsigned int) *(fp + 1); |
address = (unsigned int) *(fp + 1); |
187 |
|
|
188 |
|
if (address == (unsigned int) &__syscall_frame_address_0) |
189 |
|
{ |
190 |
|
struct exception_frame *frame = (struct exception_frame *) *(fp + 3); |
191 |
|
|
192 |
if (lookup_symbol (address, &string, &offset)) |
printf (" %08x <system call #%d>\n", address, frame->trapno); |
193 |
printf(" %08x <%s+%d>\n", address, string, offset); |
} |
194 |
else |
else |
195 |
printf(" %08x <?+%d>\n", address, address); |
{ |
196 |
|
if (lookup_symbol (address, &string, &offset)) |
197 |
|
printf(" %08x <%s+%d>\n", address, string, offset); |
198 |
|
else |
199 |
|
printf(" %08x <?+%d>\n", address, address); |
200 |
|
} |
201 |
|
|
202 |
if (*(fp + 1) == 0 || *fp == 0 || *fp < (unsigned int)fp) |
if (*(fp + 1) == 0 || *fp == 0 || *fp < (unsigned int)fp) |
203 |
break; |
break; |