@@ -391,31 +391,11 @@ void do_syscall_trace_exit(struct pt_regs *regs)
391391
392392static int fpr_get (struct task_struct * target ,
393393 const struct user_regset * regset ,
394- unsigned int pos , unsigned int count ,
395- void * kbuf , void __user * ubuf )
394+ struct membuf to )
396395{
397396 struct pt_regs * regs = task_regs (target );
398- __u64 * k = kbuf ;
399- __u64 __user * u = ubuf ;
400- __u64 reg ;
401-
402- pos /= sizeof (reg );
403- count /= sizeof (reg );
404-
405- if (kbuf )
406- for (; count > 0 && pos < ELF_NFPREG ; -- count )
407- * k ++ = regs -> fr [pos ++ ];
408- else
409- for (; count > 0 && pos < ELF_NFPREG ; -- count )
410- if (__put_user (regs -> fr [pos ++ ], u ++ ))
411- return - EFAULT ;
412397
413- kbuf = k ;
414- ubuf = u ;
415- pos *= sizeof (reg );
416- count *= sizeof (reg );
417- return user_regset_copyout_zero (& pos , & count , & kbuf , & ubuf ,
418- ELF_NFPREG * sizeof (reg ), -1 );
398+ return membuf_write (& to , regs -> fr , ELF_NFPREG * sizeof (__u64 ));
419399}
420400
421401static int fpr_set (struct task_struct * target ,
@@ -527,30 +507,14 @@ static void set_reg(struct pt_regs *regs, int num, unsigned long val)
527507
528508static int gpr_get (struct task_struct * target ,
529509 const struct user_regset * regset ,
530- unsigned int pos , unsigned int count ,
531- void * kbuf , void __user * ubuf )
510+ struct membuf to )
532511{
533512 struct pt_regs * regs = task_regs (target );
534- unsigned long * k = kbuf ;
535- unsigned long __user * u = ubuf ;
536- unsigned long reg ;
513+ unsigned int pos ;
537514
538- pos /= sizeof (reg );
539- count /= sizeof (reg );
540-
541- if (kbuf )
542- for (; count > 0 && pos < ELF_NGREG ; -- count )
543- * k ++ = get_reg (regs , pos ++ );
544- else
545- for (; count > 0 && pos < ELF_NGREG ; -- count )
546- if (__put_user (get_reg (regs , pos ++ ), u ++ ))
547- return - EFAULT ;
548- kbuf = k ;
549- ubuf = u ;
550- pos *= sizeof (reg );
551- count *= sizeof (reg );
552- return user_regset_copyout_zero (& pos , & count , & kbuf , & ubuf ,
553- ELF_NGREG * sizeof (reg ), -1 );
515+ for (pos = 0 ; pos < ELF_NGREG ; pos ++ )
516+ membuf_store (& to , get_reg (regs , pos ));
517+ return 0 ;
554518}
555519
556520static int gpr_set (struct task_struct * target ,
@@ -588,12 +552,12 @@ static const struct user_regset native_regsets[] = {
588552 [REGSET_GENERAL ] = {
589553 .core_note_type = NT_PRSTATUS , .n = ELF_NGREG ,
590554 .size = sizeof (long ), .align = sizeof (long ),
591- .get = gpr_get , .set = gpr_set
555+ .regset_get = gpr_get , .set = gpr_set
592556 },
593557 [REGSET_FP ] = {
594558 .core_note_type = NT_PRFPREG , .n = ELF_NFPREG ,
595559 .size = sizeof (__u64 ), .align = sizeof (__u64 ),
596- .get = fpr_get , .set = fpr_set
560+ .regset_get = fpr_get , .set = fpr_set
597561 }
598562};
599563
@@ -607,31 +571,15 @@ static const struct user_regset_view user_parisc_native_view = {
607571
608572static int gpr32_get (struct task_struct * target ,
609573 const struct user_regset * regset ,
610- unsigned int pos , unsigned int count ,
611- void * kbuf , void __user * ubuf )
574+ struct membuf to )
612575{
613576 struct pt_regs * regs = task_regs (target );
614- compat_ulong_t * k = kbuf ;
615- compat_ulong_t __user * u = ubuf ;
616- compat_ulong_t reg ;
577+ unsigned int pos ;
617578
618- pos /= sizeof ( reg );
619- count /= sizeof ( reg );
579+ for ( pos = 0 ; pos < ELF_NGREG ; pos ++ )
580+ membuf_store ( & to , ( compat_ulong_t ) get_reg ( regs , pos ) );
620581
621- if (kbuf )
622- for (; count > 0 && pos < ELF_NGREG ; -- count )
623- * k ++ = get_reg (regs , pos ++ );
624- else
625- for (; count > 0 && pos < ELF_NGREG ; -- count )
626- if (__put_user ((compat_ulong_t ) get_reg (regs , pos ++ ), u ++ ))
627- return - EFAULT ;
628-
629- kbuf = k ;
630- ubuf = u ;
631- pos *= sizeof (reg );
632- count *= sizeof (reg );
633- return user_regset_copyout_zero (& pos , & count , & kbuf , & ubuf ,
634- ELF_NGREG * sizeof (reg ), -1 );
582+ return 0 ;
635583}
636584
637585static int gpr32_set (struct task_struct * target ,
@@ -672,12 +620,12 @@ static const struct user_regset compat_regsets[] = {
672620 [REGSET_GENERAL ] = {
673621 .core_note_type = NT_PRSTATUS , .n = ELF_NGREG ,
674622 .size = sizeof (compat_long_t ), .align = sizeof (compat_long_t ),
675- .get = gpr32_get , .set = gpr32_set
623+ .regset_get = gpr32_get , .set = gpr32_set
676624 },
677625 [REGSET_FP ] = {
678626 .core_note_type = NT_PRFPREG , .n = ELF_NFPREG ,
679627 .size = sizeof (__u64 ), .align = sizeof (__u64 ),
680- .get = fpr_get , .set = fpr_set
628+ .regset_get = fpr_get , .set = fpr_set
681629 }
682630};
683631
0 commit comments