Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Merge the x86 gdt function and constant definitions



details:   https://anonhg.NetBSD.org/src/rev/ed6a2f38ba60
branches:  trunk
changeset: 1020965:ed6a2f38ba60
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 30 13:54:26 2021 +0000

description:
Merge the x86 gdt function and constant definitions

diffstat:

 sys/arch/amd64/include/gdt.h  |  51 +-----------------------------------------
 sys/arch/i386/i386/gdt.c      |   6 ++--
 sys/arch/i386/include/gdt.h   |  50 +----------------------------------------
 sys/arch/x86/include/Makefile |   3 +-
 sys/arch/x86/include/pmap.h   |  10 +------
 5 files changed, 11 insertions(+), 109 deletions(-)

diffs (179 lines):

diff -r d509ba212c1d -r ed6a2f38ba60 sys/arch/amd64/include/gdt.h
--- a/sys/arch/amd64/include/gdt.h      Fri Apr 30 13:53:30 2021 +0000
+++ b/sys/arch/amd64/include/gdt.h      Fri Apr 30 13:54:26 2021 +0000
@@ -1,50 +1,3 @@
-/*     $NetBSD: gdt.h,v 1.13 2021/04/30 01:09:29 christos Exp $        */
+/*     $NetBSD: gdt.h,v 1.14 2021/04/30 13:54:26 christos Exp $        */
 
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by John T. Kohl and Charles M. Hannum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LOCORE
-struct proc;
-struct pmap;
-
-void gdt_init(void);
-void gdt_init_cpu(struct cpu_info *);
-void gdt_alloc_cpu(struct cpu_info *);
-
-struct x86_64_tss;
-int tss_alloc(struct x86_64_tss *);
-void tss_free(int);
-
-int ldt_alloc(void *, size_t);
-void ldt_free(int);
-#endif
-
-#define MAXGDTSIZ              65536   /* XXX: see <x86/pmap.h> */
-#define MAX_USERLDT_SIZE       65536   /* XXX: see <x86/pmap.h> */
-#define MAX_USERLDT_SLOTS      (int)(MAX_USERLDT_SIZE / sizeof(union descriptor))
+#include <x86/gdt.h>
diff -r d509ba212c1d -r ed6a2f38ba60 sys/arch/i386/i386/gdt.c
--- a/sys/arch/i386/i386/gdt.c  Fri Apr 30 13:53:30 2021 +0000
+++ b/sys/arch/i386/i386/gdt.c  Fri Apr 30 13:54:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdt.c,v 1.71 2019/10/30 07:40:05 maxv Exp $    */
+/*     $NetBSD: gdt.c,v 1.72 2021/04/30 13:54:26 christos 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.71 2019/10/30 07:40:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.72 2021/04/30 13:54:26 christos Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -279,7 +279,7 @@
 }
 
 int
-ldt_alloc(union descriptor *ldtp, size_t len)
+ldt_alloc(void *ldtp, size_t len)
 {
        int slot;
 
diff -r d509ba212c1d -r ed6a2f38ba60 sys/arch/i386/include/gdt.h
--- a/sys/arch/i386/include/gdt.h       Fri Apr 30 13:53:30 2021 +0000
+++ b/sys/arch/i386/include/gdt.h       Fri Apr 30 13:54:26 2021 +0000
@@ -1,49 +1,3 @@
-/*     $NetBSD: gdt.h,v 1.19 2021/04/30 01:09:29 christos Exp $        */
+/*     $NetBSD: gdt.h,v 1.20 2021/04/30 13:54:26 christos Exp $        */
 
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by John T. Kohl and Charles M. Hannum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if !defined(_LOCORE)
-
-struct proc;
-struct pmap;
-
-void gdt_init(void);
-void gdt_init_cpu(struct cpu_info *);
-void gdt_alloc_cpu(struct cpu_info *);
-int tss_alloc(const struct i386tss *);
-void tss_free(int);
-int ldt_alloc(union descriptor *, size_t);
-void ldt_free(int);
-
-#endif /* LOCORE */
-
-#define MAXGDTSIZ              65536   /* XXX: see <x86/pmap.h> */
-#define MAX_USERLDT_SIZE       65536   /* XXX: see <x86/pmap.h> */
-#define MAX_USERLDT_SLOTS      (int)(MAX_USERLDT_SIZE / sizeof(union descriptor))
+#include <x86/gdt.h>
diff -r d509ba212c1d -r ed6a2f38ba60 sys/arch/x86/include/Makefile
--- a/sys/arch/x86/include/Makefile     Fri Apr 30 13:53:30 2021 +0000
+++ b/sys/arch/x86/include/Makefile     Fri Apr 30 13:54:26 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.24 2019/05/11 13:40:26 christos Exp $
+#      $NetBSD: Makefile,v 1.25 2021/04/30 13:54:26 christos Exp $
 
 INCSDIR=/usr/include/x86
 
@@ -13,6 +13,7 @@
        cpuvar.h \
        float.h \
        fpu.h \
+       gdt.h \
        ieee.h ieeefp.h \
        intr.h intrdefs.h \
        lock.h \
diff -r d509ba212c1d -r ed6a2f38ba60 sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h       Fri Apr 30 13:53:30 2021 +0000
+++ b/sys/arch/x86/include/pmap.h       Fri Apr 30 13:54:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.126 2021/04/30 01:09:29 christos Exp $      */
+/*     $NetBSD: pmap.h,v 1.127 2021/04/30 13:54:26 christos Exp $      */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -187,13 +187,7 @@
 
 extern struct slotspace slotspace;
 
-#ifndef MAXGDTSIZ
-#define MAXGDTSIZ 65536 /* XXX: dup in <machine/gdt.h> */
-#endif
-
-#ifndef MAX_USERLDT_SIZE
-#define MAX_USERLDT_SIZE 65536 /* XXX: dup in <machine/gdt.h> */
-#endif
+#include <x86/gdt.h>
 
 struct pcpu_entry {
        uint8_t gdt[MAXGDTSIZ];



Home | Main Index | Thread Index | Old Index