Add `machdep.cpu_arch' sysctl to determine the CPU architecture version.
Currrently, cpu types `sun4' and `sun4c' produce version 7, all others version 8.
This commit is contained in:
parent
3fd797268f
commit
ec667a0f51
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpu.h,v 1.49 2002/02/03 14:10:02 darrenr Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.50 2002/11/26 14:36:11 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -53,13 +53,15 @@
|
||||
#define CPU_BOOTED_KERNEL 1 /* string: booted kernel name */
|
||||
#define CPU_BOOTED_DEVICE 2 /* string: device booted from */
|
||||
#define CPU_BOOT_ARGS 3 /* string: args booted with */
|
||||
#define CPU_MAXID 4 /* number of valid machdep ids */
|
||||
#define CPU_ARCH 4 /* integer: cpu architecture version */
|
||||
#define CPU_MAXID 5 /* number of valid machdep ids */
|
||||
|
||||
#define CTL_MACHDEP_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "booted_kernel", CTLTYPE_STRING }, \
|
||||
{ "booted_device", CTLTYPE_STRING }, \
|
||||
{ "boot_args", CTLTYPE_STRING }, \
|
||||
{ "cpu_arch", CTLTYPE_INT }, \
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.203 2002/09/25 22:21:21 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.204 2002/11/26 14:36:10 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -488,6 +488,10 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
if (cp == NULL || cp[0] == '\0')
|
||||
return (ENOENT);
|
||||
return (sysctl_rdstring(oldp, oldlenp, newp, cp));
|
||||
case CPU_ARCH:
|
||||
/* CPU architecture version */
|
||||
return (sysctl_rdint(oldp, oldlenp, newp,
|
||||
(CPU_ISSUN4 || CPU_ISSUN4C) ? 7 : 8));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user