summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/current_8c-source.html
blob: 88ad571a4bffb4bf1e2664a65b1cffc6a91f9159 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>SystemTap: current.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>current.c</h1><a href="current_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _CURRENT_C_</span>
00002 <span class="preprocessor"></span><span class="preprocessor">#define _CURRENT_C_</span>
00003 <span class="preprocessor"></span>
00004 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span>
00005 <span class="comment">/** @file current.c</span>
00006 <span class="comment"> * @brief Functions to get the current state.</span>
00007 <span class="comment"> */</span><span class="comment"></span>
00008 <span class="comment">/** @addtogroup current Current State</span>
00009 <span class="comment"> * Functions to get the current state.</span>
00010 <span class="comment"> * @{</span>
00011 <span class="comment"> */</span>
00012 
00013 <span class="comment"></span>
00014 <span class="comment">/** Get the current return address.</span>
00015 <span class="comment"> * Call from kprobes (not jprobes).</span>
00016 <span class="comment"> * @param regs The pt_regs saved by the kprobe.</span>
00017 <span class="comment"> * @return The return address saved in esp or rsp.</span>
00018 <span class="comment"> * @note i386 and x86_64 only so far.</span>
00019 <span class="comment"> */</span>
00020  
<a name="l00021"></a><a class="code" href="group__current.html#ga0">00021</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="group__current.html#ga0">_stp_ret_addr</a> (<span class="keyword">struct</span> pt_regs *regs)
00022 {
00023 <span class="preprocessor">#ifdef __x86_64__</span>
00024 <span class="preprocessor"></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *ra = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)regs-&gt;rsp;
00025 <span class="preprocessor">#else</span>
00026 <span class="preprocessor"></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *ra = (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *)regs-&gt;esp;
00027 <span class="preprocessor">#endif</span>
00028 <span class="preprocessor"></span>  <span class="keywordflow">if</span> (ra)
00029     <span class="keywordflow">return</span> *ra;
00030   <span class="keywordflow">else</span>
00031     <span class="keywordflow">return</span> 0;
00032 }<span class="comment"></span>
00033 <span class="comment">/** @} */</span>
00034 <span class="preprocessor">#endif </span><span class="comment">/* _CURRENT_C_ */</span>
</pre></div></body></html>