本文整理汇总了C++中cpu_number函数的典型用法代码示例。如果您正苦于以下问题:C++ cpu_number函数的具体用法?C++ cpu_number怎么用?C++ cpu_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpu_number函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: panic_prologue
static spl_t
panic_prologue(const char *str)
{
spl_t s;
if (kdebug_enable) {
ml_set_interrupts_enabled(TRUE);
kdbg_dump_trace_to_file("/var/tmp/panic.trace");
}
s = splhigh();
disable_preemption();
#if defined(__i386__) || defined(__x86_64__)
/* Attempt to display the unparsed panic string */
const char *tstr = str;
kprintf("Panic initiated, string: ");
while (tstr && *tstr)
kprintf("%c", *tstr++);
kprintf("\n");
#endif
panic_safe();
#ifndef __arm__ /* xxx show all panic output for now. */
if( logPanicDataToScreen )
#endif
disable_debug_output = FALSE;
debug_mode = TRUE;
restart:
PANIC_LOCK();
if (panicstr) {
if (cpu_number() != paniccpu) {
PANIC_UNLOCK();
/*
* Wait until message has been printed to identify correct
* cpu that made the first panic.
*/
while (panicwait)
continue;
goto restart;
} else {
nestedpanic +=1;
PANIC_UNLOCK();
Debugger("double panic");
printf("double panic: We are hanging here...\n");
panic_stop();
/* NOTREACHED */
}
}
panicstr = str;
paniccpu = cpu_number();
panicwait = 1;
PANIC_UNLOCK();
return(s);
}
示例2: smp_tlb_flush_pte
/*
* Flush pte on all active processors.
*/
void
smp_tlb_flush_pte(vaddr_t va, struct pmap * pm)
{
sparc64_cpuset_t cpuset;
struct cpu_info *ci;
int ctx;
bool kpm = (pm == pmap_kernel());
/* Flush our own TLB */
ctx = pm->pm_ctx[cpu_number()];
KASSERT(ctx >= 0);
if (kpm || ctx > 0)
sp_tlb_flush_pte(va, ctx);
CPUSET_ASSIGN(cpuset, cpus_active);
CPUSET_DEL(cpuset, cpu_number());
if (CPUSET_EMPTY(cpuset))
return;
/* Flush others */
for (ci = cpus; ci != NULL; ci = ci->ci_next) {
if (CPUSET_HAS(cpuset, ci->ci_index)) {
CPUSET_DEL(cpuset, ci->ci_index);
ctx = pm->pm_ctx[ci->ci_index];
KASSERT(ctx >= 0);
if (!kpm && ctx == 0)
continue;
sparc64_send_ipi(ci->ci_cpuid, smp_tlb_flush_pte_func, va, ctx);
}
}
}
示例3: usld_lock_held
/*
* Determine whether the lock in question is owned
* by the current thread.
*/
void
usld_lock_held(
usimple_lock_t l)
{
char *caller = "usimple_lock_held";
if (!usld_lock_common_checks(l, caller))
return;
if (!(l->debug.state & USLOCK_TAKEN))
panic("%s: lock 0x%x hasn't been taken",
caller, (integer_t) l);
if (l->debug.lock_thread != (void *) current_thread())
panic("%s: lock 0x%x is owned by thread 0x%x", caller,
(integer_t) l, (integer_t) l->debug.lock_thread);
#if MACH_RT
/*
* The usimple_lock is active, so preemption
* is disabled and the current cpu should
* match the one recorded at lock acquisition time.
*/
if (l->debug.lock_cpu != cpu_number())
panic("%s: current cpu 0x%x isn't acquiring cpu 0x%x",
caller, cpu_number(), (integer_t) l->debug.lock_cpu);
#endif /* MACH_RT */
}
示例4: machine_idle
/*
* Called when the CPU is idle. It calls into the power management kext
* to determine the best way to idle the CPU.
*/
void
machine_idle(void)
{
cpu_data_t *my_cpu = current_cpu_datap();
if (my_cpu == NULL)
goto out;
my_cpu->lcpu.state = LCPU_IDLE;
DBGLOG(cpu_handle, cpu_number(), MP_IDLE);
MARK_CPU_IDLE(cpu_number());
if (pmInitDone) {
/*
* Handle case where ml_set_maxbusdelay() or ml_set_maxintdelay()
* were called prior to the CPU PM kext being registered. We do
* this here since we know at this point the values will be first
* used since idle is where the decisions using these values is made.
*/
if (earlyMaxBusDelay != DELAY_UNSET)
ml_set_maxbusdelay((uint32_t)(earlyMaxBusDelay & 0xFFFFFFFF));
if (earlyMaxIntDelay != DELAY_UNSET)
ml_set_maxintdelay(earlyMaxIntDelay);
}
if (pmInitDone
&& pmDispatch != NULL
&& pmDispatch->MachineIdle != NULL)
(*pmDispatch->MachineIdle)(0x7FFFFFFFFFFFFFFFULL);
else {
/*
* If no power management, re-enable interrupts and halt.
* This will keep the CPU from spinning through the scheduler
* and will allow at least some minimal power savings (but it
* cause problems in some MP configurations w.r.t. the APIC
* stopping during a GV3 transition).
*/
pal_hlt();
/* Once woken, re-disable interrupts. */
pal_cli();
}
/*
* Mark the CPU as running again.
*/
MARK_CPU_ACTIVE(cpu_number());
DBGLOG(cpu_handle, cpu_number(), MP_UNIDLE);
my_cpu->lcpu.state = LCPU_RUN;
/*
* Re-enable interrupts.
*/
out:
pal_sti();
}
示例5: ucode_update_wake
/*
* This is called once by every CPU on a wake from sleep/hibernate
* and is meant to re-apply a microcode update that got lost
* by sleeping.
*/
void
ucode_update_wake()
{
if (global_update) {
kprintf("ucode: Re-applying update after wake (CPU #%d)\n", cpu_number());
update_microcode();
#ifdef DEBUG
} else {
kprintf("ucode: No update to apply (CPU #%d)\n", cpu_number());
#endif
}
}
示例6: cpu_startup_common
void
cpu_startup_common(void)
{
vaddr_t minaddr, maxaddr;
char pbuf[9]; /* "99999 MB" */
pmap_tlb_info_evcnt_attach(&pmap_tlb0_info);
#ifdef MULTIPROCESSOR
kcpuset_create(&cpus_halted, true);
KASSERT(cpus_halted != NULL);
kcpuset_create(&cpus_hatched, true);
KASSERT(cpus_hatched != NULL);
kcpuset_create(&cpus_paused, true);
KASSERT(cpus_paused != NULL);
kcpuset_create(&cpus_resumed, true);
KASSERT(cpus_resumed != NULL);
kcpuset_create(&cpus_running, true);
KASSERT(cpus_running != NULL);
kcpuset_set(cpus_hatched, cpu_number());
kcpuset_set(cpus_running, cpu_number());
#endif
cpu_hwrena_setup();
/*
* Good {morning,afternoon,evening,night}.
*/
printf("%s%s", copyright, version);
printf("%s\n", cpu_getmodel());
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
printf("total memory = %s\n", pbuf);
minaddr = 0;
/*
* Allocate a submap for physio.
*/
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
/*
* (No need to allocate an mbuf cluster submap. Mbuf clusters
* are allocated via the pool allocator, and we use KSEG/XKPHYS to
* map those pages.)
*/
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
#if defined(__mips_n32)
module_machine = "mips-n32";
#endif
}
示例7: error_fatal
__dead void
error_fatal(struct trapframe *frame)
{
if (frame->tf_vector == 0)
printf("\nCPU %d Reset Exception\n", cpu_number());
else
printf("\nCPU %d Error Exception\n", cpu_number());
#ifdef DDB
regdump((struct trapframe*)frame);
#endif
panic("unrecoverable exception %d", frame->tf_vector);
}
示例8: get_cpu_tick_diff_callback
static void get_cpu_tick_diff_callback(void *data)
{
tsc_t *values = (tsc_t *) data;
int cpu = cpu_number();
values[cpu].raw = rdtsc();
values[cpu].corrected = mach_absolute_time();
}
示例9: smp_rendezvous_cpus
void
smp_rendezvous_cpus(unsigned long map,
void (* action_func)(void *),
void *arg)
{
unsigned int cpumask = 1 << cpu_number();
if (ncpus == 1) {
if (action_func != NULL)
action_func(arg);
return;
}
/* obtain rendezvous lock */
mtx_enter(&smp_ipi_mtx);
/* set static function pointers */
smp_rv_map = map;
smp_rv_action_func = action_func;
smp_rv_func_arg = arg;
smp_rv_waiters[0] = 0;
smp_rv_waiters[1] = 0;
/* signal other processors, which will enter the IPI with interrupts off */
mips64_multicast_ipi(map & ~cpumask, MIPS64_IPI_RENDEZVOUS);
/* Check if the current CPU is in the map */
if (map & cpumask)
smp_rendezvous_action();
while (smp_rv_waiters[1] != smp_rv_map)
;
/* release lock */
mtx_leave(&smp_ipi_mtx);
}
示例10: mips64_ipi_nop
void
mips64_ipi_nop(void)
{
#ifdef DEBUG
printf("mips64_ipi_nop on cpu%d\n", cpu_number());
#endif
}
示例11: panic_double_fault64
void
panic_double_fault64(x86_saved_state_t *sp)
{
(void)OSCompareAndSwap((UInt32) -1, (UInt32) cpu_number(), (volatile UInt32 *)&panic_double_fault_cpu);
panic_64(sp, PANIC_DOUBLE_FAULT, "Double fault", FALSE);
}
示例12: sparc64_broadcast_ipi
/*
* Broadcast an IPI to all but ourselves.
*/
void
sparc64_broadcast_ipi(ipifunc_t func, uint64_t arg1, uint64_t arg2)
{
sparc64_multicast_ipi(CPUSET_EXCEPT(cpus_active, cpu_number()), func,
arg1, arg2);
}
示例13: rtmpOnAllDarwinWrapper
/**
* Wrapper between the native darwin per-cpu callback and PFNRTWORKER
* for the RTMpOnAll API.
*
* @param pvArg Pointer to the RTMPARGS package.
*/
static void rtmpOnAllDarwinWrapper(void *pvArg)
{
PRTMPARGS pArgs = (PRTMPARGS)pvArg;
IPRT_DARWIN_SAVE_EFL_AC();
pArgs->pfnWorker(cpu_number(), pArgs->pvUser1, pArgs->pvUser2);
IPRT_DARWIN_RESTORE_EFL_AC();
}
示例14: __mp_lock_held
int
__mp_lock_held(struct __mp_lock *mpl)
{
struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[cpu_number()];
return (cpu->mplc_ticket == mpl->mpl_ticket && cpu->mplc_depth > 0);
}
示例15: usld_lock_try_post
/*
* Debug checks on a usimple_lock just after
* successfully attempting to acquire it.
*
* Preemption has been disabled by the
* lock acquisition attempt, so it's safe
* to use cpu_number.
*/
void
usld_lock_try_post(
usimple_lock_t l,
pc_t pc)
{
register int mycpu;
char caller[] = "successful usimple_lock_try";
if (!usld_lock_common_checks(l, caller))
return;
if (!((l->debug.state & ~USLOCK_TAKEN) == USLOCK_INITIALIZED))
panic("%s: lock 0x%x became uninitialized",
caller, (integer_t) l);
if ((l->debug.state & USLOCK_TAKEN))
panic("%s: lock 0x%x became TAKEN by someone else",
caller, (integer_t) l);
mycpu = cpu_number();
l->debug.lock_thread = (void *) current_thread();
l->debug.state |= USLOCK_TAKEN;
l->debug.lock_pc = pc;
l->debug.lock_cpu = mycpu;
usl_trace(l, mycpu, pc, caller);
}