Module Name: src
Committed By: maxv
Date: Sat Aug 20 16:05:49 UTC 2016
Modified Files:
src/sys/arch/amd64/amd64: gdt.c
src/sys/arch/i386/i386: gdt.c
src/sys/arch/i386/include: gdt.h
Log Message:
Localify.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/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.26 src/sys/arch/amd64/amd64/gdt.c:1.27
--- src/sys/arch/amd64/amd64/gdt.c:1.26 Sun Nov 22 13:41:24 2015
+++ src/sys/arch/amd64/amd64/gdt.c Sat Aug 20 16:05:48 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.c,v 1.26 2015/11/22 13:41:24 maxv Exp $ */
+/* $NetBSD: gdt.c,v 1.27 2016/08/20 16:05:48 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.26 2015/11/22 13:41:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.27 2016/08/20 16:05:48 maxv Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -64,9 +64,9 @@ int gdt_next; /* next available slot fo
int gdt_free; /* next free slot; terminated with GNULL_SEL */
void gdt_init(void);
-void gdt_grow(void);
-int gdt_get_slot(void);
-void gdt_put_slot(int);
+static void gdt_grow(void);
+static int gdt_get_slot(void);
+static void gdt_put_slot(int);
void
update_descriptor(void *tp, void *ep)
@@ -88,8 +88,7 @@ update_descriptor(void *tp, void *ep)
}
void
-set_sys_gdt(int slot, void *base, size_t limit,
- int type, int dpl, int gran)
+set_sys_gdt(int slot, void *base, size_t limit, int type, int dpl, int gran)
{
union {
struct sys_segment_descriptor sd;
@@ -208,11 +207,10 @@ gdt_reload_cpu(struct cpu_info *ci)
}
#endif
-
/*
* Grow or shrink the GDT.
*/
-void
+static void
gdt_grow(void)
{
size_t old_len, new_len;
@@ -223,7 +221,7 @@ gdt_grow(void)
gdt_size <<= 1;
new_len = old_len << 1;
gdt_dynavail =
- (gdt_size - DYNSEL_START) / sizeof (struct sys_segment_descriptor);
+ (gdt_size - DYNSEL_START) / sizeof(struct sys_segment_descriptor);
for (va = (vaddr_t)gdtstore + old_len; va < (vaddr_t)gdtstore + new_len;
va += PAGE_SIZE) {
@@ -245,7 +243,7 @@ gdt_grow(void)
* 3) As a last resort, we increase the size of the GDT, and sweep through
* the new slots.
*/
-int
+static int
gdt_get_slot(void)
{
int slot;
@@ -280,7 +278,7 @@ gdt_get_slot(void)
/*
* Deallocate a GDT slot, putting it on the free list.
*/
-void
+static void
gdt_put_slot(int slot)
{
struct sys_segment_descriptor *gdt;
Index: src/sys/arch/i386/i386/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.53 src/sys/arch/i386/i386/gdt.c:1.54
--- src/sys/arch/i386/i386/gdt.c:1.53 Fri Feb 24 08:06:07 2012
+++ src/sys/arch/i386/i386/gdt.c Sat Aug 20 16:05:48 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.c,v 1.53 2012/02/24 08:06:07 cherry Exp $ */
+/* $NetBSD: gdt.c,v 1.54 2016/08/20 16:05:48 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.53 2012/02/24 08:06:07 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.54 2016/08/20 16:05:48 maxv Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -61,9 +61,9 @@ static int ldt_count; /* number of LDTs
static int ldt_max = 1000;/* max number of LDTs */
void gdt_init(void);
-void gdt_grow(int);
-int gdt_get_slot1(int);
-void gdt_put_slot1(int, int);
+static void gdt_grow(int);
+static int gdt_get_slot1(int);
+static void gdt_put_slot1(int, int);
void
update_descriptor(union descriptor *table, union descriptor *entry)
@@ -82,8 +82,8 @@ update_descriptor(union descriptor *tabl
}
void
-setgdt(int sel, const void *base, size_t limit,
- int type, int dpl, int def32, int gran)
+setgdt(int sel, const void *base, size_t limit, int type, int dpl, int def32,
+ int gran)
{
struct segment_descriptor *sd = &gdt[sel].sd;
CPU_INFO_ITERATOR cii;
@@ -201,23 +201,21 @@ gdt_init_cpu(struct cpu_info *ci)
pt_entry_t *ptp;
int f;
- for (va = (vaddr_t)ci->ci_gdt, f = 0;
- va < (vaddr_t)ci->ci_gdt + len;
- va += PAGE_SIZE, f++) {
+ for (va = (vaddr_t)ci->ci_gdt, f = 0; va < (vaddr_t)ci->ci_gdt + len;
+ va += PAGE_SIZE, f++) {
KASSERT(va >= VM_MIN_KERNEL_ADDRESS);
ptp = kvtopte(va);
frames[f] = *ptp >> PAGE_SHIFT;
- {
- /*
- * pmap_pte_clearbits(ptp, PG_RW);
- * but without spl(), since %fs is not setup
- * properly yet, ie; curcpu() won't work at this
- * point and spl() will break.
- */
- if (HYPERVISOR_update_va_mapping((vaddr_t)va,
- *ptp & ~PG_RW, UVMF_INVLPG) < 0) {
- panic("%s page RO update failed.\n", __func__);
- }
+
+ /*
+ * pmap_pte_clearbits(ptp, PG_RW);
+ * but without spl(), since %fs is not setup
+ * properly yet, ie; curcpu() won't work at this
+ * point and spl() will break.
+ */
+ if (HYPERVISOR_update_va_mapping((vaddr_t)va,
+ *ptp & ~PG_RW, UVMF_INVLPG) < 0) {
+ panic("%s page RO update failed.\n", __func__);
}
}
@@ -274,7 +272,7 @@ gdt_grow(int which)
uvm_wait("gdt_grow");
}
pmap_kenter_pa(va, VM_PAGE_TO_PHYS(pg),
- VM_PROT_READ | VM_PROT_WRITE, 0);
+ VM_PROT_READ | VM_PROT_WRITE, 0);
}
}
return;
@@ -306,7 +304,7 @@ gdt_grow(int which)
* the new slots.
*/
-int
+static int
gdt_get_slot(void)
{
@@ -315,7 +313,7 @@ gdt_get_slot(void)
return gdt_get_slot1(0);
}
-int
+static int
gdt_get_slot1(int which)
{
int slot;
@@ -345,7 +343,7 @@ gdt_get_slot1(int which)
/*
* Deallocate a GDT slot, putting it on the free list.
*/
-void
+static void
gdt_put_slot(int slot)
{
@@ -354,7 +352,7 @@ gdt_put_slot(int slot)
gdt_put_slot1(slot, 0);
}
-void
+static void
gdt_put_slot1(int slot, int which)
{
union descriptor d;
Index: src/sys/arch/i386/include/gdt.h
diff -u src/sys/arch/i386/include/gdt.h:1.13 src/sys/arch/i386/include/gdt.h:1.14
--- src/sys/arch/i386/include/gdt.h:1.13 Mon Apr 28 20:23:24 2008
+++ src/sys/arch/i386/include/gdt.h Sat Aug 20 16:05:48 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.h,v 1.13 2008/04/28 20:23:24 martin Exp $ */
+/* $NetBSD: gdt.h,v 1.14 2016/08/20 16:05:48 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -37,8 +37,6 @@ struct pmap;
void gdt_init(void);
void gdt_init_cpu(struct cpu_info *);
void gdt_reload_cpu(struct cpu_info *);
-int gdt_get_slot(void);
-void gdt_put_slot(int);
void gdt_alloc_cpu(struct cpu_info *);
int tss_alloc(const struct i386tss *);
void tss_free(int);