Loading...
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | // SPDX-License-Identifier: GPL-2.0-or-later #include <linux/regset.h> #include <asm/switch_to.h> #include <asm/tm.h> #include <asm/asm-prototypes.h> #include "ptrace-decl.h" void flush_tmregs_to_thread(struct task_struct *tsk) { /* * If task is not current, it will have been flushed already to * it's thread_struct during __switch_to(). * * A reclaim flushes ALL the state or if not in TM save TM SPRs * in the appropriate thread structures from live. */ if (!cpu_has_feature(CPU_FTR_TM) || tsk != current) return; if (MSR_TM_SUSPENDED(mfmsr())) { tm_reclaim_current(TM_CAUSE_SIGNAL); } else { tm_enable(); tm_save_sprs(&tsk->thread); } } static unsigned long get_user_ckpt_msr(struct task_struct *task) { return task->thread.ckpt_regs.msr | task->thread.fpexc_mode; } static int set_user_ckpt_msr(struct task_struct *task, unsigned long msr) { task->thread.ckpt_regs.msr &= ~MSR_DEBUGCHANGE; task->thread.ckpt_regs.msr |= msr & MSR_DEBUGCHANGE; return 0; } static int set_user_ckpt_trap(struct task_struct *task, unsigned long trap) { set_trap(&task->thread.ckpt_regs, trap); return 0; } /** * tm_cgpr_active - get active number of registers in CGPR * @target: The target task. * @regset: The user regset structure. * * This function checks for the active number of available * regisers in transaction checkpointed GPR category. */ int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return 0; return regset->n; } /** * tm_cgpr_get - get CGPR registers * @target: The target task. * @regset: The user regset structure. * @to: Destination of copy. * * This function gets transaction checkpointed GPR registers. * * When the transaction is active, 'ckpt_regs' holds all the checkpointed * GPR register values for the current transaction to fall back on if it * aborts in between. This function gets those checkpointed GPR registers. * The userspace interface buffer layout is as follows. * * struct data { * struct pt_regs ckpt_regs; * }; */ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr)); #ifdef CONFIG_PPC64 struct membuf to_softe = membuf_at(&to, offsetof(struct pt_regs, softe)); #endif if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); membuf_write(&to, &target->thread.ckpt_regs, sizeof(struct user_pt_regs)); membuf_store(&to_msr, get_user_ckpt_msr(target)); #ifdef CONFIG_PPC64 membuf_store(&to_softe, 0x1ul); #endif return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) - sizeof(struct user_pt_regs)); } /* * tm_cgpr_set - set the CGPR registers * @target: The target task. * @regset: The user regset structure. * @pos: The buffer position. * @count: Number of bytes to copy. * @kbuf: Kernel buffer to copy into. * @ubuf: User buffer to copy from. * * This function sets in transaction checkpointed GPR registers. * * When the transaction is active, 'ckpt_regs' holds the checkpointed * GPR register values for the current transaction to fall back on if it * aborts in between. This function sets those checkpointed GPR registers. * The userspace interface buffer layout is as follows. * * struct data { * struct pt_regs ckpt_regs; * }; */ int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { unsigned long reg; int ret; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ckpt_regs, 0, PT_MSR * sizeof(reg)); if (!ret && count > 0) { ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®, PT_MSR * sizeof(reg), (PT_MSR + 1) * sizeof(reg)); if (!ret) ret = set_user_ckpt_msr(target, reg); } BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) != offsetof(struct pt_regs, msr) + sizeof(long)); if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ckpt_regs.orig_gpr3, PT_ORIG_R3 * sizeof(reg), (PT_MAX_PUT_REG + 1) * sizeof(reg)); if (PT_MAX_PUT_REG + 1 < PT_TRAP && !ret) ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, (PT_MAX_PUT_REG + 1) * sizeof(reg), PT_TRAP * sizeof(reg)); if (!ret && count > 0) { ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ®, PT_TRAP * sizeof(reg), (PT_TRAP + 1) * sizeof(reg)); if (!ret) ret = set_user_ckpt_trap(target, reg); } if (!ret) ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, (PT_TRAP + 1) * sizeof(reg), -1); return ret; } /** * tm_cfpr_active - get active number of registers in CFPR * @target: The target task. * @regset: The user regset structure. * * This function checks for the active number of available * regisers in transaction checkpointed FPR category. */ int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return 0; return regset->n; } /** * tm_cfpr_get - get CFPR registers * @target: The target task. * @regset: The user regset structure. * @to: Destination of copy. * * This function gets in transaction checkpointed FPR registers. * * When the transaction is active 'ckfp_state' holds the checkpointed * values for the current transaction to fall back on if it aborts * in between. This function gets those checkpointed FPR registers. * The userspace interface buffer layout is as follows. * * struct data { * u64 fpr[32]; * u64 fpscr; *}; */ int tm_cfpr_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { u64 buf[33]; int i; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); /* copy to local buffer then write that out */ for (i = 0; i < 32 ; i++) buf[i] = target->thread.TS_CKFPR(i); buf[32] = target->thread.ckfp_state.fpscr; return membuf_write(&to, buf, sizeof(buf)); } /** * tm_cfpr_set - set CFPR registers * @target: The target task. * @regset: The user regset structure. * @pos: The buffer position. * @count: Number of bytes to copy. * @kbuf: Kernel buffer to copy into. * @ubuf: User buffer to copy from. * * This function sets in transaction checkpointed FPR registers. * * When the transaction is active 'ckfp_state' holds the checkpointed * FPR register values for the current transaction to fall back on * if it aborts in between. This function sets these checkpointed * FPR registers. The userspace interface buffer layout is as follows. * * struct data { * u64 fpr[32]; * u64 fpscr; *}; */ int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { u64 buf[33]; int i; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); for (i = 0; i < 32; i++) buf[i] = target->thread.TS_CKFPR(i); buf[32] = target->thread.ckfp_state.fpscr; /* copy to local buffer then write that out */ i = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, -1); if (i) return i; for (i = 0; i < 32 ; i++) target->thread.TS_CKFPR(i) = buf[i]; target->thread.ckfp_state.fpscr = buf[32]; return 0; } /** * tm_cvmx_active - get active number of registers in CVMX * @target: The target task. * @regset: The user regset structure. * * This function checks for the active number of available * regisers in checkpointed VMX category. */ int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return 0; return regset->n; } /** * tm_cvmx_get - get CMVX registers * @target: The target task. * @regset: The user regset structure. * @to: Destination of copy. * * This function gets in transaction checkpointed VMX registers. * * When the transaction is active 'ckvr_state' and 'ckvrsave' hold * the checkpointed values for the current transaction to fall * back on if it aborts in between. The userspace interface buffer * layout is as follows. * * struct data { * vector128 vr[32]; * vector128 vscr; * vector128 vrsave; *}; */ int tm_cvmx_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { union { elf_vrreg_t reg; u32 word; } vrsave; BUILD_BUG_ON(TVSO(vscr) != TVSO(vr[32])); if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; /* Flush the state */ flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); membuf_write(&to, &target->thread.ckvr_state, 33 * sizeof(vector128)); /* * Copy out only the low-order word of vrsave. */ memset(&vrsave, 0, sizeof(vrsave)); vrsave.word = target->thread.ckvrsave; return membuf_write(&to, &vrsave, sizeof(vrsave)); } /** * tm_cvmx_set - set CMVX registers * @target: The target task. * @regset: The user regset structure. * @pos: The buffer position. * @count: Number of bytes to copy. * @kbuf: Kernel buffer to copy into. * @ubuf: User buffer to copy from. * * This function sets in transaction checkpointed VMX registers. * * When the transaction is active 'ckvr_state' and 'ckvrsave' hold * the checkpointed values for the current transaction to fall * back on if it aborts in between. The userspace interface buffer * layout is as follows. * * struct data { * vector128 vr[32]; * vector128 vscr; * vector128 vrsave; *}; */ int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret; BUILD_BUG_ON(TVSO(vscr) != TVSO(vr[32])); if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ckvr_state, 0, 33 * sizeof(vector128)); if (!ret && count > 0) { /* * We use only the low-order word of vrsave. */ union { elf_vrreg_t reg; u32 word; } vrsave; memset(&vrsave, 0, sizeof(vrsave)); vrsave.word = target->thread.ckvrsave; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &vrsave, 33 * sizeof(vector128), -1); if (!ret) target->thread.ckvrsave = vrsave.word; } return ret; } /** * tm_cvsx_active - get active number of registers in CVSX * @target: The target task. * @regset: The user regset structure. * * This function checks for the active number of available * regisers in transaction checkpointed VSX category. */ int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return 0; flush_vsx_to_thread(target); return target->thread.used_vsr ? regset->n : 0; } /** * tm_cvsx_get - get CVSX registers * @target: The target task. * @regset: The user regset structure. * @to: Destination of copy. * * This function gets in transaction checkpointed VSX registers. * * When the transaction is active 'ckfp_state' holds the checkpointed * values for the current transaction to fall back on if it aborts * in between. This function gets those checkpointed VSX registers. * The userspace interface buffer layout is as follows. * * struct data { * u64 vsx[32]; *}; */ int tm_cvsx_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { u64 buf[32]; int i; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; /* Flush the state */ flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); flush_vsx_to_thread(target); for (i = 0; i < 32 ; i++) buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET]; return membuf_write(&to, buf, 32 * sizeof(double)); } /** * tm_cvsx_set - set CFPR registers * @target: The target task. * @regset: The user regset structure. * @pos: The buffer position. * @count: Number of bytes to copy. * @kbuf: Kernel buffer to copy into. * @ubuf: User buffer to copy from. * * This function sets in transaction checkpointed VSX registers. * * When the transaction is active 'ckfp_state' holds the checkpointed * VSX register values for the current transaction to fall back on * if it aborts in between. This function sets these checkpointed * FPR registers. The userspace interface buffer layout is as follows. * * struct data { * u64 vsx[32]; *}; */ int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { u64 buf[32]; int ret, i; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; /* Flush the state */ flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); flush_vsx_to_thread(target); for (i = 0; i < 32 ; i++) buf[i] = target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET]; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, buf, 0, 32 * sizeof(double)); if (!ret) for (i = 0; i < 32 ; i++) target->thread.ckfp_state.fpr[i][TS_VSRLOWOFFSET] = buf[i]; return ret; } /** * tm_spr_active - get active number of registers in TM SPR * @target: The target task. * @regset: The user regset structure. * * This function checks the active number of available * regisers in the transactional memory SPR category. */ int tm_spr_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; return regset->n; } /** * tm_spr_get - get the TM related SPR registers * @target: The target task. * @regset: The user regset structure. * @to: Destination of copy. * * This function gets transactional memory related SPR registers. * The userspace interface buffer layout is as follows. * * struct { * u64 tm_tfhar; * u64 tm_texasr; * u64 tm_tfiar; * }; */ int tm_spr_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { /* Build tests */ BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr)); BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar)); BUILD_BUG_ON(TSO(tm_tfiar) + sizeof(u64) != TSO(ckpt_regs)); if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; /* Flush the states */ flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); /* TFHAR register */ membuf_write(&to, &target->thread.tm_tfhar, sizeof(u64)); /* TEXASR register */ membuf_write(&to, &target->thread.tm_texasr, sizeof(u64)); /* TFIAR register */ return membuf_write(&to, &target->thread.tm_tfiar, sizeof(u64)); } /** * tm_spr_set - set the TM related SPR registers * @target: The target task. * @regset: The user regset structure. * @pos: The buffer position. * @count: Number of bytes to copy. * @kbuf: Kernel buffer to copy into. * @ubuf: User buffer to copy from. * * This function sets transactional memory related SPR registers. * The userspace interface buffer layout is as follows. * * struct { * u64 tm_tfhar; * u64 tm_texasr; * u64 tm_tfiar; * }; */ int tm_spr_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret; /* Build tests */ BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr)); BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar)); BUILD_BUG_ON(TSO(tm_tfiar) + sizeof(u64) != TSO(ckpt_regs)); if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; /* Flush the states */ flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); /* TFHAR register */ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.tm_tfhar, 0, sizeof(u64)); /* TEXASR register */ if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.tm_texasr, sizeof(u64), 2 * sizeof(u64)); /* TFIAR register */ if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.tm_tfiar, 2 * sizeof(u64), 3 * sizeof(u64)); return ret; } int tm_tar_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (MSR_TM_ACTIVE(target->thread.regs->msr)) return regset->n; return 0; } int tm_tar_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; return membuf_write(&to, &target->thread.tm_tar, sizeof(u64)); } int tm_tar_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.tm_tar, 0, sizeof(u64)); return ret; } int tm_ppr_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (MSR_TM_ACTIVE(target->thread.regs->msr)) return regset->n; return 0; } int tm_ppr_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; return membuf_write(&to, &target->thread.tm_ppr, sizeof(u64)); } int tm_ppr_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.tm_ppr, 0, sizeof(u64)); return ret; } int tm_dscr_active(struct task_struct *target, const struct user_regset *regset) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (MSR_TM_ACTIVE(target->thread.regs->msr)) return regset->n; return 0; } int tm_dscr_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; return membuf_write(&to, &target->thread.tm_dscr, sizeof(u64)); } int tm_dscr_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret; if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; if (!MSR_TM_ACTIVE(target->thread.regs->msr)) return -ENODATA; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.tm_dscr, 0, sizeof(u64)); return ret; } int tm_cgpr32_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { gpr32_get_common(target, regset, to, &target->thread.ckpt_regs.gpr[0]); return membuf_zero(&to, ELF_NGREG * sizeof(u32)); } int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { return gpr32_set_common(target, regset, pos, count, kbuf, ubuf, &target->thread.ckpt_regs.gpr[0]); } |