35
35
#include <linux/elfcore.h>
36
36
#include <linux/coredump.h>
37
37
#include <linux/dax.h>
38
+ #include <linux/regset.h>
38
39
39
40
#include <linux/uaccess.h>
40
41
#include <asm/param.h>
@@ -1456,8 +1457,7 @@ struct elf_thread_status
1456
1457
struct elf_thread_status * next ;
1457
1458
struct elf_prstatus_fdpic prstatus ; /* NT_PRSTATUS */
1458
1459
elf_fpregset_t fpu ; /* NT_PRFPREG */
1459
- struct task_struct * thread ;
1460
- struct memelfnote notes [3 ];
1460
+ struct memelfnote notes [2 ];
1461
1461
int num_notes ;
1462
1462
};
1463
1463
@@ -1468,22 +1468,35 @@ struct elf_thread_status
1468
1468
*/
1469
1469
static struct elf_thread_status * elf_dump_thread_status (long signr , struct task_struct * p , int * sz )
1470
1470
{
1471
+ const struct user_regset_view * view = task_user_regset_view (p );
1471
1472
struct elf_thread_status * t ;
1473
+ int i , ret ;
1472
1474
1473
1475
t = kzalloc (sizeof (struct elf_thread_status ), GFP_KERNEL );
1474
1476
if (!t )
1475
1477
return t ;
1476
1478
1477
1479
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 );
1479
1482
1480
1483
fill_note (& t -> notes [0 ], "CORE" , NT_PRSTATUS , sizeof (t -> prstatus ),
1481
1484
& t -> prstatus );
1482
1485
t -> num_notes ++ ;
1483
1486
* sz += notesize (& t -> notes [0 ]);
1484
1487
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
+
1487
1500
if (t -> prstatus .pr_fpvalid ) {
1488
1501
fill_note (& t -> notes [1 ], "CORE" , NT_PRFPREG , sizeof (t -> fpu ),
1489
1502
& t -> fpu );
0 commit comments