Is this related to the general panic discussed in freebsd-current?

Tim Kientzle kientzle at freebsd.org
Fri May 10 05:17:12 UTC 2013


On May 6, 2013, at 4:47 AM, Andrew Turner wrote:

> On Sun, 5 May 2013 22:39:56 -0700
> Tim Kientzle <kientzle at freebsd.org> wrote:
>> Here's a version of stack_capture that allows a Clang-built
>> OABI kernel with WITNESS enabled to boot:
>> 
>> /* In sys/arm/arm/stack_machdep.c */
>> static void
>> stack_capture(struct stack *st, u_int32_t *frame)
>> {
>>        vm_offset_t callpc;
>> 
>>        stack_zero(st);
>>        while (INKERNEL(frame)) {
>>                callpc = frame[1];
>>                if (stack_put(st, callpc) == -1)
>>                        break;
>>                frame = (u_int32_t *)(frame[0]);
>>        }
>> }
> It looks like this should work in most cases where fp and lr are next
> to each other (ip and sp are between them but doesn't need to be saved).

Disassembling an EABI kernel, there are 7930 'push' instructions with
fp and lr next to each other and only 220 without, so it looks like the EABI
kernel uses this frame convention as well.

So what do you think of the following?

#if defined(__ARM_EABI__)
static void
stack_capture(struct stack *st, u_int32_t *frame)
{
       vm_offset_t callpc;

       stack_zero(st);
       while (INKERNEL(frame)) {
               callpc = frame[1];
               if (stack_put(st, callpc) == -1)
                       break;
               frame = (u_int32_t *)(frame[0]);
       }
}
#elif !defined(__clang__)
… old stack_capture code that works for OABI with gcc …

#else
/*
 * Clang doesn't yet produce compliant stack frames for OABI.
 */
static void
stack_capture(…)
{
	/* empty */
}
#endif




More information about the freebsd-arm mailing list