> Date: Fri, 9 Sep 2016 20:47:47 -0700
> From: Philip Guenther <[email protected]>
> 
> Simplify syscall():
>  - if the trapframe is of a 32bit process, just call sigexit() instead of 
>    returning an error
>  - delete other code for 32bit processes
>  - 64bit processes only, so SYS__syscall can be handled the same as 
>    SYS_syscall
>  - delete a superfluous cast
> 
> builds and runs fine
> 
> ok?

ok kettenis@, but it is probably time to rewrite the comment above
thie function as well.

> Index: trap.c
> ===================================================================
> RCS file: /data/src/openbsd/src/sys/arch/sparc64/sparc64/trap.c,v
> retrieving revision 1.88
> diff -u -p -r1.88 trap.c
> --- trap.c    27 Feb 2016 13:08:07 -0000      1.88
> +++ trap.c    10 Sep 2016 03:27:37 -0000
> @@ -1222,6 +1222,9 @@ syscall(tf, code, pc)
>       register_t args[8];
>       register_t rval[2];
>  
> +     if ((tf->tf_out[6] & 1) == 0)
> +             sigexit(p, SIGILL);
> +
>       uvmexp.syscalls++;
>       p = curproc;
>  #ifdef DIAGNOSTIC
> @@ -1255,29 +1258,15 @@ syscall(tf, code, pc)
>  
>       switch (code) {
>       case SYS_syscall:
> +     case SYS___syscall:
>               code = *ap++;
>               nap--;
>               break;
> -     case SYS___syscall:
> -             if (code < nsys && callp[code].sy_call !=
> -                 callp[p->p_p->ps_emul->e_nosys].sy_call)
> -                     break; /* valid system call */
> -             if (tf->tf_out[6] & 1L) {
> -                     /* longs *are* quadwords */
> -                     code = ap[0];
> -                     ap += 1;
> -                     nap -= 1;                       
> -             } else {
> -                     code = ap[_QUAD_LOWWORD];
> -                     ap += 2;
> -                     nap -= 2;
> -             }
> -             break;
>       }
>  
>       if (code < 0 || code >= nsys)
>               callp += p->p_p->ps_emul->e_nosys;
> -     else if (tf->tf_out[6] & 1L) {
> +     else {
>               register_t *argp;
>  
>               callp += code;
> @@ -1286,7 +1275,7 @@ syscall(tf, code, pc)
>                       if (i > 8)
>                               panic("syscall nargs");
>                       /* Read the whole block in */
> -                     if ((error = copyin((caddr_t)(u_long)tf->tf_out[6]
> +                     if ((error = copyin((caddr_t)tf->tf_out[6]
>                           + BIAS + offsetof(struct frame64, fr_argx),
>                           &args[nap], (i - nap) * sizeof(register_t))))
>                               goto bad;
> @@ -1298,9 +1287,6 @@ syscall(tf, code, pc)
>                */
>               for (argp = args; i--;) 
>                       *argp++ = *ap++;
> -     } else {
> -             error = EFAULT;
> -             goto bad;
>       }
>  
>       rval[0] = 0;
> 
> 

Reply via email to