Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 Style and remove dead stuff.



details:   https://anonhg.NetBSD.org/src/rev/46563fb30a9f
branches:  trunk
changeset: 459039:46563fb30a9f
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Aug 21 12:46:56 2019 +0000

description:
Style and remove dead stuff.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c |  112 +++++++------------------------
 1 files changed, 25 insertions(+), 87 deletions(-)

diffs (250 lines):

diff -r 16bfdc0856ac -r 46563fb30a9f sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Wed Aug 21 12:33:12 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Wed Aug 21 12:46:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.126 2019/08/21 12:33:12 maxv Exp $      */
+/*     $NetBSD: netbsd32_machdep.c,v 1.127 2019/08/21 12:46:56 maxv Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.126 2019/08/21 12:33:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.127 2019/08/21 12:46:56 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -84,8 +84,8 @@
 #include <compat/sys/signalvar.h>
 
 /* Provide a the name of the architecture we're emulating */
-const char     machine32[] = "i386";
-const char     machine_arch32[] = "i386";      
+const char machine32[] = "i386";
+const char machine_arch32[] = "i386";
 
 #ifdef USER_LDT
 static int x86_64_get_ldt32(struct lwp *, void *, register_t *);
@@ -104,10 +104,8 @@
 #endif
 
 int check_sigcontext32(struct lwp *, const struct netbsd32_sigcontext *);
-
-void  netbsd32_buildcontext(struct lwp *l, struct trapframe *tf, void *fp,
-    sig_t catcher, int onstack);
-
+void netbsd32_buildcontext(struct lwp *, struct trapframe *, void *,
+    sig_t, int);
 int netbsd32_sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
 
 #ifdef EXEC_AOUT
@@ -288,7 +286,7 @@
 #ifdef COREDUMP
 /*
  * Dump the machine specific segment at the start of a core dump.
- */     
+ */
 struct md_core32 {
        struct reg32 intreg;
        struct fpreg32 freg;
@@ -389,7 +387,7 @@
 netbsd32_process_read_fpregs(struct lwp *l, struct fpreg32 *regs, size_t *sz)
 {
 
-       __CTASSERT(sizeof *regs == sizeof (struct save87));
+       __CTASSERT(sizeof(*regs) == sizeof(struct save87));
        process_read_fpregs_s87(l, (struct save87 *)regs);
        return 0;
 }
@@ -467,7 +465,7 @@
     size_t sz)
 {
 
-       __CTASSERT(sizeof *regs == sizeof (struct save87));
+       __CTASSERT(sizeof(*regs) == sizeof(struct save87));
        process_write_fpregs_s87(l, (const struct save87 *)regs);
        return 0;
 }
@@ -515,11 +513,11 @@
                error = x86_iopl(l,
                    NETBSD32PTR64(SCARG(uap, parms)), retval);
                break;
-       case X86_GET_LDT: 
+       case X86_GET_LDT:
                error = x86_64_get_ldt32(l,
                    NETBSD32PTR64(SCARG(uap, parms)), retval);
                break;
-       case X86_SET_LDT: 
+       case X86_SET_LDT:
                error = x86_64_set_ldt32(l,
                    NETBSD32PTR64(SCARG(uap, parms)), retval);
                break;
@@ -548,7 +546,7 @@
        int error;
 
        if ((error = copyin(args, &ua32, sizeof(ua32))) != 0)
-               return (error);
+               return error;
 
        ua.start = ua32.start;
        ua.num = ua32.num;
@@ -621,18 +619,18 @@
        error = kauth_authorize_machdep(l->l_cred, KAUTH_MACHDEP_MTRR_GET,
            NULL, NULL, NULL, NULL);
        if (error)
-               return (error);
+               return error;
 
-       error = copyin(args, &args32, sizeof args32);
+       error = copyin(args, &args32, sizeof(args32));
        if (error != 0)
                return error;
 
        if (args32.mtrrp == 0) {
                n = (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR_MAX);
-               return copyout(&n, (void *)(uintptr_t)args32.n, sizeof n);
+               return copyout(&n, (void *)(uintptr_t)args32.n, sizeof(n));
        }
 
-       error = copyin((void *)(uintptr_t)args32.n, &n, sizeof n);
+       error = copyin((void *)(uintptr_t)args32.n, &n, sizeof(n));
        if (error != 0)
                return error;
 
@@ -652,7 +650,7 @@
                m32.type = mp->type;
                m32.flags = mp->flags;
                m32.owner = mp->owner;
-               error = copyout(&m32, m32p, sizeof m32);
+               error = copyout(&m32, m32p, sizeof(m32));
                if (error != 0)
                        break;
                mp++;
@@ -663,7 +661,7 @@
                kmem_free(m64p, size);
        if (error != 0)
                n = 0;
-       copyout(&n, (void *)(uintptr_t)args32.n, sizeof n);
+       copyout(&n, (void *)(uintptr_t)args32.n, sizeof(n));
        return error;
 }
 
@@ -685,13 +683,13 @@
        error = kauth_authorize_machdep(l->l_cred, KAUTH_MACHDEP_MTRR_SET,
            NULL, NULL, NULL, NULL);
        if (error)
-               return (error);
+               return error;
 
-       error = copyin(args, &args32, sizeof args32);
+       error = copyin(args, &args32, sizeof(args32));
        if (error != 0)
                return error;
 
-       error = copyin((void *)(uintptr_t)args32.n, &n, sizeof n);
+       error = copyin((void *)(uintptr_t)args32.n, &n, sizeof(n));
        if (error != 0)
                return error;
 
@@ -705,7 +703,7 @@
        m32p = (struct mtrr32 *)(uintptr_t)args32.mtrrp;
        mp = m64p;
        for (i = 0; i < n; i++) {
-               error = copyin(m32p, &m32, sizeof m32);
+               error = copyin(m32p, &m32, sizeof(m32));
                if (error != 0)
                        goto fail;
                mp->base = m32.base;
@@ -723,71 +721,11 @@
                kmem_free(m64p, size);
        if (error != 0)
                n = 0;
-       copyout(&n, (void *)(uintptr_t)args32.n, sizeof n);
+       copyout(&n, (void *)(uintptr_t)args32.n, sizeof(n));
        return error;
 }
 #endif
 
-#if 0
-void
-netbsd32_mcontext_to_mcontext32(mcontext32_t *m32, mcontext_t *m, int flags)
-{
-       if ((flags & _UC_CPU) != 0) {
-               m32->__gregs[_REG32_GS] = m->__gregs[_REG_GS] & 0xffffffff;
-               m32->__gregs[_REG32_FS] = m->__gregs[_REG_FS] & 0xffffffff;
-               m32->__gregs[_REG32_ES] = m->__gregs[_REG_ES] & 0xffffffff;
-               m32->__gregs[_REG32_DS] = m->__gregs[_REG_DS] & 0xffffffff;
-               m32->__gregs[_REG32_EDI] = m->__gregs[_REG_RDI] & 0xffffffff;
-               m32->__gregs[_REG32_ESI] = m->__gregs[_REG_RSI] & 0xffffffff;
-               m32->__gregs[_REG32_EBP] = m->__gregs[_REG_RBP] & 0xffffffff;
-               m32->__gregs[_REG32_ESP] = m->__gregs[_REG_URSP] & 0xffffffff;
-               m32->__gregs[_REG32_EBX] = m->__gregs[_REG_RBX] & 0xffffffff;
-               m32->__gregs[_REG32_EDX] = m->__gregs[_REG_RDX] & 0xffffffff;
-               m32->__gregs[_REG32_ECX] = m->__gregs[_REG_RCX] & 0xffffffff;
-               m32->__gregs[_REG32_EAX] = m->__gregs[_REG_RAX] & 0xffffffff;
-               m32->__gregs[_REG32_TRAPNO] =
-                   m->__gregs[_REG_TRAPNO] & 0xffffffff;
-               m32->__gregs[_REG32_ERR] = m->__gregs[_REG_ERR] & 0xffffffff;
-               m32->__gregs[_REG32_EIP] = m->__gregs[_REG_RIP] & 0xffffffff;
-               m32->__gregs[_REG32_CS] = m->__gregs[_REG_CS] & 0xffffffff;
-               m32->__gregs[_REG32_EFL] = m->__gregs[_REG_RFL] & 0xffffffff;
-               m32->__gregs[_REG32_UESP] = m->__gregs[_REG_URSP] & 0xffffffff;
-               m32->__gregs[_REG32_SS] = m->__gregs[_REG_SS] & 0xffffffff;
-       }
-       if ((flags & _UC_FPU) != 0)
-               memcpy(&m32->__fpregs, &m->__fpregs, sizeof (m32->__fpregs));
-}
-
-void
-netbsd32_mcontext32_to_mcontext(mcontext_t *m, mcontext32_t *m32, int flags)
-{
-       if ((flags & _UC_CPU) != 0) {
-               m->__gregs[_REG_GS] = m32->__gregs[_REG32_GS];
-               m->__gregs[_REG_FS] = m32->__gregs[_REG32_FS];
-               m->__gregs[_REG_ES] = m32->__gregs[_REG32_ES];
-               m->__gregs[_REG_DS] = m32->__gregs[_REG32_DS];
-               m->__gregs[_REG_RDI] = m32->__gregs[_REG32_EDI];
-               m->__gregs[_REG_RSI] = m32->__gregs[_REG32_ESI];
-               m->__gregs[_REG_RBP] = m32->__gregs[_REG32_EBP];
-               m->__gregs[_REG_URSP] = m32->__gregs[_REG32_ESP];
-               m->__gregs[_REG_RBX] = m32->__gregs[_REG32_EBX];
-               m->__gregs[_REG_RDX] = m32->__gregs[_REG32_EDX];
-               m->__gregs[_REG_RCX] = m32->__gregs[_REG32_ECX];
-               m->__gregs[_REG_RAX] = m32->__gregs[_REG32_EAX];
-               m->__gregs[_REG_TRAPNO] = m32->__gregs[_REG32_TRAPNO];
-               m->__gregs[_REG_ERR] = m32->__gregs[_REG32_ERR];
-               m->__gregs[_REG_RIP] = m32->__gregs[_REG32_EIP];
-               m->__gregs[_REG_CS] = m32->__gregs[_REG32_CS];
-               m->__gregs[_REG_RFL] = m32->__gregs[_REG32_EFL];
-               m->__gregs[_REG_URSP] = m32->__gregs[_REG32_UESP];
-               m->__gregs[_REG_SS] = m32->__gregs[_REG32_SS];
-       }
-       if (flags & _UC_FPU)
-               memcpy(&m->__fpregs, &m32->__fpregs, sizeof (m->__fpregs));
-}
-#endif
-
-
 int
 cpu_setmcontext32(struct lwp *l, const mcontext32_t *mcp, unsigned int flags)
 {
@@ -841,7 +779,7 @@
                l->l_sigstk.ss_flags &= ~SS_ONSTACK;
        mutex_exit(p->p_lock);
 
-       return (0);
+       return 0;
 }
 
 void
@@ -884,7 +822,7 @@
        /* Save floating point register context. */
        process_read_fpregs_xmm(l, (struct fxsave *)
            &mcp->__fpregs.__fp_reg_set.__fp_xmm_state);
-       memset(&mcp->__fpregs.__fp_pad, 0, sizeof mcp->__fpregs.__fp_pad);
+       memset(&mcp->__fpregs.__fp_pad, 0, sizeof(mcp->__fpregs.__fp_pad));
        *flags |= _UC_FXSAVE | _UC_FPU;
 }
 



Home | Main Index | Thread Index | Old Index