[haiku-gsoc] [ARM port] Fixing KDL memory access fault when printing the backtrace

  • From: Arvind S Raj <sraj.arvind@xxxxxxxxx>
  • To: haiku-gsoc <haiku-gsoc@xxxxxxxxxxxxx>
  • Date: Tue, 12 Aug 2014 19:40:58 +0530

Hello everyone,
Currently, KDL faults because the termination condition when printing
the backtrace is incorrect(it merely checks if the frame pointer is
not 0 and doesn't check if the location is accessible). The x86 code
uses debug_memcpy(which I suppose has a fault handler) but it doesn't
work on ARM - the memcpy call faults and doesn't seem to pass control
onto the fault handler(if there is one).

Additionally, debug_memcpy displays arch_start_kernel(which invokes
the kernel) and it's callers in the backtrace. Should those callers
also be displayed or should the backtrace stop at _start(kernel
entry)? If the ones before kernel entry needn't be displayed, then
debug_memcpy won't work in it's current state and would require some
fixing specifically for ARM. Ideally, I think modifying get_next_frame
to do something ARM specific would be the best solution; even not
invoking debug_memcpy is probably fine unless uniformity across all
archs needs to be maintained.

As a temporary workaround, I added a check in get_next_frame to ensure
that the difference between the pointer to the current frame and that
of the previous do not differ by greater than 0x100000, which seems to
work because I get a 'kdebug>" prompt.

Other related posts: