forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/ia64/kernel/ptrace.c
....@@ -25,15 +25,11 @@
2525 #include <linux/elf.h>
2626 #include <linux/tracehook.h>
2727
28
-#include <asm/pgtable.h>
2928 #include <asm/processor.h>
3029 #include <asm/ptrace_offsets.h>
3130 #include <asm/rse.h>
3231 #include <linux/uaccess.h>
3332 #include <asm/unwind.h>
34
-#ifdef CONFIG_PERFMON
35
-#include <asm/perfmon.h>
36
-#endif
3733
3834 #include "entry.h"
3935
....@@ -836,7 +832,7 @@
836832 char nat = 0;
837833 int i;
838834
839
- if (!access_ok(VERIFY_WRITE, ppr, sizeof(struct pt_all_user_regs)))
835
+ if (!access_ok(ppr, sizeof(struct pt_all_user_regs)))
840836 return -EIO;
841837
842838 pt = task_pt_regs(child);
....@@ -981,7 +977,7 @@
981977
982978 memset(&fpval, 0, sizeof(fpval));
983979
984
- if (!access_ok(VERIFY_READ, ppr, sizeof(struct pt_all_user_regs)))
980
+ if (!access_ok(ppr, sizeof(struct pt_all_user_regs)))
985981 return -EIO;
986982
987983 pt = task_pt_regs(child);
....@@ -1274,52 +1270,43 @@
12741270 int ret;
12751271 };
12761272
1273
+static const ptrdiff_t pt_offsets[32] =
1274
+{
1275
+#define R(n) offsetof(struct pt_regs, r##n)
1276
+ [0] = -1, R(1), R(2), R(3),
1277
+ [4] = -1, [5] = -1, [6] = -1, [7] = -1,
1278
+ R(8), R(9), R(10), R(11), R(12), R(13), R(14), R(15),
1279
+ R(16), R(17), R(18), R(19), R(20), R(21), R(22), R(23),
1280
+ R(24), R(25), R(26), R(27), R(28), R(29), R(30), R(31),
1281
+#undef R
1282
+};
1283
+
12771284 static int
12781285 access_elf_gpreg(struct task_struct *target, struct unw_frame_info *info,
12791286 unsigned long addr, unsigned long *data, int write_access)
12801287 {
1281
- struct pt_regs *pt;
1282
- unsigned long *ptr = NULL;
1283
- int ret;
1284
- char nat = 0;
1288
+ struct pt_regs *pt = task_pt_regs(target);
1289
+ unsigned reg = addr / sizeof(unsigned long);
1290
+ ptrdiff_t d = pt_offsets[reg];
12851291
1286
- pt = task_pt_regs(target);
1287
- switch (addr) {
1288
- case ELF_GR_OFFSET(1):
1289
- ptr = &pt->r1;
1290
- break;
1291
- case ELF_GR_OFFSET(2):
1292
- case ELF_GR_OFFSET(3):
1293
- ptr = (void *)&pt->r2 + (addr - ELF_GR_OFFSET(2));
1294
- break;
1295
- case ELF_GR_OFFSET(4) ... ELF_GR_OFFSET(7):
1292
+ if (d >= 0) {
1293
+ unsigned long *ptr = (void *)pt + d;
1294
+ if (write_access)
1295
+ *ptr = *data;
1296
+ else
1297
+ *data = *ptr;
1298
+ return 0;
1299
+ } else {
1300
+ char nat = 0;
12961301 if (write_access) {
12971302 /* read NaT bit first: */
12981303 unsigned long dummy;
1299
-
1300
- ret = unw_get_gr(info, addr/8, &dummy, &nat);
1304
+ int ret = unw_get_gr(info, reg, &dummy, &nat);
13011305 if (ret < 0)
13021306 return ret;
13031307 }
1304
- return unw_access_gr(info, addr/8, data, &nat, write_access);
1305
- case ELF_GR_OFFSET(8) ... ELF_GR_OFFSET(11):
1306
- ptr = (void *)&pt->r8 + addr - ELF_GR_OFFSET(8);
1307
- break;
1308
- case ELF_GR_OFFSET(12):
1309
- case ELF_GR_OFFSET(13):
1310
- ptr = (void *)&pt->r12 + addr - ELF_GR_OFFSET(12);
1311
- break;
1312
- case ELF_GR_OFFSET(14):
1313
- ptr = &pt->r14;
1314
- break;
1315
- case ELF_GR_OFFSET(15):
1316
- ptr = &pt->r15;
1308
+ return unw_access_gr(info, reg, data, &nat, write_access);
13171309 }
1318
- if (write_access)
1319
- *ptr = *data;
1320
- else
1321
- *data = *ptr;
1322
- return 0;
13231310 }
13241311
13251312 static int
....@@ -1491,7 +1478,7 @@
14911478 access_elf_reg(struct task_struct *target, struct unw_frame_info *info,
14921479 unsigned long addr, unsigned long *data, int write_access)
14931480 {
1494
- if (addr >= ELF_GR_OFFSET(1) && addr <= ELF_GR_OFFSET(15))
1481
+ if (addr >= ELF_GR_OFFSET(1) && addr <= ELF_GR_OFFSET(31))
14951482 return access_elf_gpreg(target, info, addr, data, write_access);
14961483 else if (addr >= ELF_BR_OFFSET(0) && addr <= ELF_BR_OFFSET(7))
14971484 return access_elf_breg(target, info, addr, data, write_access);
....@@ -1499,12 +1486,17 @@
14991486 return access_elf_areg(target, info, addr, data, write_access);
15001487 }
15011488
1489
+struct regset_membuf {
1490
+ struct membuf to;
1491
+ int ret;
1492
+};
1493
+
15021494 void do_gpregs_get(struct unw_frame_info *info, void *arg)
15031495 {
1504
- struct pt_regs *pt;
1505
- struct regset_getset *dst = arg;
1506
- elf_greg_t tmp[16];
1507
- unsigned int i, index, min_copy;
1496
+ struct regset_membuf *dst = arg;
1497
+ struct membuf to = dst->to;
1498
+ unsigned int n;
1499
+ elf_greg_t reg;
15081500
15091501 if (unw_unwind_to_user(info) < 0)
15101502 return;
....@@ -1522,165 +1514,53 @@
15221514
15231515
15241516 /* Skip r0 */
1525
- if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(1)) {
1526
- dst->ret = user_regset_copyout_zero(&dst->pos, &dst->count,
1527
- &dst->u.get.kbuf,
1528
- &dst->u.get.ubuf,
1529
- 0, ELF_GR_OFFSET(1));
1530
- if (dst->ret || dst->count == 0)
1517
+ membuf_zero(&to, 8);
1518
+ for (n = 8; to.left && n < ELF_AR_END_OFFSET; n += 8) {
1519
+ if (access_elf_reg(info->task, info, n, &reg, 0) < 0) {
1520
+ dst->ret = -EIO;
15311521 return;
1532
- }
1533
-
1534
- /* gr1 - gr15 */
1535
- if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(16)) {
1536
- index = (dst->pos - ELF_GR_OFFSET(1)) / sizeof(elf_greg_t);
1537
- min_copy = ELF_GR_OFFSET(16) > (dst->pos + dst->count) ?
1538
- (dst->pos + dst->count) : ELF_GR_OFFSET(16);
1539
- for (i = dst->pos; i < min_copy; i += sizeof(elf_greg_t),
1540
- index++)
1541
- if (access_elf_reg(dst->target, info, i,
1542
- &tmp[index], 0) < 0) {
1543
- dst->ret = -EIO;
1544
- return;
1545
- }
1546
- dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1547
- &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1548
- ELF_GR_OFFSET(1), ELF_GR_OFFSET(16));
1549
- if (dst->ret || dst->count == 0)
1550
- return;
1551
- }
1552
-
1553
- /* r16-r31 */
1554
- if (dst->count > 0 && dst->pos < ELF_NAT_OFFSET) {
1555
- pt = task_pt_regs(dst->target);
1556
- dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1557
- &dst->u.get.kbuf, &dst->u.get.ubuf, &pt->r16,
1558
- ELF_GR_OFFSET(16), ELF_NAT_OFFSET);
1559
- if (dst->ret || dst->count == 0)
1560
- return;
1561
- }
1562
-
1563
- /* nat, pr, b0 - b7 */
1564
- if (dst->count > 0 && dst->pos < ELF_CR_IIP_OFFSET) {
1565
- index = (dst->pos - ELF_NAT_OFFSET) / sizeof(elf_greg_t);
1566
- min_copy = ELF_CR_IIP_OFFSET > (dst->pos + dst->count) ?
1567
- (dst->pos + dst->count) : ELF_CR_IIP_OFFSET;
1568
- for (i = dst->pos; i < min_copy; i += sizeof(elf_greg_t),
1569
- index++)
1570
- if (access_elf_reg(dst->target, info, i,
1571
- &tmp[index], 0) < 0) {
1572
- dst->ret = -EIO;
1573
- return;
1574
- }
1575
- dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1576
- &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1577
- ELF_NAT_OFFSET, ELF_CR_IIP_OFFSET);
1578
- if (dst->ret || dst->count == 0)
1579
- return;
1580
- }
1581
-
1582
- /* ip cfm psr ar.rsc ar.bsp ar.bspstore ar.rnat
1583
- * ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec ar.csd ar.ssd
1584
- */
1585
- if (dst->count > 0 && dst->pos < (ELF_AR_END_OFFSET)) {
1586
- index = (dst->pos - ELF_CR_IIP_OFFSET) / sizeof(elf_greg_t);
1587
- min_copy = ELF_AR_END_OFFSET > (dst->pos + dst->count) ?
1588
- (dst->pos + dst->count) : ELF_AR_END_OFFSET;
1589
- for (i = dst->pos; i < min_copy; i += sizeof(elf_greg_t),
1590
- index++)
1591
- if (access_elf_reg(dst->target, info, i,
1592
- &tmp[index], 0) < 0) {
1593
- dst->ret = -EIO;
1594
- return;
1595
- }
1596
- dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1597
- &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1598
- ELF_CR_IIP_OFFSET, ELF_AR_END_OFFSET);
1522
+ }
1523
+ membuf_store(&to, reg);
15991524 }
16001525 }
16011526
16021527 void do_gpregs_set(struct unw_frame_info *info, void *arg)
16031528 {
1604
- struct pt_regs *pt;
16051529 struct regset_getset *dst = arg;
1606
- elf_greg_t tmp[16];
1607
- unsigned int i, index;
16081530
16091531 if (unw_unwind_to_user(info) < 0)
16101532 return;
16111533
1534
+ if (!dst->count)
1535
+ return;
16121536 /* Skip r0 */
1613
- if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(1)) {
1537
+ if (dst->pos < ELF_GR_OFFSET(1)) {
16141538 dst->ret = user_regset_copyin_ignore(&dst->pos, &dst->count,
16151539 &dst->u.set.kbuf,
16161540 &dst->u.set.ubuf,
16171541 0, ELF_GR_OFFSET(1));
1618
- if (dst->ret || dst->count == 0)
1619
- return;
1620
- }
1621
-
1622
- /* gr1-gr15 */
1623
- if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(16)) {
1624
- i = dst->pos;
1625
- index = (dst->pos - ELF_GR_OFFSET(1)) / sizeof(elf_greg_t);
1626
- dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1627
- &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1628
- ELF_GR_OFFSET(1), ELF_GR_OFFSET(16));
16291542 if (dst->ret)
16301543 return;
1631
- for ( ; i < dst->pos; i += sizeof(elf_greg_t), index++)
1632
- if (access_elf_reg(dst->target, info, i,
1633
- &tmp[index], 1) < 0) {
1634
- dst->ret = -EIO;
1635
- return;
1636
- }
1637
- if (dst->count == 0)
1638
- return;
16391544 }
16401545
1641
- /* gr16-gr31 */
1642
- if (dst->count > 0 && dst->pos < ELF_NAT_OFFSET) {
1643
- pt = task_pt_regs(dst->target);
1644
- dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1645
- &dst->u.set.kbuf, &dst->u.set.ubuf, &pt->r16,
1646
- ELF_GR_OFFSET(16), ELF_NAT_OFFSET);
1647
- if (dst->ret || dst->count == 0)
1648
- return;
1649
- }
1546
+ while (dst->count && dst->pos < ELF_AR_END_OFFSET) {
1547
+ unsigned int n, from, to;
1548
+ elf_greg_t tmp[16];
16501549
1651
- /* nat, pr, b0 - b7 */
1652
- if (dst->count > 0 && dst->pos < ELF_CR_IIP_OFFSET) {
1653
- i = dst->pos;
1654
- index = (dst->pos - ELF_NAT_OFFSET) / sizeof(elf_greg_t);
1550
+ from = dst->pos;
1551
+ to = from + sizeof(tmp);
1552
+ if (to > ELF_AR_END_OFFSET)
1553
+ to = ELF_AR_END_OFFSET;
1554
+ /* get up to 16 values */
16551555 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
16561556 &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1657
- ELF_NAT_OFFSET, ELF_CR_IIP_OFFSET);
1557
+ from, to);
16581558 if (dst->ret)
16591559 return;
1660
- for (; i < dst->pos; i += sizeof(elf_greg_t), index++)
1661
- if (access_elf_reg(dst->target, info, i,
1662
- &tmp[index], 1) < 0) {
1663
- dst->ret = -EIO;
1664
- return;
1665
- }
1666
- if (dst->count == 0)
1667
- return;
1668
- }
1669
-
1670
- /* ip cfm psr ar.rsc ar.bsp ar.bspstore ar.rnat
1671
- * ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec ar.csd ar.ssd
1672
- */
1673
- if (dst->count > 0 && dst->pos < (ELF_AR_END_OFFSET)) {
1674
- i = dst->pos;
1675
- index = (dst->pos - ELF_CR_IIP_OFFSET) / sizeof(elf_greg_t);
1676
- dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1677
- &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1678
- ELF_CR_IIP_OFFSET, ELF_AR_END_OFFSET);
1679
- if (dst->ret)
1680
- return;
1681
- for ( ; i < dst->pos; i += sizeof(elf_greg_t), index++)
1682
- if (access_elf_reg(dst->target, info, i,
1683
- &tmp[index], 1) < 0) {
1560
+ /* now copy them into registers */
1561
+ for (n = 0; from < dst->pos; from += sizeof(elf_greg_t), n++)
1562
+ if (access_elf_reg(dst->target, info, from,
1563
+ &tmp[n], 1) < 0) {
16841564 dst->ret = -EIO;
16851565 return;
16861566 }
....@@ -1691,60 +1571,36 @@
16911571
16921572 void do_fpregs_get(struct unw_frame_info *info, void *arg)
16931573 {
1694
- struct regset_getset *dst = arg;
1695
- struct task_struct *task = dst->target;
1696
- elf_fpreg_t tmp[30];
1697
- int index, min_copy, i;
1574
+ struct task_struct *task = info->task;
1575
+ struct regset_membuf *dst = arg;
1576
+ struct membuf to = dst->to;
1577
+ elf_fpreg_t reg;
1578
+ unsigned int n;
16981579
16991580 if (unw_unwind_to_user(info) < 0)
17001581 return;
17011582
17021583 /* Skip pos 0 and 1 */
1703
- if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(2)) {
1704
- dst->ret = user_regset_copyout_zero(&dst->pos, &dst->count,
1705
- &dst->u.get.kbuf,
1706
- &dst->u.get.ubuf,
1707
- 0, ELF_FP_OFFSET(2));
1708
- if (dst->count == 0 || dst->ret)
1709
- return;
1710
- }
1584
+ membuf_zero(&to, 2 * sizeof(elf_fpreg_t));
17111585
17121586 /* fr2-fr31 */
1713
- if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(32)) {
1714
- index = (dst->pos - ELF_FP_OFFSET(2)) / sizeof(elf_fpreg_t);
1715
-
1716
- min_copy = min(((unsigned int)ELF_FP_OFFSET(32)),
1717
- dst->pos + dst->count);
1718
- for (i = dst->pos; i < min_copy; i += sizeof(elf_fpreg_t),
1719
- index++)
1720
- if (unw_get_fr(info, i / sizeof(elf_fpreg_t),
1721
- &tmp[index])) {
1722
- dst->ret = -EIO;
1723
- return;
1724
- }
1725
- dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1726
- &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1727
- ELF_FP_OFFSET(2), ELF_FP_OFFSET(32));
1728
- if (dst->count == 0 || dst->ret)
1587
+ for (n = 2; to.left && n < 32; n++) {
1588
+ if (unw_get_fr(info, n, &reg)) {
1589
+ dst->ret = -EIO;
17291590 return;
1591
+ }
1592
+ membuf_write(&to, &reg, sizeof(reg));
17301593 }
17311594
17321595 /* fph */
1733
- if (dst->count > 0) {
1734
- ia64_flush_fph(dst->target);
1735
- if (task->thread.flags & IA64_THREAD_FPH_VALID)
1736
- dst->ret = user_regset_copyout(
1737
- &dst->pos, &dst->count,
1738
- &dst->u.get.kbuf, &dst->u.get.ubuf,
1739
- &dst->target->thread.fph,
1740
- ELF_FP_OFFSET(32), -1);
1741
- else
1742
- /* Zero fill instead. */
1743
- dst->ret = user_regset_copyout_zero(
1744
- &dst->pos, &dst->count,
1745
- &dst->u.get.kbuf, &dst->u.get.ubuf,
1746
- ELF_FP_OFFSET(32), -1);
1747
- }
1596
+ if (!to.left)
1597
+ return;
1598
+
1599
+ ia64_flush_fph(task);
1600
+ if (task->thread.flags & IA64_THREAD_FPH_VALID)
1601
+ membuf_write(&to, &task->thread.fph, 96 * sizeof(reg));
1602
+ else
1603
+ membuf_zero(&to, 96 * sizeof(reg));
17481604 }
17491605
17501606 void do_fpregs_set(struct unw_frame_info *info, void *arg)
....@@ -1820,6 +1676,20 @@
18201676 }
18211677 }
18221678
1679
+static void
1680
+unwind_and_call(void (*call)(struct unw_frame_info *, void *),
1681
+ struct task_struct *target, void *data)
1682
+{
1683
+ if (target == current)
1684
+ unw_init_running(call, data);
1685
+ else {
1686
+ struct unw_frame_info info;
1687
+ memset(&info, 0, sizeof(info));
1688
+ unw_init_from_blocked_task(&info, target);
1689
+ (*call)(&info, data);
1690
+ }
1691
+}
1692
+
18231693 static int
18241694 do_regset_call(void (*call)(struct unw_frame_info *, void *),
18251695 struct task_struct *target,
....@@ -1831,27 +1701,18 @@
18311701 .pos = pos, .count = count,
18321702 .u.set = { .kbuf = kbuf, .ubuf = ubuf },
18331703 .ret = 0 };
1834
-
1835
- if (target == current)
1836
- unw_init_running(call, &info);
1837
- else {
1838
- struct unw_frame_info ufi;
1839
- memset(&ufi, 0, sizeof(ufi));
1840
- unw_init_from_blocked_task(&ufi, target);
1841
- (*call)(&ufi, &info);
1842
- }
1843
-
1704
+ unwind_and_call(call, target, &info);
18441705 return info.ret;
18451706 }
18461707
18471708 static int
18481709 gpregs_get(struct task_struct *target,
18491710 const struct user_regset *regset,
1850
- unsigned int pos, unsigned int count,
1851
- void *kbuf, void __user *ubuf)
1711
+ struct membuf to)
18521712 {
1853
- return do_regset_call(do_gpregs_get, target, regset, pos, count,
1854
- kbuf, ubuf);
1713
+ struct regset_membuf info = {.to = to};
1714
+ unwind_and_call(do_gpregs_get, target, &info);
1715
+ return info.ret;
18551716 }
18561717
18571718 static int gpregs_set(struct task_struct *target,
....@@ -1893,11 +1754,11 @@
18931754
18941755 static int fpregs_get(struct task_struct *target,
18951756 const struct user_regset *regset,
1896
- unsigned int pos, unsigned int count,
1897
- void *kbuf, void __user *ubuf)
1757
+ struct membuf to)
18981758 {
1899
- return do_regset_call(do_fpregs_get, target, regset, pos, count,
1900
- kbuf, ubuf);
1759
+ struct regset_membuf info = {.to = to};
1760
+ unwind_and_call(do_fpregs_get, target, &info);
1761
+ return info.ret;
19011762 }
19021763
19031764 static int fpregs_set(struct task_struct *target,
....@@ -1914,7 +1775,6 @@
19141775 unsigned long *data, int write_access)
19151776 {
19161777 unsigned int pos = -1; /* an invalid value */
1917
- int ret;
19181778 unsigned long *ptr, regnum;
19191779
19201780 if ((addr & 0x7) != 0) {
....@@ -1946,14 +1806,39 @@
19461806 }
19471807
19481808 if (pos != -1) {
1949
- if (write_access)
1950
- ret = fpregs_set(child, NULL, pos,
1951
- sizeof(unsigned long), data, NULL);
1952
- else
1953
- ret = fpregs_get(child, NULL, pos,
1954
- sizeof(unsigned long), data, NULL);
1955
- if (ret != 0)
1956
- return -1;
1809
+ unsigned reg = pos / sizeof(elf_fpreg_t);
1810
+ int which_half = (pos / sizeof(unsigned long)) & 1;
1811
+
1812
+ if (reg < 32) { /* fr2-fr31 */
1813
+ struct unw_frame_info info;
1814
+ elf_fpreg_t fpreg;
1815
+
1816
+ memset(&info, 0, sizeof(info));
1817
+ unw_init_from_blocked_task(&info, child);
1818
+ if (unw_unwind_to_user(&info) < 0)
1819
+ return 0;
1820
+
1821
+ if (unw_get_fr(&info, reg, &fpreg))
1822
+ return -1;
1823
+ if (write_access) {
1824
+ fpreg.u.bits[which_half] = *data;
1825
+ if (unw_set_fr(&info, reg, fpreg))
1826
+ return -1;
1827
+ } else {
1828
+ *data = fpreg.u.bits[which_half];
1829
+ }
1830
+ } else { /* fph */
1831
+ elf_fpreg_t *p = &child->thread.fph[reg - 32];
1832
+ unsigned long *bits = &p->u.bits[which_half];
1833
+
1834
+ ia64_sync_fph(child);
1835
+ if (write_access)
1836
+ *bits = *data;
1837
+ else if (child->thread.flags & IA64_THREAD_FPH_VALID)
1838
+ *data = *bits;
1839
+ else
1840
+ *data = 0;
1841
+ }
19571842 return 0;
19581843 }
19591844
....@@ -2039,15 +1924,14 @@
20391924 }
20401925
20411926 if (pos != -1) {
2042
- if (write_access)
2043
- ret = gpregs_set(child, NULL, pos,
2044
- sizeof(unsigned long), data, NULL);
2045
- else
2046
- ret = gpregs_get(child, NULL, pos,
2047
- sizeof(unsigned long), data, NULL);
2048
- if (ret != 0)
2049
- return -1;
2050
- return 0;
1927
+ struct unw_frame_info info;
1928
+
1929
+ memset(&info, 0, sizeof(info));
1930
+ unw_init_from_blocked_task(&info, child);
1931
+ if (unw_unwind_to_user(&info) < 0)
1932
+ return 0;
1933
+
1934
+ return access_elf_reg(child, &info, pos, data, write_access);
20511935 }
20521936
20531937 /* access debug registers */
....@@ -2064,27 +1948,6 @@
20641948 "address 0x%lx\n", addr);
20651949 return -1;
20661950 }
2067
-#ifdef CONFIG_PERFMON
2068
- /*
2069
- * Check if debug registers are used by perfmon. This
2070
- * test must be done once we know that we can do the
2071
- * operation, i.e. the arguments are all valid, but
2072
- * before we start modifying the state.
2073
- *
2074
- * Perfmon needs to keep a count of how many processes
2075
- * are trying to modify the debug registers for system
2076
- * wide monitoring sessions.
2077
- *
2078
- * We also include read access here, because they may
2079
- * cause the PMU-installed debug register state
2080
- * (dbr[], ibr[]) to be reset. The two arrays are also
2081
- * used by perfmon, but we do not use
2082
- * IA64_THREAD_DBG_VALID. The registers are restored
2083
- * by the PMU context switch code.
2084
- */
2085
- if (pfm_use_debug_registers(child))
2086
- return -1;
2087
-#endif
20881951
20891952 if (!(child->thread.flags & IA64_THREAD_DBG_VALID)) {
20901953 child->thread.flags |= IA64_THREAD_DBG_VALID;
....@@ -2113,14 +1976,14 @@
21131976 .core_note_type = NT_PRSTATUS,
21141977 .n = ELF_NGREG,
21151978 .size = sizeof(elf_greg_t), .align = sizeof(elf_greg_t),
2116
- .get = gpregs_get, .set = gpregs_set,
1979
+ .regset_get = gpregs_get, .set = gpregs_set,
21171980 .writeback = gpregs_writeback
21181981 },
21191982 {
21201983 .core_note_type = NT_PRFPREG,
21211984 .n = ELF_NFPREG,
21221985 .size = sizeof(elf_fpreg_t), .align = sizeof(elf_fpreg_t),
2123
- .get = fpregs_get, .set = fpregs_set, .active = fpregs_active
1986
+ .regset_get = fpregs_get, .set = fpregs_set, .active = fpregs_active
21241987 },
21251988 };
21261989
....@@ -2191,12 +2054,11 @@
21912054 }
21922055
21932056 void ia64_syscall_get_set_arguments(struct task_struct *task,
2194
- struct pt_regs *regs, unsigned int i, unsigned int n,
2195
- unsigned long *args, int rw)
2057
+ struct pt_regs *regs, unsigned long *args, int rw)
21962058 {
21972059 struct syscall_get_set_args data = {
2198
- .i = i,
2199
- .n = n,
2060
+ .i = 0,
2061
+ .n = 6,
22002062 .args = args,
22012063 .regs = regs,
22022064 .rw = rw,