@@ -184,19 +184,75 @@ static int genregs_set(struct task_struct *target,
184184 return ret ;
185185}
186186
187+ #ifdef CONFIG_ISA_ARCV2
188+ static int arcv2regs_get (struct task_struct * target ,
189+ const struct user_regset * regset ,
190+ unsigned int pos , unsigned int count ,
191+ void * kbuf , void __user * ubuf )
192+ {
193+ const struct pt_regs * regs = task_pt_regs (target );
194+ int ret , copy_sz ;
195+
196+ if (IS_ENABLED (CONFIG_ARC_HAS_ACCL_REGS ))
197+ copy_sz = sizeof (struct user_regs_arcv2 );
198+ else
199+ copy_sz = 4 ; /* r30 only */
200+
201+ /*
202+ * itemized copy not needed like above as layout of regs (r30,r58,r59)
203+ * is exactly same in kernel (pt_regs) and userspace (user_regs_arcv2)
204+ */
205+ ret = user_regset_copyout (& pos , & count , & kbuf , & ubuf , & regs -> r30 ,
206+ 0 , copy_sz );
207+
208+ return ret ;
209+ }
210+
211+ static int arcv2regs_set (struct task_struct * target ,
212+ const struct user_regset * regset ,
213+ unsigned int pos , unsigned int count ,
214+ const void * kbuf , const void __user * ubuf )
215+ {
216+ const struct pt_regs * regs = task_pt_regs (target );
217+ int ret , copy_sz ;
218+
219+ if (IS_ENABLED (CONFIG_ARC_HAS_ACCL_REGS ))
220+ copy_sz = sizeof (struct user_regs_arcv2 );
221+ else
222+ copy_sz = 4 ; /* r30 only */
223+
224+ ret = user_regset_copyin (& pos , & count , & kbuf , & ubuf , (void * )& regs -> r30 ,
225+ 0 , copy_sz );
226+
227+ return ret ;
228+ }
229+
230+ #endif
231+
187232enum arc_getset {
188- REGSET_GENERAL ,
233+ REGSET_CMN ,
234+ REGSET_ARCV2 ,
189235};
190236
191237static const struct user_regset arc_regsets [] = {
192- [REGSET_GENERAL ] = {
238+ [REGSET_CMN ] = {
193239 .core_note_type = NT_PRSTATUS ,
194240 .n = ELF_NGREG ,
195241 .size = sizeof (unsigned long ),
196242 .align = sizeof (unsigned long ),
197243 .get = genregs_get ,
198244 .set = genregs_set ,
199- }
245+ },
246+ #ifdef CONFIG_ISA_ARCV2
247+ [REGSET_ARCV2 ] = {
248+ .core_note_type = NT_ARC_V2 ,
249+ .n = ELF_ARCV2REG ,
250+ .size = sizeof (unsigned long ),
251+ .align = sizeof (unsigned long ),
252+ .get = arcv2regs_get ,
253+ .set = arcv2regs_set ,
254+ },
255+ #endif
200256};
201257
202258static const struct user_regset_view user_arc_view = {
0 commit comments