Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386 Define MINGDTSIZ/MAXGDTSIZ in bytes, not in nu...



details:   https://anonhg.NetBSD.org/src/rev/5143a79bd217
branches:  trunk
changeset: 825162:5143a79bd217
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jul 02 09:02:06 2017 +0000

description:
Define MINGDTSIZ/MAXGDTSIZ in bytes, not in number of slots; same as
amd64.

diffstat:

 sys/arch/i386/i386/gdt.c     |  18 +++++++++---------
 sys/arch/i386/i386/mptramp.S |   6 +++---
 sys/arch/i386/include/gdt.h  |   6 +++---
 3 files changed, 15 insertions(+), 15 deletions(-)

diffs (105 lines):

diff -r b0764a807a59 -r 5143a79bd217 sys/arch/i386/i386/gdt.c
--- a/sys/arch/i386/i386/gdt.c  Sun Jul 02 08:25:52 2017 +0000
+++ b/sys/arch/i386/i386/gdt.c  Sun Jul 02 09:02:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdt.c,v 1.61 2017/06/17 09:32:53 maxv Exp $    */
+/*     $NetBSD: gdt.c,v 1.62 2017/07/02 09:02:06 maxv Exp $    */
 
 /*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.61 2017/06/17 09:32:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.62 2017/07/02 09:02:06 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -110,10 +110,10 @@
        vaddr_t va;
        struct cpu_info *ci = &cpu_info_primary;
 
-       max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
-       min_len = MINGDTSIZ * sizeof(gdtstore[0]);
+       max_len = MAXGDTSIZ;
+       min_len = MINGDTSIZ;
 
-       gdt_size = MINGDTSIZ;
+       gdt_size = (MINGDTSIZ / sizeof(gdtstore[0]));
        gdt_count = NGDT;
        gdt_next = NGDT;
        gdt_free = GNULL_SEL;
@@ -146,8 +146,8 @@
 void
 gdt_alloc_cpu(struct cpu_info *ci)
 {
-       int max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
-       int min_len = MINGDTSIZ * sizeof(gdtstore[0]);
+       int max_len = MAXGDTSIZ;
+       int min_len = MINGDTSIZ;
        struct vm_page *pg;
        vaddr_t va;
 
@@ -180,7 +180,7 @@
        struct region_descriptor region;
        size_t max_len;
 
-       max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
+       max_len = MAXGDTSIZ;
        setregion(&region, ci->ci_gdt, max_len - 1);
        lgdt(&region);
 #else
@@ -273,7 +273,7 @@
                if (gdt_next != gdt_count + offset)
                        panic("gdt_get_slot botch 1");
                if (gdt_next - offset >= gdt_size) {
-                       if (gdt_size >= MAXGDTSIZ)
+                       if (gdt_size >= (MAXGDTSIZ / sizeof(gdtstore[0])))
                                panic("gdt_get_slot botch 2");
                        gdt_grow();
                }
diff -r b0764a807a59 -r 5143a79bd217 sys/arch/i386/i386/mptramp.S
--- a/sys/arch/i386/i386/mptramp.S      Sun Jul 02 08:25:52 2017 +0000
+++ b/sys/arch/i386/i386/mptramp.S      Sun Jul 02 09:02:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mptramp.S,v 1.29 2016/05/14 08:34:00 maxv Exp $        */
+/*     $NetBSD: mptramp.S,v 1.30 2017/07/02 09:02:06 maxv Exp $        */
 
 /*
  * Copyright (c) 2000, 2016 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.29 2016/05/14 08:34:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.30 2017/07/02 09:02:06 maxv Exp $");
 
 #include "opt_mpbios.h"                /* for MPDEBUG */
 
@@ -223,7 +223,7 @@
 
        /* %ecx points at our cpu_info structure. */
 
-       movw    $((MAXGDTSIZ*8) - 1), 6(%esp)   /* prepare segment descriptor */
+       movw    $(MAXGDTSIZ-1), 6(%esp) /* prepare segment descriptor */
        movl    CPU_INFO_GDT(%ecx), %eax        /* for our real gdt */
        movl    %eax, 8(%esp)
        lgdt    6(%esp)
diff -r b0764a807a59 -r 5143a79bd217 sys/arch/i386/include/gdt.h
--- a/sys/arch/i386/include/gdt.h       Sun Jul 02 08:25:52 2017 +0000
+++ b/sys/arch/i386/include/gdt.h       Sun Jul 02 09:02:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdt.h,v 1.15 2017/02/08 10:08:26 maxv Exp $    */
+/*     $NetBSD: gdt.h,v 1.16 2017/07/02 09:02:06 maxv Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -44,5 +44,5 @@
 
 #endif /* LOCORE */
 
-#define        MINGDTSIZ       512
-#define        MAXGDTSIZ       8192
+#define        MINGDTSIZ       PAGE_SIZE
+#define        MAXGDTSIZ       65536



Home | Main Index | Thread Index | Old Index