Module Name:    src
Committed By:   maxv
Date:           Sat Aug 20 18:31:06 UTC 2016

Modified Files:
        src/sys/arch/amd64/amd64: gdt.c
        src/sys/arch/amd64/include: gdt.h

Log Message:
Make this area compile, even if we don't support USER_LDT on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/include/gdt.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/amd64/gdt.c
diff -u src/sys/arch/amd64/amd64/gdt.c:1.29 src/sys/arch/amd64/amd64/gdt.c:1.30
--- src/sys/arch/amd64/amd64/gdt.c:1.29	Sat Aug 20 18:04:04 2016
+++ src/sys/arch/amd64/amd64/gdt.c	Sat Aug 20 18:31:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.29 2016/08/20 18:04:04 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.30 2016/08/20 18:31:06 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.29 2016/08/20 18:04:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.30 2016/08/20 18:31:06 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -330,29 +330,30 @@ tss_free(int sel)
 }
 
 #ifdef USER_LDT
-void
-ldt_alloc(struct pmap *pmap, char *ldt, size_t len)
+/*
+ * XXX: USER_LDT is not implemented on amd64.
+ */
+int
+ldt_alloc(void *ldtp, size_t len)
 {
 	int slot;
-	struct sys_segment_descriptor *gdt;
 
 	KASSERT(mutex_owned(&cpu_lock));
 
-	gdt = (struct sys_segment_descriptor *)&gdtstore[DYNSEL_START];
-
 	slot = gdt_get_slot();
-	set_sys_gdt(slot, ldt, len - 1, SDT_SYSLDT, SEL_KPL, 0);
-	pmap->pm_ldt_sel = GSEL(slot, SEL_KPL);
+	set_sys_gdt(slot, ldtp, len - 1, SDT_SYSLDT, SEL_KPL, 0);
+
+	return GDYNSEL(slot, SEL_KPL);
 }
 
 void
-ldt_free(struct pmap *pmap)
+ldt_free(int sel)
 {
 	int slot;
 
 	KASSERT(mutex_owned(&cpu_lock));
 
-	slot = IDXDYNSEL(pmap->pm_ldt_sel);
+	slot = IDXDYNSEL(sel);
 
 	gdt_put_slot(slot);
 }

Index: src/sys/arch/amd64/include/gdt.h
diff -u src/sys/arch/amd64/include/gdt.h:1.7 src/sys/arch/amd64/include/gdt.h:1.8
--- src/sys/arch/amd64/include/gdt.h:1.7	Wed Jul  7 01:14:52 2010
+++ src/sys/arch/amd64/include/gdt.h	Sat Aug 20 18:31:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.h,v 1.7 2010/07/07 01:14:52 chs Exp $	*/
+/*	$NetBSD: gdt.h,v 1.8 2016/08/20 18:31:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -42,8 +42,8 @@ struct x86_64_tss;
 int tss_alloc(struct x86_64_tss *);
 void tss_free(int);
 
-void ldt_alloc(struct pmap *, char *, size_t);
-void ldt_free(struct pmap *);
+int ldt_alloc(void *, size_t);
+void ldt_free(int);
 
 void set_sys_gdt(int, void *, size_t, int, int, int);
 #endif

Reply via email to