Module Name: src Committed By: christos Date: Fri Apr 30 13:54:26 UTC 2021
Modified Files: src/sys/arch/amd64/include: gdt.h src/sys/arch/i386/i386: gdt.c src/sys/arch/i386/include: gdt.h src/sys/arch/x86/include: Makefile pmap.h Log Message: Merge the x86 gdt function and constant definitions To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/include/gdt.h cvs rdiff -u -r1.71 -r1.72 src/sys/arch/i386/i386/gdt.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/include/gdt.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/include/Makefile cvs rdiff -u -r1.126 -r1.127 src/sys/arch/x86/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/include/gdt.h diff -u src/sys/arch/amd64/include/gdt.h:1.13 src/sys/arch/amd64/include/gdt.h:1.14 --- src/sys/arch/amd64/include/gdt.h:1.13 Thu Apr 29 21:09:29 2021 +++ src/sys/arch/amd64/include/gdt.h Fri Apr 30 09:54:26 2021 @@ -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> Index: src/sys/arch/i386/i386/gdt.c diff -u src/sys/arch/i386/i386/gdt.c:1.71 src/sys/arch/i386/i386/gdt.c:1.72 --- src/sys/arch/i386/i386/gdt.c:1.71 Wed Oct 30 03:40:05 2019 +++ src/sys/arch/i386/i386/gdt.c Fri Apr 30 09:54:26 2021 @@ -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 @@ tss_free(int sel) } int -ldt_alloc(union descriptor *ldtp, size_t len) +ldt_alloc(void *ldtp, size_t len) { int slot; Index: src/sys/arch/i386/include/gdt.h diff -u src/sys/arch/i386/include/gdt.h:1.19 src/sys/arch/i386/include/gdt.h:1.20 --- src/sys/arch/i386/include/gdt.h:1.19 Thu Apr 29 21:09:29 2021 +++ src/sys/arch/i386/include/gdt.h Fri Apr 30 09:54:26 2021 @@ -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> Index: src/sys/arch/x86/include/Makefile diff -u src/sys/arch/x86/include/Makefile:1.24 src/sys/arch/x86/include/Makefile:1.25 --- src/sys/arch/x86/include/Makefile:1.24 Sat May 11 09:40:26 2019 +++ src/sys/arch/x86/include/Makefile Fri Apr 30 09:54:26 2021 @@ -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 @@ INCS= aout_machdep.h \ cpuvar.h \ float.h \ fpu.h \ + gdt.h \ ieee.h ieeefp.h \ intr.h intrdefs.h \ lock.h \ Index: src/sys/arch/x86/include/pmap.h diff -u src/sys/arch/x86/include/pmap.h:1.126 src/sys/arch/x86/include/pmap.h:1.127 --- src/sys/arch/x86/include/pmap.h:1.126 Thu Apr 29 21:09:29 2021 +++ src/sys/arch/x86/include/pmap.h Fri Apr 30 09:54:26 2021 @@ -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 @@ struct slotspace { 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];