Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64 Make this area compile, even if we don't supp...



details:   https://anonhg.NetBSD.org/src/rev/6a8ba0bcd713
branches:  trunk
changeset: 347314:6a8ba0bcd713
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Aug 20 18:31:06 2016 +0000

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

diffstat:

 sys/arch/amd64/amd64/gdt.c   |  41 +++++++++++++++++++++--------------------
 sys/arch/amd64/include/gdt.h |   6 +++---
 2 files changed, 24 insertions(+), 23 deletions(-)

diffs (87 lines):

diff -r c1e4296aef90 -r 6a8ba0bcd713 sys/arch/amd64/amd64/gdt.c
--- a/sys/arch/amd64/amd64/gdt.c        Sat Aug 20 18:21:18 2016 +0000
+++ b/sys/arch/amd64/amd64/gdt.c        Sat Aug 20 18:31:06 2016 +0000
@@ -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 @@
 }
 
 #ifdef USER_LDT
-void
-ldt_alloc(struct pmap *pmap, char *ldt, 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);
-}
-
-void
-ldt_free(struct pmap *pmap)
+/*
+ * XXX: USER_LDT is not implemented on amd64.
+ */
+int
+ldt_alloc(void *ldtp, size_t len)
 {
        int slot;
 
        KASSERT(mutex_owned(&cpu_lock));
 
-       slot = IDXDYNSEL(pmap->pm_ldt_sel);
+       slot = gdt_get_slot();
+       set_sys_gdt(slot, ldtp, len - 1, SDT_SYSLDT, SEL_KPL, 0);
+
+       return GDYNSEL(slot, SEL_KPL);
+}
+
+void
+ldt_free(int sel)
+{
+       int slot;
+
+       KASSERT(mutex_owned(&cpu_lock));
+
+       slot = IDXDYNSEL(sel);
 
        gdt_put_slot(slot);
 }
diff -r c1e4296aef90 -r 6a8ba0bcd713 sys/arch/amd64/include/gdt.h
--- a/sys/arch/amd64/include/gdt.h      Sat Aug 20 18:21:18 2016 +0000
+++ b/sys/arch/amd64/include/gdt.h      Sat Aug 20 18:31:06 2016 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index