Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch de-duplication police arrests sysctl.
details: https://anonhg.NetBSD.org/src/rev/88a1d1b3cd37
branches: trunk
changeset: 786043:88a1d1b3cd37
user: christos <christos%NetBSD.org@localhost>
date: Fri Apr 12 16:59:38 2013 +0000
description:
de-duplication police arrests sysctl.
diffstat:
sys/arch/amd64/amd64/machdep.c | 80 +-----------------------------------
sys/arch/i386/i386/machdep.c | 90 ++---------------------------------------
sys/arch/x86/include/machdep.h | 4 +-
sys/arch/x86/x86/x86_machdep.c | 89 ++++++++++++++++++++++++++++++++++++++++-
4 files changed, 99 insertions(+), 164 deletions(-)
diffs (truncated from 380 to 300 lines):
diff -r 8114d1b6b47b -r 88a1d1b3cd37 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Fri Apr 12 16:32:37 2013 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Fri Apr 12 16:59:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.193 2013/04/02 13:28:41 taca Exp $ */
+/* $NetBSD: machdep.c,v 1.194 2013/04/12 16:59:40 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.193 2013/04/02 13:28:41 taca Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.194 2013/04/12 16:59:40 christos Exp $");
/* #define XENDEBUG_LOW */
@@ -515,66 +515,11 @@
ci->ci_tss_sel = tss_alloc(tss);
}
-/*
- * machine dependent system variables.
- */
-static int
-sysctl_machdep_booted_kernel(SYSCTLFN_ARGS)
-{
- struct btinfo_bootpath *bibp;
- struct sysctlnode node;
-
- bibp = lookup_bootinfo(BTINFO_BOOTPATH);
- if(!bibp)
- return(ENOENT); /* ??? */
-
- node = *rnode;
- node.sysctl_data = bibp->bootpath;
- node.sysctl_size = sizeof(bibp->bootpath);
- return (sysctl_lookup(SYSCTLFN_CALL(&node)));
-}
-
-static int
-sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
-{
- struct sysctlnode node;
-
- if (x86_alldisks == NULL)
- return (ENOENT);
-
- node = *rnode;
- node.sysctl_data = x86_alldisks;
- node.sysctl_size = sizeof(struct disklist) +
- (x86_ndisks - 1) * sizeof(struct nativedisk_info);
- return (sysctl_lookup(SYSCTLFN_CALL(&node)));
-}
-
SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
{
- extern uint64_t tsc_freq;
-
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "machdep", NULL,
- NULL, 0, NULL, 0,
- CTL_MACHDEP, CTL_EOL);
+ x86_sysctl_machdep_setup(clog);
sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRUCT, "console_device", NULL,
- sysctl_consdev, 0, NULL, sizeof(dev_t),
- CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRING, "booted_kernel", NULL,
- sysctl_machdep_booted_kernel, 0, NULL, 0,
- CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRUCT, "diskinfo", NULL,
- sysctl_machdep_diskinfo, 0, NULL, 0,
- CTL_MACHDEP, CPU_DISKINFO, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT | CTLFLAG_IMMEDIATE,
CTLTYPE_INT, "fpu_present", NULL,
NULL, 1, NULL, 0,
@@ -589,25 +534,6 @@
CTLTYPE_INT, "sse2", NULL,
NULL, 1, NULL, 0,
CTL_MACHDEP, CPU_SSE2, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_QUAD, "tsc_freq", NULL,
- NULL, 0, &tsc_freq, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_INT, "pae",
- SYSCTL_DESCR("Whether the kernel uses PAE"),
- NULL, 0, &use_pae, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
-#ifndef NO_SPARSE_DUMP
- /* XXXjld Does this really belong under machdep, and not e.g. kern? */
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "sparse_dump", NULL,
- NULL, 0, &sparse_dump, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
-#endif
}
void
diff -r 8114d1b6b47b -r 88a1d1b3cd37 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Fri Apr 12 16:32:37 2013 +0000
+++ b/sys/arch/i386/i386/machdep.c Fri Apr 12 16:59:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.733 2012/10/03 18:58:32 dsl Exp $ */
+/* $NetBSD: machdep.c,v 1.734 2013/04/12 16:59:38 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.733 2012/10/03 18:58:32 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.734 2013/04/12 16:59:38 christos Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -591,59 +591,12 @@
#endif /* XEN */
/*
- * sysctl helper routine for machdep.booted_kernel
- */
-static int
-sysctl_machdep_booted_kernel(SYSCTLFN_ARGS)
-{
- struct btinfo_bootpath *bibp;
- struct sysctlnode node;
-
- bibp = lookup_bootinfo(BTINFO_BOOTPATH);
- if(!bibp)
- return(ENOENT); /* ??? */
-
- node = *rnode;
- node.sysctl_data = bibp->bootpath;
- node.sysctl_size = sizeof(bibp->bootpath);
- return (sysctl_lookup(SYSCTLFN_CALL(&node)));
-}
-
-/*
- * sysctl helper routine for machdep.diskinfo
- */
-static int
-sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
-{
- struct sysctlnode node;
-
- node = *rnode;
- if (x86_alldisks == NULL)
- return(EOPNOTSUPP);
- node.sysctl_data = x86_alldisks;
- node.sysctl_size = sizeof(struct disklist) +
- (x86_ndisks - 1) * sizeof(struct nativedisk_info);
- return (sysctl_lookup(SYSCTLFN_CALL(&node)));
-}
-
-/*
* machine dependent system variables.
*/
SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
{
- extern uint64_t tsc_freq;
+ x86_sysctl_machdep_setup(clog);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_NODE, "machdep", NULL,
- NULL, 0, NULL, 0,
- CTL_MACHDEP, CTL_EOL);
-
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRUCT, "console_device", NULL,
- sysctl_consdev, 0, NULL, sizeof(dev_t),
- CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
#ifndef XEN
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
@@ -658,14 +611,9 @@
#endif /* XEN */
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
- CTLTYPE_STRING, "booted_kernel", NULL,
- sysctl_machdep_booted_kernel, 0, NULL, 0,
- CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRUCT, "diskinfo", NULL,
- sysctl_machdep_diskinfo, 0, NULL, 0,
- CTL_MACHDEP, CPU_DISKINFO, CTL_EOL);
+ CTLTYPE_INT, "osfxsr", NULL,
+ NULL, 0, &i386_use_fxsave, 0,
+ CTL_MACHDEP, CPU_OSFXSR, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_INT, "fpu_present", NULL,
@@ -673,11 +621,6 @@
CTL_MACHDEP, CPU_FPU_PRESENT, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
- CTLTYPE_INT, "osfxsr", NULL,
- NULL, 0, &i386_use_fxsave, 0,
- CTL_MACHDEP, CPU_OSFXSR, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
CTLTYPE_INT, "sse", NULL,
NULL, 0, &i386_has_sse, 0,
CTL_MACHDEP, CPU_SSE, CTL_EOL);
@@ -686,27 +629,6 @@
CTLTYPE_INT, "sse2", NULL,
NULL, 0, &i386_has_sse2, 0,
CTL_MACHDEP, CPU_SSE2, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_STRING, "cpu_brand", NULL,
- NULL, 0, cpu_brand_string, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "sparse_dump", NULL,
- NULL, 0, &sparse_dump, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_QUAD, "tsc_freq", NULL,
- NULL, 0, &tsc_freq, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT,
- CTLTYPE_INT, "pae",
- SYSCTL_DESCR("Whether the kernel uses PAE"),
- NULL, 0, &use_pae, 0,
- CTL_MACHDEP, CTL_CREATE, CTL_EOL);
}
void *
diff -r 8114d1b6b47b -r 88a1d1b3cd37 sys/arch/x86/include/machdep.h
--- a/sys/arch/x86/include/machdep.h Fri Apr 12 16:32:37 2013 +0000
+++ b/sys/arch/x86/include/machdep.h Fri Apr 12 16:59:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.h,v 1.5 2010/10/21 11:17:54 yamt Exp $ */
+/* $NetBSD: machdep.h,v 1.6 2013/04/12 16:59:41 christos Exp $ */
/*
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -33,6 +33,7 @@
struct btinfo_memmap;
struct extent;
+struct sysctllog;
void x86_cpu_idle_init(void);
void x86_cpu_idle_get(void (**)(void), char *, size_t);
@@ -43,5 +44,6 @@
int initx86_load_memmap(paddr_t first_avail);
void x86_startup(void);
+void x86_sysctl_machdep_setup(struct sysctllog **);
#endif /* _X86_MACHDEP_H_ */
diff -r 8114d1b6b47b -r 88a1d1b3cd37 sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c Fri Apr 12 16:32:37 2013 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c Fri Apr 12 16:59:38 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_machdep.c,v 1.57 2011/11/28 07:56:54 tls Exp $ */
+/* $NetBSD: x86_machdep.c,v 1.58 2013/04/12 16:59:40 christos Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.57 2011/11/28 07:56:54 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.58 2013/04/12 16:59:40 christos Exp $");
#include "opt_modular.h"
#include "opt_physmem.h"
@@ -1007,3 +1007,88 @@
nmi_init();
#endif /* !defined(XEN) */
}
+
+/*
+ * machine dependent system variables.
+ */
+static int
Home |
Main Index |
Thread Index |
Old Index