@@ -30,13 +30,10 @@ enum riscv_regset {
30
30
31
31
static int riscv_gpr_get (struct task_struct * target ,
32
32
const struct user_regset * regset ,
33
- unsigned int pos , unsigned int count ,
34
- void * kbuf , void __user * ubuf )
33
+ struct membuf to )
35
34
{
36
- struct pt_regs * regs ;
37
-
38
- regs = task_pt_regs (target );
39
- return user_regset_copyout (& pos , & count , & kbuf , & ubuf , regs , 0 , -1 );
35
+ return membuf_write (& to , task_pt_regs (target ),
36
+ sizeof (struct user_regs_struct ));
40
37
}
41
38
42
39
static int riscv_gpr_set (struct task_struct * target ,
@@ -55,21 +52,13 @@ static int riscv_gpr_set(struct task_struct *target,
55
52
#ifdef CONFIG_FPU
56
53
static int riscv_fpr_get (struct task_struct * target ,
57
54
const struct user_regset * regset ,
58
- unsigned int pos , unsigned int count ,
59
- void * kbuf , void __user * ubuf )
55
+ struct membuf to )
60
56
{
61
- int ret ;
62
57
struct __riscv_d_ext_state * fstate = & target -> thread .fstate ;
63
58
64
- ret = user_regset_copyout (& pos , & count , & kbuf , & ubuf , fstate , 0 ,
65
- offsetof(struct __riscv_d_ext_state , fcsr ));
66
- if (!ret ) {
67
- ret = user_regset_copyout (& pos , & count , & kbuf , & ubuf , fstate , 0 ,
68
- offsetof(struct __riscv_d_ext_state , fcsr ) +
69
- sizeof (fstate -> fcsr ));
70
- }
71
-
72
- return ret ;
59
+ membuf_write (& to , fstate , offsetof(struct __riscv_d_ext_state , fcsr ));
60
+ membuf_store (& to , fstate -> fcsr );
61
+ return membuf_zero (& to , 4 ); // explicitly pad
73
62
}
74
63
75
64
static int riscv_fpr_set (struct task_struct * target ,
@@ -98,17 +87,17 @@ static const struct user_regset riscv_user_regset[] = {
98
87
.n = ELF_NGREG ,
99
88
.size = sizeof (elf_greg_t ),
100
89
.align = sizeof (elf_greg_t ),
101
- .get = & riscv_gpr_get ,
102
- .set = & riscv_gpr_set ,
90
+ .regset_get = riscv_gpr_get ,
91
+ .set = riscv_gpr_set ,
103
92
},
104
93
#ifdef CONFIG_FPU
105
94
[REGSET_F ] = {
106
95
.core_note_type = NT_PRFPREG ,
107
96
.n = ELF_NFPREG ,
108
97
.size = sizeof (elf_fpreg_t ),
109
98
.align = sizeof (elf_fpreg_t ),
110
- .get = & riscv_fpr_get ,
111
- .set = & riscv_fpr_set ,
99
+ .regset_get = riscv_fpr_get ,
100
+ .set = riscv_fpr_set ,
112
101
},
113
102
#endif
114
103
};
0 commit comments