0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <errno.h>
0011 #include <stddef.h>
0012 #include <stdlib.h>
0013 #include <linux/kernel.h>
0014 #include <asm/ptrace.h>
0015 #include <string.h>
0016 #include <dwarf-regs.h>
0017 #include "dwarf-regs-table.h"
0018
0019 const char *get_arch_regstr(unsigned int n)
0020 {
0021 return (n >= ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n];
0022 }
0023
0024
0025
0026
0027
0028
0029
0030 int regs_query_register_offset(const char *name)
0031 {
0032 unsigned long gpr;
0033
0034 if (!name || strncmp(name, "%r", 2))
0035 return -EINVAL;
0036
0037 errno = 0;
0038 gpr = strtoul(name + 2, NULL, 10);
0039 if (errno || gpr >= 16)
0040 return -EINVAL;
0041
0042 return offsetof(user_pt_regs, gprs) + 8 * gpr;
0043 }