<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi mpe,<br>
      On Wednesday 20 January 2016 04:10 PM, Michael Ellerman wrote:<br>
    </div>
    <blockquote cite="mid:1453286426.14751.19.camel@ellerman.id.au"
      type="cite">
      <pre wrap="">On Mon, 2016-01-11 at 15:58 +0530, Anju T wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 9a7057e..c4ce60d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -119,6 +119,7 @@ config PPC
        select GENERIC_ATOMIC64 if PPC32
        select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
        select HAVE_PERF_EVENTS
+       select HAVE_PERF_REGS
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
        select ARCH_WANT_IPC_PARSE_VERSION
diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c
new file mode 100644
index 0000000..d32581763
--- /dev/null
+++ b/arch/powerpc/perf/perf_regs.c
</pre>
      </blockquote>
      <pre wrap="">...
</pre>
      <blockquote type="cite">
        <pre wrap="">+
+u64 perf_reg_abi(struct task_struct *task)
+{
+       return PERF_SAMPLE_REGS_ABI_64;
</pre>
      </blockquote>
      <pre wrap="">
What is this value used for exactly?

It seems like on 32-bit kernels we should be returning PERF_SAMPLE_REGS_ABI_32.</pre>
    </blockquote>
    <br>
    <br>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <p style="margin-bottom: 0cm; line-height: 100%">Values to determine
      ABI of the registers dump.</p>
    <p style="margin-bottom: 0cm; line-height: 100%"> </p>
    <p style="margin-bottom: 0cm; line-height: 100%">enum
      perf_sample_regs_abi {</p>
    <p style="margin-bottom: 0cm; line-height: 100%">
      PERF_SAMPLE_REGS_ABI_NONE = 0,</p>
    <p style="margin-bottom: 0cm; line-height: 100%">
      PERF_SAMPLE_REGS_ABI_32 = 1,</p>
    <p style="margin-bottom: 0cm; line-height: 100%">
      PERF_SAMPLE_REGS_ABI_64 = 2,</p>
    <p style="margin-bottom: 0cm; line-height: 100%">};</p>
    <p style="margin-bottom: 0cm; line-height: 100%"><br>
    </p>
    <title></title>
    <meta name="generator" content="LibreOffice 4.3.7.2 (Linux)">
    <style type="text/css">
                @page { margin: 2cm }
                p { margin-bottom: 0.25cm; line-height: 120% } </style>Initially the
    ABI is set as NONE. So when we enable PERF_SAMPLE_REGS_INTR we need
    to get the correspodning ABI. This in turn required for ..<br>
    <br>
    void perf_output_sample(struct perf_output_handle *handle,<br>
            if (sample_type & PERF_SAMPLE_TRANSACTION)<br>
                    perf_output_put(handle, data->txn);<br>
     <br>
           if (sample_type & PERF_SAMPLE_REGS_INTR) {<br>
                   u64 abi = data->regs_intr.abi;<br>
                   /*<br>
                    * If there are no regs to dump, notice it through<br>
                    * first u64 being zero (PERF_SAMPLE_REGS_ABI_NONE).<br>
                    */<br>
                   perf_output_put(handle, abi);<br>
    <br>
                   if (abi) {<br>
                           u64 mask = event->attr.sample_regs_intr;<br>
    <br>
                           perf_output_sample_regs(handle,<br>
                                                  
    data->regs_intr.regs,<br>
                                                   mask);<br>
                   }<br>
           }<br>
    <br>
    <br>
    <br>
    Here as you suggested we may need to pass the right ABI for 64 and
    32 bit.<br>
    <br>
    <br>
    Thanks and Regards<br>
    <br>
    Anju<br>
    <br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:1453286426.14751.19.camel@ellerman.id.au"
      type="cite">
      <pre wrap="">

</pre>
      <blockquote type="cite">
        <pre wrap="">+}
+
+void perf_get_regs_user(struct perf_regs *regs_user,
+                       struct pt_regs *regs,
+                       struct pt_regs *regs_user_copy)
+{
+       regs_user->regs = task_pt_regs(current);
+       regs_user->abi  = perf_reg_abi(current);
+}
</pre>
      </blockquote>
      <pre wrap="">
cheers

</pre>
    </blockquote>
    <br>
  </body>
</html>