3535#include <linux/elfcore.h>
3636#include <linux/coredump.h>
3737#include <linux/dax.h>
38+ #include <linux/regset.h>
3839
3940#include <linux/uaccess.h>
4041#include <asm/param.h>
@@ -1456,8 +1457,7 @@ struct elf_thread_status
14561457 struct elf_thread_status * next ;
14571458 struct elf_prstatus_fdpic prstatus ; /* NT_PRSTATUS */
14581459 elf_fpregset_t fpu ; /* NT_PRFPREG */
1459- struct task_struct * thread ;
1460- struct memelfnote notes [3 ];
1460+ struct memelfnote notes [2 ];
14611461 int num_notes ;
14621462};
14631463
@@ -1468,22 +1468,35 @@ struct elf_thread_status
14681468 */
14691469static struct elf_thread_status * elf_dump_thread_status (long signr , struct task_struct * p , int * sz )
14701470{
1471+ const struct user_regset_view * view = task_user_regset_view (p );
14711472 struct elf_thread_status * t ;
1473+ int i , ret ;
14721474
14731475 t = kzalloc (sizeof (struct elf_thread_status ), GFP_KERNEL );
14741476 if (!t )
14751477 return t ;
14761478
14771479 fill_prstatus (& t -> prstatus , p , signr );
1478- elf_core_copy_task_regs (p , & t -> prstatus .pr_reg );
1480+ regset_get (p , & view -> regsets [0 ],
1481+ sizeof (t -> prstatus .pr_reg ), & t -> prstatus .pr_reg );
14791482
14801483 fill_note (& t -> notes [0 ], "CORE" , NT_PRSTATUS , sizeof (t -> prstatus ),
14811484 & t -> prstatus );
14821485 t -> num_notes ++ ;
14831486 * sz += notesize (& t -> notes [0 ]);
14841487
1485- t -> prstatus .pr_fpvalid = elf_core_copy_task_fpregs (p , task_pt_regs (p ),
1486- & t -> fpu );
1488+ for (i = 1 ; i < view -> n ; ++ i ) {
1489+ const struct user_regset * regset = & view -> regsets [i ];
1490+ if (regset -> core_note_type != NT_PRFPREG )
1491+ continue ;
1492+ if (regset -> active && regset -> active (p , regset ) <= 0 )
1493+ continue ;
1494+ ret = regset_get (p , regset , sizeof (t -> fpu ), & t -> fpu );
1495+ if (ret >= 0 )
1496+ t -> prstatus .pr_fpvalid = 1 ;
1497+ break ;
1498+ }
1499+
14871500 if (t -> prstatus .pr_fpvalid ) {
14881501 fill_note (& t -> notes [1 ], "CORE" , NT_PRFPREG , sizeof (t -> fpu ),
14891502 & t -> fpu );
0 commit comments