subr_pcpu.c (194784) | subr_pcpu.c (194935) |
---|---|
1/*- 2 * Copyright (c) 2001 Wind River Systems, Inc. 3 * All rights reserved. 4 * Written by: John Baldwin <jhb@FreeBSD.org> 5 * 6 * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org> 7 * All rights reserved. 8 * --- 32 unchanged lines hidden (view full) --- 41 * gaps in the mappings. 42 * - The platform sets the value of MAXCPU in <machine/param.h>. 43 * - It is suggested, but not required, that in the non-SMP case, the 44 * platform define MAXCPU to be 1 and define the logical ID of the 45 * sole CPU as 0. 46 */ 47 48#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Wind River Systems, Inc. 3 * All rights reserved. 4 * Written by: John Baldwin <jhb@FreeBSD.org> 5 * 6 * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org> 7 * All rights reserved. 8 * --- 32 unchanged lines hidden (view full) --- 41 * gaps in the mappings. 42 * - The platform sets the value of MAXCPU in <machine/param.h>. 43 * - It is suggested, but not required, that in the non-SMP case, the 44 * platform define MAXCPU to be 1 and define the logical ID of the 45 * sole CPU as 0. 46 */ 47 48#include <sys/cdefs.h> |
49__FBSDID("$FreeBSD: head/sys/kern/subr_pcpu.c 194784 2009-06-23 22:42:39Z jeff $"); | 49__FBSDID("$FreeBSD: head/sys/kern/subr_pcpu.c 194935 2009-06-25 01:31:59Z jeff $"); |
50 51#include "opt_ddb.h" 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/sysctl.h> 56#include <sys/linker_set.h> 57#include <sys/lock.h> --- 201 unchanged lines hidden (view full) --- 259{ 260 261 return (cpuid_to_pcpu[cpuid]); 262} 263 264int 265sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) 266{ | 50 51#include "opt_ddb.h" 52 53#include <sys/param.h> 54#include <sys/systm.h> 55#include <sys/sysctl.h> 56#include <sys/linker_set.h> 57#include <sys/lock.h> --- 201 unchanged lines hidden (view full) --- 259{ 260 261 return (cpuid_to_pcpu[cpuid]); 262} 263 264int 265sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) 266{ |
267 int64_t count; 268#ifdef SMP | |
269 uintptr_t dpcpu; | 267 uintptr_t dpcpu; |
268 int64_t count; |
|
270 int i; 271 272 count = 0; 273 for (i = 0; i < mp_ncpus; ++i) { 274 dpcpu = dpcpu_off[i]; 275 if (dpcpu == 0) 276 continue; 277 count += *(int64_t *)(dpcpu + (uintptr_t)arg1); 278 } | 269 int i; 270 271 count = 0; 272 for (i = 0; i < mp_ncpus; ++i) { 273 dpcpu = dpcpu_off[i]; 274 if (dpcpu == 0) 275 continue; 276 count += *(int64_t *)(dpcpu + (uintptr_t)arg1); 277 } |
279#else 280 count = *(int64_t *)(dpcpu_off[0] + (uintptr_t)arg1); 281#endif | |
282 return (SYSCTL_OUT(req, &count, sizeof(count))); 283} 284 285int | 278 return (SYSCTL_OUT(req, &count, sizeof(count))); 279} 280 281int |
282sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS) 283{ 284 uintptr_t dpcpu; 285 long count; 286 int i; 287 288 count = 0; 289 for (i = 0; i < mp_ncpus; ++i) { 290 dpcpu = dpcpu_off[i]; 291 if (dpcpu == 0) 292 continue; 293 count += *(long *)(dpcpu + (uintptr_t)arg1); 294 } 295 return (SYSCTL_OUT(req, &count, sizeof(count))); 296} 297 298int |
|
286sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) 287{ | 299sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) 300{ |
288 int count; 289#ifdef SMP | |
290 uintptr_t dpcpu; | 301 uintptr_t dpcpu; |
302 int count; |
|
291 int i; 292 293 count = 0; 294 for (i = 0; i < mp_ncpus; ++i) { 295 dpcpu = dpcpu_off[i]; 296 if (dpcpu == 0) 297 continue; 298 count += *(int *)(dpcpu + (uintptr_t)arg1); 299 } | 303 int i; 304 305 count = 0; 306 for (i = 0; i < mp_ncpus; ++i) { 307 dpcpu = dpcpu_off[i]; 308 if (dpcpu == 0) 309 continue; 310 count += *(int *)(dpcpu + (uintptr_t)arg1); 311 } |
300#else 301 count = *(int *)(dpcpu_off[0] + (uintptr_t)arg1); 302#endif | |
303 return (SYSCTL_OUT(req, &count, sizeof(count))); 304} 305 306#ifdef DDB 307 308static void 309show_pcpu(struct pcpu *pc) 310{ --- 71 unchanged lines hidden --- | 312 return (SYSCTL_OUT(req, &count, sizeof(count))); 313} 314 315#ifdef DDB 316 317static void 318show_pcpu(struct pcpu *pc) 319{ --- 71 unchanged lines hidden --- |