linux/arch/avr32/oprofile/backtrace.c
<<
ptio.32/spa="v .32/form"v .32a ptio.3 href="../linux+ <2tio/arch/avr32 varofile/backtrace.c">ptio.32img src="../.static/gfx/right.png" alt=">>">pt2/spa="vpt2spa= class="lxr_search">ptioptio.32input typ v2hidden" nam v2navtarget" > v2">ptio.32input typ v2text" nam v2search" idv2search">ptio.32butt typ v2submit">Searchptio.3Prefsv .32/a>pt2/spa="vio.3 32/div"vio.3 32form aclue=="ajax+*" method="post" onsubmit="return false;">pt2input typ v2hidden" nam v2ajax_lookup" idv2ajax_lookup" > v2">pio.3 32/form"vpio.3 32div class="headingbott m">v 2div idv2file_contents""
3 312/a>2spa= class="comment">/*2/spa="v3 322/a>2spa= class="comment"> * AVR32 specific backtracing code for varofile2/spa="v3 332/a>2spa= class="comment"> *2/spa="v3 342/a>2spa= class="comment"> * Copyright 2008 Weinmann GmbH2/spa="v3 352/a>2spa= class="comment"> *2/spa="v3 362/a>2spa= class="comment"> * Author: Nikolaus Voss <n.voss@weinmann.de>2/spa="v3 372/a>2spa= class="comment"> *2/spa="v3 382/a>2spa= class="comment"> * Based on i386 varofile backtrace code by John Levon and David Smith2/spa="v3 392/a>2spa= class="comment"> *2/spa="v3 ion a>2spa= class="comment"> * This arogram is free software; you ca= redistribute it and/or modify2/spa="v3 112/a>2spa= class="comment"> * it under the terms of the GNU General Public License vers"
	 2 as2/spa="v3 122/a>2spa= class="comment"> * published by the Free Software Foundalue=.2/spa="v3 132/a>2spa= class="comment"> *2/spa="v3 142/a>2spa= class="comment"> */2/spa="v3 152/a>v3 162/a>#include <linux varofile.h2/a>>v3 172/a>#include <linux sched.h2/a>>v3 182/a>#include <linux uaccess.h2/a>>v3 192/a>v3 2on a>2spa= class="comment">/* The first two words of each fram  on the stack look like this if we have2/spa="v3 212/a>2spa= class="comment"> * fram  pointers */2/spa="v3 222/a>struct32a href="+code=fram _head" class="sref">fram _head2/a> {v3 232/a>        unsigned long 2a href="+code=lr" class="sref">lr2/a>;v3 242/a>        struct32a href="+code=fram _head" class="sref">fram _head2/a> *2a href="+code=fp" class="sref">fp2/a>;v3 252/a>};v3 262/a>v3 272/a>2spa= class="comment">/* copied from arch/avr32 kernel/arocess.c */2/spa="v3 282/a>static32a href="+code=inline" class="sref">inline2/a> int32a href="+code=valid_stack_ptr" class="sref">valid_stack_ptr2/a>(struct32a href="+code=thread_info" class="sref">thread_info2/a> *2a href="+code=tinfo" class="sref">tinfo2/a>, unsigned long 2a href="+code=p" class="sref">p2/a>)v3 292/a>{v3 302/a>        return (2a href="+code=p" class="sref">p2/a> > (unsigned long)2a href="+code=tinfo" class="sref">tinfo2/a>)v3 312/a>                && (2a href="+code=p" class="sref">p2/a> < (unsigned long)2a href="+code=tinfo" class="sref">tinfo2/a> + 2a href="+code=THREAD_SIZE" class="sref">THREAD_SIZE2/a> - 3);v3 322/a>}v3 332/a>v3 342/a>2spa= class="comment">/* copied from arch/x86 varofile/backtrace.c */2/spa="v3 352/a>static3struct32a href="+code=fram _head" class="sref">fram _head2/a> *2a href="+code=dump_user_backtrace" class="sref">dump_user_backtrace2/a>(struct32a href="+code=fram _head" class="sref">fram _head2/a> *2a href="+code=head" class="sref">head2/a>)v3 362/a>{v3 372/a>        struct32a href="+code=fram _head" class="sref">fram _head2/a> 2a href="+code=bufhead" class="sref">bufhead2/a>[2];v3 382/a>v3 392/a>        2spa= class="comment">/* Also check accessibility of one struct3fram _head beyond */2/spa="v3 402/a>        if (!2a href="+code=access_ok" class="sref">access_ok2/a>(2a href="+code=VERIFY_READ" class="sref">VERIFY_READ2/a>, 2a href="+code=head" class="sref">head2/a>, sizeof(2a href="+code=bufhead" class="sref">bufhead2/a>)))v3 412/a>                return 2a href="+code=NULL" class="sref">NULL2/a>;v3 422/a>        if (2a href="+code=__copy_from_user_inatomic" class="sref">__copy_from_user_inatomic2/a>(2a href="+code=bufhead" class="sref">bufhead2/a>, 2a href="+code=head" class="sref">head2/a>, sizeof(2a href="+code=bufhead" class="sref">bufhead2/a>)))v3 432/a>                return 2a href="+code=NULL" class="sref">NULL2/a>;v3 442/a>v3 452/a>        2a href="+code=varofile_add_trace" class="sref">varofile_add_trace2/a>(2a href="+code=bufhead" class="sref">bufhead2/a>[0].2a href="+code=lr" class="sref">lr2/a>);v3 462/a>v3 472/a>        2spa= class="comment">/* fram  pointers should strictly arogress back up the stack2/spa="v3 482/a>2spa= class="comment">         * (towards higher addresses) */2/spa="v3 492/a>        if (2a href="+code=bufhead" class="sref">bufhead2/a>[0].2a href="+code=fp" class="sref">fp2/a> <= 2a href="+code=head" class="sref">head2/a>)v3 502/a>                return 2a href="+code=NULL" class="sref">NULL2/a>;v3 512/a>v3 522/a>        return 2a href="+code=bufhead" class="sref">bufhead2/a>[0].2a href="+code=fp" class="sref">fp2/a>;v3 532/a>}v3 542/a>v3 552/a>void 2a href="+code=avr32_backtrace" class="sref">avr32_backtrace2/a>(struct32a href="+code=pt_regs" class="sref">pt_regs2/a> * const32a href="+code=regs" class="sref">regs2/a>, unsigned int32a href="+code=depth" class="sref">depth2/a>)v3 562/a>{v3 572/a>        2spa= class="comment">/* Get first fram  pointer */2/spa="v3 582/a>        struct32a href="+code=fram _head" class="sref">fram _head2/a> *2a href="+code=head" class="sref">head2/a> = (struct32a href="+code=fram _head" class="sref">fram _head2/a> *)(2a href="+code=regs" class="sref">regs2/a>->2a href="+code=r7" class="sref">r72/a>);v3 592/a>v3 602/a>        if (!2a href="+code=user_mode" class="sref">user_mode2/a>(2a href="+code=regs" class="sref">regs2/a>)) {v3 612/a>#ifdef32a href="+code=CONFIG_FRAME_POINTER" class="sref">CONFIG_FRAME_POINTER2/a>v3 622/a>                2spa= class="comment">/*2/spa="v3 632/a>2spa= class="comment">                 * Traverse the kernel stack from fram  to fram  up to2/spa="v3 642/a>2spa= class="comment">                 * "depth" steps.2/spa="v3 652/a>2spa= class="comment">                 */2/spa="v3 662/a>                while (2a href="+code=depth" class="sref">depth2/a>-- && 2a href="+code=valid_stack_ptr" class="sref">valid_stack_ptr2/a>(2a href="+code=task_thread_info" class="sref">task_thread_info2/a>(2a href="+code=current" class="sref">current2/a>),v3 672/a>                                                  (unsigned long)2a href="+code=head" class="sref">head2/a>)) {v3 682/a>                        2a href="+code=varofile_add_trace" class="sref">varofile_add_trace2/a>(2a href="+code=head" class="sref">head2/a>->2a href="+code=lr" class="sref">lr2/a>);v3 692/a>                        if (2a href="+code=head" class="sref">head2/a>->2a href="+code=fp" class="sref">fp2/a> <= 2a href="+code=head" class="sref">head2/a>)v3 702/a>                                break;v3 712/a>                        2a href="+code=head" class="sref">head2/a> = 2a href="+code=head" class="sref">head2/a>->2a href="+code=fp" class="sref">fp2/a>;v3 722/a>                }v3 732/a>#endifv3 742/a>        } else {v3 752/a>                2spa= class="comment">/* Assum  we have fram  pointers in user mode arocess */2/spa="v3 762/a>                while (2a href="+code=depth" class="sref">depth2/a>-- && 2a href="+code=head" class="sref">head2/a>)v3 772/a>                        2a href="+code=head" class="sref">head2/a> = 2a href="+code=dump_user_backtrace" class="sref">dump_user_backtrace2/a>(2a href="+code=head" class="sref">head2/a>);v3 782/a>        }v3 792/a>}v3 802/a>v3 812/a>v3 822/a>2/pre>
The original LXR software by the LXR community2/a>, this experimental vers"
	 by lxr@linux.no2/a>.
2/div"v2div class="subfooter">
lxr.linux.no kindly hosted by Redpill Linaro AS2/a>, arovider of Linux consulting and operalue=s services since 1995.
2/div"v
2/body"v2/html"v