From 27c3aec1ad86d5930194e9e5972d9d1e98ef7156 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 7 May 2008 17:19:47 +0000 Subject: [PATCH] Correct comments and minor variable naming and sysctl issues. Reported-by: Fabio Checconi --- sys/platform/vkernel/i386/mp.c | 6 +++--- sys/platform/vkernel/platform/cothread.c | 7 +++++-- sys/platform/vkernel/platform/init.c | 17 +++++++++++------ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/platform/vkernel/i386/mp.c b/sys/platform/vkernel/i386/mp.c index d7e2a687e3..6e0459821b 100644 --- a/sys/platform/vkernel/i386/mp.c +++ b/sys/platform/vkernel/i386/mp.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/i386/mp.c,v 1.7 2007/08/15 03:10:49 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/i386/mp.c,v 1.8 2008/05/07 17:19:46 dillon Exp $ */ @@ -362,8 +362,8 @@ init_secondary(void) KKASSERT(ps->mdglobaldata.mi.gd_prvspace == ps); /* - * Setup the %gs for cpu #n. The mycpu macro works after this - * point. + * Setup the %fs for cpu #n. The mycpu macro works after this + * point. Note that %gs is used by pthreads. */ tls_set_fs(&CPU_prvspace[myid], sizeof(struct privatespace)); diff --git a/sys/platform/vkernel/platform/cothread.c b/sys/platform/vkernel/platform/cothread.c index a724d49f49..cf25ff69c8 100644 --- a/sys/platform/vkernel/platform/cothread.c +++ b/sys/platform/vkernel/platform/cothread.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/cothread.c,v 1.2 2008/03/27 04:28:09 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/cothread.c,v 1.3 2008/05/07 17:19:47 dillon Exp $ */ /* * Provides the vkernel with an asynchronous I/O mechanism using pthreads @@ -106,7 +106,10 @@ cothread_thread(void *arg) int dummy = 0; cpu_mask_all_signals(); - /* %fs (aka mycpu) is illegal in cothreads */ + /* + * %fs (aka mycpu) is illegal in cothreads. Note that %fs is used + * by pthreads. + */ tls_set_fs(&dummy, sizeof(dummy)); cotd->thr_func(cotd); } diff --git a/sys/platform/vkernel/platform/init.c b/sys/platform/vkernel/platform/init.c index cda9c87ff4..a15da0cce2 100644 --- a/sys/platform/vkernel/platform/init.c +++ b/sys/platform/vkernel/platform/init.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/init.c,v 1.50 2008/05/06 21:40:40 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/init.c,v 1.51 2008/05/07 17:19:47 dillon Exp $ */ #include @@ -98,7 +98,7 @@ caddr_t ptvmmap; vpte_t *KernelPTD; vpte_t *KernelPTA; /* Warning: Offset for direct VA translation */ u_int cpu_feature; /* XXX */ -u_int tsc_present; /* XXX */ +int tsc_present; /* XXX */ int optcpus; /* number of cpus - see mp_start() */ int lwp_cpu_lock; /* if/how to lock virtual CPUs to real CPUs */ int real_ncpus; /* number of real CPUs */ @@ -159,13 +159,17 @@ main(int ac, char **av) #endif lwp_cpu_lock = LCL_NONE; + real_vkernel_enable = 0; real_vkernel_enable_size = sizeof(real_vkernel_enable); sysctlbyname("vm.vkernel_enable", &real_vkernel_enable, &real_vkernel_enable_size, NULL, 0); - if (real_vkernel_enable == 0) - errx(1,"vm.vkernel_enable is %d, must be set to 1 to execute a vkernel!", real_vkernel_enable); + if (real_vkernel_enable == 0) { + errx(1, "vm.vkernel_enable is 0, must be set " + "to 1 to execute a vkernel!"); + } real_ncpus_size = sizeof(real_ncpus); + real_ncpus = 1; sysctlbyname("hw.ncpu", &real_ncpus, &real_ncpus_size, NULL, 0); while ((c = getopt(ac, av, "c:svl:m:n:r:e:i:p:I:U")) != -1) { @@ -293,6 +297,7 @@ main(int ac, char **av) init_kqueue(); supports_sse_size = sizeof(supports_sse); + supports_sse = 0; sysctlbyname("hw.instruction_sse", &supports_sse, &supports_sse_size, NULL, 0); init_fpu(supports_sse); @@ -608,8 +613,8 @@ init_globaldata(void) } /* - * Setup the %gs for cpu #0. The mycpu macro works after this - * point. + * Setup the %fs for cpu #0. The mycpu macro works after this + * point. Note that %gs is used by pthreads. */ tls_set_fs(&CPU_prvspace[0], sizeof(struct privatespace)); } -- 2.11.4.GIT