~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to arch/sh/kernel/ptrace.c

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-tz023xykf0i6eosh
Tags: upstream-3.2.0
ImportĀ upstreamĀ versionĀ 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <linux/ptrace.h>
 
2
 
 
3
/**
 
4
 * regs_query_register_offset() - query register offset from its name
 
5
 * @name:       the name of a register
 
6
 *
 
7
 * regs_query_register_offset() returns the offset of a register in struct
 
8
 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
 
9
 */
 
10
int regs_query_register_offset(const char *name)
 
11
{
 
12
        const struct pt_regs_offset *roff;
 
13
        for (roff = regoffset_table; roff->name != NULL; roff++)
 
14
                if (!strcmp(roff->name, name))
 
15
                        return roff->offset;
 
16
        return -EINVAL;
 
17
}
 
18
 
 
19
/**
 
20
 * regs_query_register_name() - query register name from its offset
 
21
 * @offset:     the offset of a register in struct pt_regs.
 
22
 *
 
23
 * regs_query_register_name() returns the name of a register from its
 
24
 * offset in struct pt_regs. If the @offset is invalid, this returns NULL;
 
25
 */
 
26
const char *regs_query_register_name(unsigned int offset)
 
27
{
 
28
        const struct pt_regs_offset *roff;
 
29
        for (roff = regoffset_table; roff->name != NULL; roff++)
 
30
                if (roff->offset == offset)
 
31
                        return roff->name;
 
32
        return NULL;
 
33
}