cvs commit: src/sys/i386/i386 db_trace.c trap.c

Yar Tikhiy yar at FreeBSD.org
Sun Jun 18 12:07:05 UTC 2006


yar         2006-06-18 12:07:00 UTC

  FreeBSD src repository

  Modified files:
    sys/i386/i386        db_trace.c trap.c 
  Log:
  The i386 "call" instruction works as follows: it pushes
  the return address on the stack and only then "dereferences" %pc.
  Therefore, in the case of a call to an invalid address, we arrive
  to the trap handler with the invalid value in tf_eip.  This used
  to prevent db_backtrace() from assigning the most recent and interesting
  frame on the stack to the right spot in the right function, from
  which the invalid call was attempted.
  
  Try to detect and work around that by recovering the return address
  from the stack.
  
  The work-around requires the fault address be passed to db_backtrace().
  Smuggle it as tf_err.
  
  MFC after:      1 month
  Sponsored by:   RiNet (Cronyx Plus LLC)
  
  Revision  Changes    Path
  1.73      +25 -3     src/sys/i386/i386/db_trace.c
  1.290     +3 -0      src/sys/i386/i386/trap.c


More information about the cvs-src mailing list