Port-amd64 archive

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

mtrr and netbsd32_machdep.c



Matt Green's changes to deal with > 8 MTRRs were pulled up to netbsd-4, but broke amd64 and have been temporarily reverted.

The pullup commit is here:
http://mail-index.netbsd.org/source-changes/2008/08/20/msg209224.html

This broke netbsd-4 amd64 because of errors like:
/var/scratch/source/cvs/src-4/sys/arch/amd64/amd64/netbsd32_machdep.c:629:
   error: 'MTRR_I686_NVAR' undeclared (first use in this function)

-current amd64 doesn't exhibit the problem, but this is because netbsd32_machdep.c is missing including opt_mtrr.h and thus the MTRR section remains #ifdef'd out.

Here is a patch that re-enables the MTRR code and fixes the missing definition. It is possible that the MTRR parts of netbsd32_machdep.c have never adequately tested because of the missing include.

Matt also suggested that MTRR_I686_NVAR_MAX could also be replaced by i686_mtrr_vcnt, but I'm not familiar enough with this to make this call.

Index: sys/arch/amd64/amd64/netbsd32_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/netbsd32_machdep.c,v
retrieving revision 1.51
diff -u -r1.51 netbsd32_machdep.c
--- sys/arch/amd64/amd64/netbsd32_machdep.c     21 May 2008 14:10:28 -0000      
1.51
+++ sys/arch/amd64/amd64/netbsd32_machdep.c     27 Aug 2008 15:14:20 -0000
@@ -42,6 +42,7 @@
 #include "opt_coredump.h"
 #include "opt_execfmt.h"
 #include "opt_user_ldt.h"
+#include "opt_mtrr.h"

 #include <sys/param.h>
 #include <sys/exec.h>
@@ -643,7 +644,7 @@
                return error;

        if (args32.mtrrp == 0) {
-               n = (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR);
+               n = (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR_MAX);
                return copyout(&n, (void *)(uintptr_t)args32.n, sizeof n);
        }

@@ -651,7 +652,7 @@
        if (error != 0)
                return error;

-       if (n <= 0 || n > (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR))
+       if (n <= 0 || n > (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR_MAX))
                return EINVAL;

        m64p = malloc(n * sizeof (struct mtrr), M_TEMP, M_WAITOK);
@@ -713,7 +714,7 @@
        if (error != 0)
                return error;

-       if (n <= 0 || n > (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR)) {
+       if (n <= 0 || n > (MTRR_I686_NFIXED_SOFT + MTRR_I686_NVAR_MAX)) {
                error = EINVAL;
                goto fail;
        }


Home | Main Index | Thread Index | Old Index