Author: kientzle
Date: Sat May 11 22:32:43 2013
New Revision: 250531
URL: http://svnweb.freebsd.org/changeset/base/250531

Log:
  Don't use the old stack-walking code with
  EABI ARM kernels or clang-compiled ARM kernels.
  
  This fixes a crash seen in clang-compiled ARM
  kernels that include WITNESS.
  
  This code could be easily modified to walk the stack
  for current clang-generated code (including EABI)
  but Andrew Turner has raised concerns that the
  stack frame currently emitted by clang isn't actually
  required by EABI so such a change might cause problems
  down the road.
  
  In case anyone wants to experiment, the change
  to support current clang-compiled kernels
  involves simply setting FR_RFP=0 and FR_SCP=1.

Modified:
  head/sys/arm/arm/stack_machdep.c

Modified: head/sys/arm/arm/stack_machdep.c
==============================================================================
--- head/sys/arm/arm/stack_machdep.c    Sat May 11 22:13:24 2013        
(r250530)
+++ head/sys/arm/arm/stack_machdep.c    Sat May 11 22:32:43 2013        
(r250531)
@@ -39,17 +39,16 @@ __FBSDID("$FreeBSD$");
 static void
 stack_capture(struct stack *st, u_int32_t *frame)
 {
+#if !defined(__ARM_EABI__) && !defined(__clang__)
        vm_offset_t callpc;
 
-       stack_zero(st);
-       while (1) {
-               if (!INKERNEL(frame))
-                       break;
+       while (INKERNEL(frame)) {
                callpc = frame[FR_SCP];
                if (stack_put(st, callpc) == -1)
                        break;
                frame = (u_int32_t *)(frame[FR_RFP]);
        }
+#endif
 }
 
 void
@@ -63,6 +62,7 @@ stack_save_td(struct stack *st, struct t
                panic("stack_save_td: running");
 
        frame = (u_int32_t *)td->td_pcb->un_32.pcb32_r11;
+       stack_zero(st);
        stack_capture(st, frame);
 }
 
@@ -72,5 +72,6 @@ stack_save(struct stack *st)
        u_int32_t *frame;
 
        frame = (u_int32_t *)__builtin_frame_address(0);
+       stack_zero(st);
        stack_capture(st, frame);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to