Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Declare gdt_size as const, simplifies.
details: https://anonhg.NetBSD.org/src/rev/3eb6e5078b4f
branches: trunk
changeset: 358508:3eb6e5078b4f
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Jan 04 20:38:30 2018 +0000
description:
Declare gdt_size as const, simplifies.
diffstat:
sys/arch/amd64/amd64/gdt.c | 20 +++++++++++---------
sys/arch/i386/i386/gdt.c | 20 +++++++++++---------
2 files changed, 22 insertions(+), 18 deletions(-)
diffs (96 lines):
diff -r c08b93ea29a6 -r 3eb6e5078b4f sys/arch/amd64/amd64/gdt.c
--- a/sys/arch/amd64/amd64/gdt.c Thu Jan 04 14:02:23 2018 +0000
+++ b/sys/arch/amd64/amd64/gdt.c Thu Jan 04 20:38:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.c,v 1.43 2017/09/10 10:51:13 maxv Exp $ */
+/* $NetBSD: gdt.c,v 1.44 2018/01/04 20:38:30 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.43 2017/09/10 10:51:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.44 2018/01/04 20:38:30 maxv Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -66,8 +66,15 @@
size_t nslots;
} gdt_bitmap_t;
-size_t gdt_size; /* size of GDT in bytes */
-static gdt_bitmap_t gdt_bitmap; /* bitmap of busy slots */
+/* size of GDT in bytes */
+#ifdef XEN
+const size_t gdt_size = FIRST_RESERVED_GDT_BYTE;
+#else
+const size_t gdt_size = MAXGDTSIZ;
+#endif
+
+/* bitmap of busy slots */
+static gdt_bitmap_t gdt_bitmap;
#if defined(USER_LDT) || !defined(XEN)
static void set_sys_gdt(int, void *, size_t, int, int, int);
@@ -130,11 +137,6 @@
struct cpu_info *ci = &cpu_info_primary;
/* Initialize the global values */
-#ifdef XEN
- gdt_size = FIRST_RESERVED_GDT_BYTE;
-#else
- gdt_size = MAXGDTSIZ;
-#endif
memset(&gdt_bitmap.busy, 0, sizeof(gdt_bitmap.busy));
gdt_bitmap.nslots = NSLOTS(gdt_size);
diff -r c08b93ea29a6 -r 3eb6e5078b4f sys/arch/i386/i386/gdt.c
--- a/sys/arch/i386/i386/gdt.c Thu Jan 04 14:02:23 2018 +0000
+++ b/sys/arch/i386/i386/gdt.c Thu Jan 04 20:38:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.c,v 1.67 2017/09/06 12:39:18 bouyer Exp $ */
+/* $NetBSD: gdt.c,v 1.68 2018/01/04 20:38:31 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.67 2017/09/06 12:39:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.68 2018/01/04 20:38:31 maxv Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -54,8 +54,15 @@
size_t nslots;
} gdt_bitmap_t;
-size_t gdt_size; /* size of GDT in bytes */
-static gdt_bitmap_t gdt_bitmap; /* bitmap of busy slots */
+/* size of GDT in bytes */
+#ifdef XEN
+const size_t gdt_size = FIRST_RESERVED_GDT_BYTE;
+#else
+const size_t gdt_size = MAXGDTSIZ;
+#endif
+
+/* bitmap of busy slots */
+static gdt_bitmap_t gdt_bitmap;
#ifndef XEN
static int ldt_count; /* number of LDTs */
@@ -119,11 +126,6 @@
struct cpu_info *ci = &cpu_info_primary;
/* Initialize the global values */
-#ifdef XEN
- gdt_size = FIRST_RESERVED_GDT_BYTE;
-#else
- gdt_size = MAXGDTSIZ;
-#endif
memset(&gdt_bitmap.busy, 0, sizeof(gdt_bitmap.busy));
gdt_bitmap.nslots = NSLOTS(gdt_size);
Home |
Main Index |
Thread Index |
Old Index