这篇教程C++ Debugger函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Debugger函数的典型用法代码示例。如果您正苦于以下问题:C++ Debugger函数的具体用法?C++ Debugger怎么用?C++ Debugger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Debugger函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: prom_cngetcintprom_cngetc(dev_t dev){ unsigned char ch = '/0'; int l;#ifdef DDB static int nplus = 0;#endif while ((l = OF_read(stdin, &ch, 1)) != 1) /* void */;#ifdef DDB if (ch == '+') { if (nplus++ > 3) Debugger(); } else nplus = 0;#endif if (ch == '/r') ch = '/n'; if (ch == '/b') ch = '/177'; return ch;}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:24,
示例2: hammer_critical_error/* * Report critical errors. ip may be NULL. */voidhammer_critical_error(hammer_mount_t hmp, hammer_inode_t ip, int error, const char *msg){ hmp->flags |= HAMMER_MOUNT_CRITICAL_ERROR; krateprintf(&hmp->krate, "HAMMER(%s): Critical error inode=%jd error=%d %s/n", hmp->mp->mnt_stat.f_mntfromname, (intmax_t)(ip ? ip->obj_id : -1), error, msg); if (hmp->ronly == 0) { hmp->ronly = 2; /* special errored read-only mode */ hmp->mp->mnt_flag |= MNT_RDONLY; RB_SCAN(hammer_vol_rb_tree, &hmp->rb_vols_root, NULL, hammer_adjust_volume_mode, NULL); kprintf("HAMMER(%s): Forcing read-only mode/n", hmp->mp->mnt_stat.f_mntfromname); } hmp->error = error; if (hammer_debug_critical) Debugger("Entering debugger");}
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:27,
示例3: hammer_lock_sh/* * Obtain a shared lock * * We do not give pending exclusive locks priority over shared locks as * doing so could lead to a deadlock. */voidhammer_lock_sh(struct hammer_lock *lock){ thread_t td = curthread; u_int lv; u_int nlv; const char *ident = "hmrlck"; KKASSERT(lock->refs); for (;;) { lv = lock->lockval; if ((lv & HAMMER_LOCKF_EXCLUSIVE) == 0) { nlv = (lv + 1); if (atomic_cmpset_int(&lock->lockval, lv, nlv)) break; } else if (lock->lowner == td) { /* * Disallowed case, drop into kernel debugger for * now. A cont continues w/ an exclusive lock. */ nlv = (lv + 1); if (atomic_cmpset_int(&lock->lockval, lv, nlv)) { if (hammer_debug_critical) Debugger("hammer_lock_sh: holding ex"); break; } } else { nlv = lv | HAMMER_LOCKF_WANTED; ++hammer_contention_count; tsleep_interlock(&lock->lockval, 0); if (atomic_cmpset_int(&lock->lockval, lv, nlv)) tsleep(&lock->lockval, PINTERLOCKED, ident, 0); } }}
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:42,
示例4: cpu_boot_secondaryvoidcpu_boot_secondary(struct cpu_info *ci){ struct pcb *pcb; int i; struct pmap *kpm = pmap_kernel(); extern u_int32_t mp_pdirpa; if (mp_verbose) printf("%s: starting", ci->ci_dev.dv_xname); /* XXX move elsewhere, not per CPU. */ mp_pdirpa = kpm->pm_pdirpa; pcb = ci->ci_idle_pcb; if (mp_verbose) printf(", init idle stack ptr is 0x%x/n", pcb->pcb_esp); CPU_STARTUP(ci); /* * wait for it to become ready */ for (i = 100000; (!(ci->ci_flags & CPUF_RUNNING)) && i > 0; i--) { delay(10); } if (!(ci->ci_flags & CPUF_RUNNING)) { printf("%s failed to become ready/n", ci->ci_dev.dv_xname);#ifdef DDB Debugger();#endif } CPU_START_CLEANUP(ci);}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:36,
示例5: lck_rw_lock_shared_to_exclusiveboolean_tlck_rw_lock_shared_to_exclusive( lck_rw_t *lck){ int i; boolean_t do_wakeup = FALSE; wait_result_t res;#if MACH_LDEBUG int decrementer;#endif /* MACH_LDEBUG */ boolean_t istate;#if CONFIG_DTRACE uint64_t wait_interval = 0; int slept = 0; int readers_at_sleep = 0;#endif istate = lck_interlock_lock(lck); lck->lck_rw_shared_count--; if (lck->lck_rw_want_upgrade) { KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_SH_TO_EX_CODE) | DBG_FUNC_START, (int)lck, lck->lck_rw_shared_count, lck->lck_rw_want_upgrade, 0, 0); /* * Someone else has requested upgrade. * Since we've released a read lock, wake * him up. */ if (lck->lck_w_waiting && (lck->lck_rw_shared_count == 0)) { lck->lck_w_waiting = FALSE; do_wakeup = TRUE; } lck_interlock_unlock(lck, istate); if (do_wakeup) thread_wakeup(RW_LOCK_WRITER_EVENT(lck)); KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_SH_TO_EX_CODE) | DBG_FUNC_END, (int)lck, lck->lck_rw_shared_count, lck->lck_rw_want_upgrade, 0, 0); return (FALSE); } lck->lck_rw_want_upgrade = TRUE;#if MACH_LDEBUG decrementer = DECREMENTER_TIMEOUT;#endif /* MACH_LDEBUG */ while (lck->lck_rw_shared_count != 0) {#if CONFIG_DTRACE if (lockstat_probemap[LS_LCK_RW_LOCK_SHARED_TO_EXCL_SPIN] && wait_interval == 0) { wait_interval = mach_absolute_time(); readers_at_sleep = lck->lck_rw_shared_count; } else { wait_interval = -1; }#endif i = lock_wait_time[lck->lck_rw_can_sleep ? 1 : 0]; KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_SH_TO_EX1_CODE) | DBG_FUNC_START, (int)lck, lck->lck_rw_shared_count, i, 0, 0); if (i != 0) { lck_interlock_unlock(lck, istate);#if MACH_LDEBUG if (!--decrementer) Debugger("timeout - lck_rw_shared_count");#endif /* MACH_LDEBUG */ while (--i != 0 && lck->lck_rw_shared_count != 0) lck_rw_lock_pause(istate); istate = lck_interlock_lock(lck); } if (lck->lck_rw_can_sleep && lck->lck_rw_shared_count != 0) { lck->lck_w_waiting = TRUE; res = assert_wait(RW_LOCK_WRITER_EVENT(lck), THREAD_UNINT); if (res == THREAD_WAITING) { lck_interlock_unlock(lck, istate); res = thread_block(THREAD_CONTINUE_NULL);#if CONFIG_DTRACE slept = 1;#endif istate = lck_interlock_lock(lck); } } KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_SH_TO_EX1_CODE) | DBG_FUNC_END, (int)lck, lck->lck_rw_shared_count, 0, 0, 0); } lck_interlock_unlock(lck, istate);#if CONFIG_DTRACE /* * We infer whether we took the sleep/spin path above by checking readers_at_sleep. */ if (wait_interval != 0 && wait_interval != (unsigned) -1 && readers_at_sleep) { if (slept == 0) { LOCKSTAT_RECORD2(LS_LCK_RW_LOCK_SHARED_TO_EXCL_SPIN, lck, mach_absolute_time() - wait_interval, 0);//.........这里部分代码省略.........
开发者ID:MACasuba,项目名称:MACasuba-Utils-git,代码行数:101,
示例6: Stopvoid Stop(){ Debugging = 1; Debugger();}
开发者ID:plucena,项目名称:talkagent,代码行数:5,
示例7: panic//.........这里部分代码省略......... if (xgd && xgd != gd) { crit_enter(); ++mycpu->gd_trap_nesting_level; if (mycpu->gd_trap_nesting_level < 25) { kprintf("SECONDARY PANIC ON CPU %d THREAD %p/n", mycpu->gd_cpuid, td); } td->td_release = NULL; /* be a grinch */ for (;;) { lwkt_deschedule_self(td); lwkt_switch(); } /* NOT REACHED */ /* --mycpu->gd_trap_nesting_level */ /* crit_exit() */ } /* * Reentrant panic */ if (xgd && xgd == gd) break; /* * We got it */ if (atomic_cmpset_ptr(&panic_cpu_gd, NULL, gd)) break; }#else panic_cpu_gd = gd;#endif /* * Try to get the system into a working state. Save information * we are about to destroy. */ kvcreinitspin(); if (panicstr == NULL) { bcopy(td->td_toks_array, panic_tokens, sizeof(panic_tokens)); panic_tokens_count = td->td_toks_stop - &td->td_toks_base; } lwkt_relalltokens(td); td->td_toks_stop = &td->td_toks_base; /* * Setup */ bootopt = RB_AUTOBOOT | RB_DUMP; if (sync_on_panic == 0) bootopt |= RB_NOSYNC; newpanic = 0; if (panicstr) { bootopt |= RB_NOSYNC; } else { panicstr = fmt; newpanic = 1; } /* * Format the panic string. */ __va_start(ap, fmt); kvsnprintf(buf, sizeof(buf), fmt, ap); if (panicstr == fmt) panicstr = buf; __va_end(ap); kprintf("panic: %s/n", buf);#ifdef SMP /* two separate prints in case of an unmapped page and trap */ kprintf("cpuid = %d/n", mycpu->gd_cpuid);#endif#if (NGPIO > 0) && defined(ERROR_LED_ON_PANIC) led_switch("error", 1);#endif#if defined(WDOG_DISABLE_ON_PANIC) && defined(WATCHDOG_ENABLE) wdog_disable();#endif /* * Enter the debugger or fall through & dump. Entering the * debugger will stop cpus. If not entering the debugger stop * cpus here. */#if defined(DDB) if (newpanic && trace_on_panic) print_backtrace(-1); if (debugger_on_panic) Debugger("panic"); else#endif#ifdef SMP if (newpanic) stop_cpus(mycpu->gd_other_cpus);#else ;#endif boot(bootopt);}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:101,
示例8: hammer2_hardlink_shiftup/* * Shift *chainp up to the specified directory, change the filename * to "0xINODENUMBER", and adjust the key. The chain becomes the * invisible hardlink target. * * The original *chainp has already been marked deleted. */staticvoidhammer2_hardlink_shiftup(hammer2_trans_t *trans, hammer2_chain_t **chainp, hammer2_inode_t *dip, hammer2_chain_t **dchainp, int nlinks, int *errorp){ hammer2_inode_data_t *nipdata; hammer2_chain_t *chain; hammer2_chain_t *xchain; hammer2_key_t key_dummy; hammer2_key_t lhc; hammer2_blockref_t bref; int cache_index = -1; chain = *chainp; lhc = chain->data->ipdata.inum; KKASSERT((lhc & HAMMER2_DIRHASH_VISIBLE) == 0); /* * Locate the inode or indirect block to create the new * entry in. lhc represents the inode number so there is * no collision iteration. * * There should be no key collisions with invisible inode keys. * * WARNING! Must use inode_lock_ex() on dip to handle a stale * dip->chain cache. */retry: *errorp = 0; xchain = hammer2_chain_lookup(dchainp, &key_dummy, lhc, lhc, &cache_index, 0); if (xchain) { kprintf("X3 chain %p dip %p dchain %p dip->chain %p/n", xchain, dip, *dchainp, dip->chain); hammer2_chain_unlock(xchain); xchain = NULL; *errorp = ENOSPC;#if 0 Debugger("X3");#endif } /* * Create entry in common parent directory using the seek position * calculated above. * * We must refactor chain because it might have been shifted into * an indirect chain by the create. */ if (*errorp == 0) { KKASSERT(xchain == NULL);#if 0 *errorp = hammer2_chain_create(trans, dchainp, &xchain, lhc, 0, HAMMER2_BREF_TYPE_INODE,/* n/a */ HAMMER2_INODE_BYTES); /* n/a */#endif /*XXX this somehow isn't working on chain XXX*/ /*KKASSERT(xxx)*/ } /* * Cleanup and handle retries. */ if (*errorp == EAGAIN) { kprintf("R"); hammer2_chain_wait(*dchainp); hammer2_chain_drop(*dchainp); goto retry; } /* * Handle the error case */ if (*errorp) { panic("error2"); KKASSERT(xchain == NULL); return; } /* * Use xchain as a placeholder for (lhc). Duplicate chain to the * same target bref as xchain and then delete xchain. The duplication * occurs after xchain in flush order even though xchain is deleted * after the duplication. XXX * * WARNING! Duplications (to a different parent) can cause indirect * blocks to be inserted, refactor xchain. */ bref = chain->bref; bref.key = lhc; /* invisible dir entry key */ bref.keybits = 0;//.........这里部分代码省略.........
开发者ID:mihaicarabas,项目名称:dragonfly,代码行数:101,
示例9: compat_16_netbsd32___sigreturn14/* ARGSUSED */intcompat_16_netbsd32___sigreturn14(struct lwp *l, const struct compat_16_netbsd32___sigreturn14_args *uap, register_t *retval){ /* { syscallarg(struct sigcontext *) sigcntxp; } */ struct netbsd32_sigcontext sc, *scp; struct trapframe64 *tf; struct proc *p = l->l_proc; /* First ensure consistent stack state (see sendsig). */ write_user_windows(); if (rwindow_save(l)) {#ifdef DEBUG printf("netbsd32_sigreturn14: rwindow_save(%p) failed, sending SIGILL/n", p); Debugger();#endif mutex_enter(p->p_lock); sigexit(l, SIGILL); }#ifdef DEBUG if (sigdebug & SDB_FOLLOW) { printf("netbsd32_sigreturn14: %s[%d], sigcntxp %p/n", p->p_comm, p->p_pid, SCARG(uap, sigcntxp)); if (sigdebug & SDB_DDB) Debugger(); }#endif scp = (struct netbsd32_sigcontext *)(u_long)SCARG(uap, sigcntxp); if ((vaddr_t)scp & 3 || (copyin((void *)scp, &sc, sizeof sc) != 0)) {#ifdef DEBUG printf("netbsd32_sigreturn14: copyin failed: scp=%p/n", scp); Debugger();#endif return (EINVAL); } scp = ≻ tf = l->l_md.md_tf; /* * Only the icc bits in the psr are used, so it need not be * verified. pc and npc must be multiples of 4. This is all * that is required; if it holds, just do it. */ if (((sc.sc_pc | sc.sc_npc) & 3) != 0 || (sc.sc_pc == 0) || (sc.sc_npc == 0))#ifdef DEBUG { printf("netbsd32_sigreturn14: pc %p or npc %p invalid/n", sc.sc_pc, sc.sc_npc); Debugger(); return (EINVAL); }#else return (EINVAL);#endif /* take only psr ICC field */ tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(sc.sc_psr); tf->tf_pc = (int64_t)sc.sc_pc; tf->tf_npc = (int64_t)sc.sc_npc; tf->tf_global[1] = (int64_t)sc.sc_g1; tf->tf_out[0] = (int64_t)sc.sc_o0; tf->tf_out[6] = (int64_t)sc.sc_sp;#ifdef DEBUG if (sigdebug & SDB_FOLLOW) { printf("netbsd32_sigreturn14: return trapframe pc=%p sp=%p tstate=%llx/n", (vaddr_t)tf->tf_pc, (vaddr_t)tf->tf_out[6], tf->tf_tstate); if (sigdebug & SDB_DDB) Debugger(); }#endif /* Restore signal stack. */ mutex_enter(p->p_lock); if (sc.sc_onstack & SS_ONSTACK) l->l_sigstk.ss_flags |= SS_ONSTACK; else l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ (void) sigprocmask1(l, SIG_SETMASK, &sc.sc_mask, 0); mutex_exit(p->p_lock); return (EJUSTRETURN);}
开发者ID:ycui1984,项目名称:netbsd-src,代码行数:82,
示例10: mips_init//.........这里部分代码省略......... /* * Last chance to call the BIOS. Wiping the TLB means the BIOS' data * areas are demapped on most systems. */ delay(20*1000); /* Let any UART FIFO drain... */ sys_config.cpu[0].tlbwired = UPAGES / 2; tlb_set_wired(0); tlb_flush(sys_config.cpu[0].tlbsize); tlb_set_wired(sys_config.cpu[0].tlbwired); /* * Get a console, very early but after initial mapping setup. */ consinit(); printf("Initial setup done, switching console./n"); /* * Init message buffer. */ msgbufbase = (caddr_t)pmap_steal_memory(MSGBUFSIZE, NULL,NULL); initmsgbuf(msgbufbase, MSGBUFSIZE); /* * Allocate U page(s) for proc[0], pm_tlbpid 1. */ proc0.p_addr = proc0paddr = curprocpaddr = (struct user *)pmap_steal_memory(USPACE, NULL, NULL); proc0.p_md.md_regs = (struct trap_frame *)&proc0paddr->u_pcb.pcb_regs; tlb_set_pid(1); /* * Allocate system data structures. */ i = (vsize_t)allocsys(NULL); sd = (caddr_t)pmap_steal_memory(i, NULL, NULL); allocsys(sd); /* * Bootstrap VM system. */ pmap_bootstrap(); /* * Copy down exception vector code. */ bcopy(exception, (char *)CACHE_ERR_EXC_VEC, e_exception - exception); bcopy(exception, (char *)GEN_EXC_VEC, e_exception - exception); /* * Build proper TLB refill handler trampolines. */ switch (cputype) { case MIPS_R5000: /* * R5000 processors need a specific chip bug workaround * in their tlb handlers. Theoretically only revision 1 * of the processor need it, but there is evidence * later versions also need it. * * This is also necessary on RM52x0; we test on the `rounded' * cputype value instead of sys_config.cpu[0].type; this * causes RM7k and RM9k to be included, just to be on the * safe side. */ tlb_handler = (vaddr_t)&tlb_miss_err_r5k; xtlb_handler = (vaddr_t)&xtlb_miss_err_r5k; break; default: tlb_handler = (vaddr_t)&tlb_miss; xtlb_handler = (vaddr_t)&xtlb_miss; break; } build_trampoline(TLB_MISS_EXC_VEC, tlb_handler); build_trampoline(XTLB_MISS_EXC_VEC, xtlb_handler); /* * Turn off bootstrap exception vectors. */ setsr(getsr() & ~SR_BOOT_EXC_VEC); proc0.p_md.md_regs->sr = getsr(); /* * Clear out the I and D caches. */ Mips_SyncCache();#ifdef DDB db_machine_init(); if (boothowto & RB_KDB) Debugger();#endif /* * Return new stack pointer. */ return ((caddr_t)proc0paddr + USPACE - 64);}
开发者ID:genua,项目名称:anoubis_os,代码行数:101,
示例11: mach_init//.........这里部分代码省略......... physmem += btoc(((int) len)); mem_clusters[mem_cluster_cnt].start = (long) start; mem_clusters[mem_cluster_cnt].size = (long) len; mem_cluster_cnt++; added = 1; } } if (added) printf("added to map/n"); else printf("not added to map/n"); idx++; } } else { /* * Handle the case of not being called from the firmware. */ /* XXX hardwire to 32MB; should be kernel config option */ physmem = 32 * 1024 * 1024 / 4096; mem_clusters[0].start = 0; mem_clusters[0].size = ctob(physmem); mem_cluster_cnt = 1; } for (i = 0; i < sizeof(bootinfo.boot_flags); i++) { switch (bootinfo.boot_flags[i]) { case '/0': break; case ' ': continue; case '-': while (bootinfo.boot_flags[i] != ' ' && bootinfo.boot_flags[i] != '/0') { switch (bootinfo.boot_flags[i]) { case 'a': boothowto |= RB_ASKNAME; break; case 'd': boothowto |= RB_KDB; break; case 's': boothowto |= RB_SINGLE; break; } i++; } } } /* * Load the rest of the available pages into the VM system. * The first chunk is tricky because we have to avoid the * kernel, but the rest are easy. */ first = round_page(MIPS_KSEG0_TO_PHYS(kernend)); last = mem_clusters[0].start + mem_clusters[0].size; uvm_page_physload(atop(first), atop(last), atop(first), atop(last), VM_FREELIST_DEFAULT); for (i = 1; i < mem_cluster_cnt; i++) { first = round_page(mem_clusters[i].start); last = mem_clusters[i].start + mem_clusters[i].size; uvm_page_physload(atop(first), atop(last), atop(first), atop(last), VM_FREELIST_DEFAULT); } /* * Initialize error message buffer (at end of core). */ mips_init_msgbuf(); /* * Allocate space for proc0's USPACE */ p0 = (void *)pmap_steal_memory(USPACE, NULL, NULL); lwp0.l_addr = proc0paddr = (struct user *)p0; lwp0.l_md.md_regs = (struct frame *)((char *)p0 + USPACE) - 1; proc0paddr->u_pcb.pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */ pmap_bootstrap(); /* * Initialize debuggers, and break into them, if appropriate. */#if NKSYMS || defined(DDB) || defined(LKM) ksyms_init(((uintptr_t)ksym_end - (uintptr_t)ksym_start), ksym_start, ksym_end);#endif if (boothowto & RB_KDB) {#if defined(DDB) Debugger();#endif }}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:101,
示例12: trap_pfault//.........这里部分代码省略......... if (vm == NULL) { fault_flags = -1; ftype = -1; goto nogo; } /* * Debugging, try to catch kernel faults on the user address * space when not inside on onfault (e.g. copyin/copyout) * routine. */ if (usermode == 0 && (td->td_pcb == NULL || td->td_pcb->pcb_onfault == NULL)) {#ifdef DDB if (freeze_on_seg_fault) { kprintf("trap_pfault: user address fault from kernel mode " "%016lx/n", (long)frame->tf_addr); while (freeze_on_seg_fault) tsleep(&freeze_on_seg_fault, 0, "frzseg", hz * 20); }#endif } map = &vm->vm_map; } /* * PGEX_I is defined only if the execute disable bit capability is * supported and enabled. */ if (frame->tf_err & PGEX_W) ftype = VM_PROT_WRITE; else if (frame->tf_err & PGEX_I) ftype = VM_PROT_EXECUTE; else ftype = VM_PROT_READ; if (map != &kernel_map) { /* * Keep swapout from messing with us during this * critical time. */ PHOLD(lp->lwp_proc); /* * Issue fault */ fault_flags = 0; if (usermode) fault_flags |= VM_FAULT_BURST | VM_FAULT_USERMODE; if (ftype & VM_PROT_WRITE) fault_flags |= VM_FAULT_DIRTY; else fault_flags |= VM_FAULT_NORMAL; rv = vm_fault(map, va, ftype, fault_flags); PRELE(lp->lwp_proc); } else { /* * Don't have to worry about process locking or stacks in the * kernel. */ fault_flags = VM_FAULT_NORMAL; rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); } if (rv == KERN_SUCCESS) return (0);nogo: if (!usermode) { /* * NOTE: in 64-bit mode traps push rsp/ss * even if no ring change occurs. */ if (td->td_pcb->pcb_onfault && td->td_pcb->pcb_onfault_sp == frame->tf_rsp && td->td_gd->gd_intr_nesting_level == 0) { frame->tf_rip = (register_t)td->td_pcb->pcb_onfault; return (0); } trap_fatal(frame, frame->tf_addr); return (-1); } /* * NOTE: on x86_64 we have a tf_addr field in the trapframe, no * kludge is needed to pass the fault address to signal handlers. */ p = td->td_proc;#ifdef DDB if (td->td_lwp->lwp_vkernel == NULL) { while (freeze_on_seg_fault) { tsleep(p, 0, "freeze", hz * 20); } if (ddb_on_seg_fault) Debugger("ddb_on_seg_fault"); }#endif return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:101,
示例13: trap_pfault//.........这里部分代码省略......... if (!usermode) { if (td->td_gd->gd_intr_nesting_level == 0 && td->td_pcb->pcb_onfault) { frame->tf_rip = (register_t)td->td_pcb->pcb_onfault; return (0); } trap_fatal(frame, frame->tf_addr); return (-1); } /* * NOTE: on x86_64 we have a tf_addr field in the trapframe, no * kludge is needed to pass the fault address to signal handlers. */ p = td->td_proc; if (td->td_lwp->lwp_vkernel == NULL) {#ifdef DDB if (bootverbose || freeze_on_seg_fault || ddb_on_seg_fault) {#else if (bootverbose) {#endif kprintf("seg-fault ft=%04x ff=%04x addr=%p rip=%p " "pid=%d cpu=%d p_comm=%s/n", ftype, fault_flags, (void *)frame->tf_addr, (void *)frame->tf_rip, p->p_pid, mycpu->gd_cpuid, p->p_comm); }#ifdef DDB while (freeze_on_seg_fault) { tsleep(p, 0, "freeze", hz * 20); } if (ddb_on_seg_fault) Debugger("ddb_on_seg_fault");#endif } return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);}static voidtrap_fatal(struct trapframe *frame, vm_offset_t eva){ int code, ss; u_int type; long rsp; struct soft_segment_descriptor softseg; char *msg; code = frame->tf_err; type = frame->tf_trapno; sdtossd(&gdt[IDXSEL(frame->tf_cs & 0xffff)], &softseg); if (type <= MAX_TRAP_MSG) msg = trap_msg[type]; else msg = "UNKNOWN"; kprintf("/n/nFatal trap %d: %s while in %s mode/n", type, msg, ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel");#ifdef SMP /* three separate prints in case of a trap on an unmapped page */ kprintf("cpuid = %d; ", mycpu->gd_cpuid); kprintf("lapic->id = %08x/n", lapic->id);#endif if (type == T_PAGEFLT) { kprintf("fault virtual address = 0x%lx/n", eva);
开发者ID:varialus,项目名称:DragonFlyX,代码行数:67,
示例14: vinumioctl/* ioctl routine */intvinumioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td){ unsigned int objno; int error = 0; struct sd *sd; struct plex *plex; struct volume *vol; unsigned int index; /* for transferring config info */ unsigned int sdno; /* for transferring config info */ int fe; /* free list element number */ struct _ioctl_reply *ioctl_reply = (struct _ioctl_reply *) data; /* struct to return */ /* First, decide what we're looking at */ switch (DEVTYPE(dev)) { case VINUM_SUPERDEV_TYPE: /* ordinary super device */ ioctl_reply = (struct _ioctl_reply *) data; /* save the address to reply to */ switch (cmd) {#ifdef VINUMDEBUG case VINUM_DEBUG: if (((struct debuginfo *) data)->changeit) /* change debug settings */ debug = (((struct debuginfo *) data)->param); else { if (debug & DEBUG_REMOTEGDB) boothowto |= RB_GDB; /* serial debug line */ else boothowto &= ~RB_GDB; /* local ddb */ Debugger("vinum debug"); } ioctl_reply = (struct _ioctl_reply *) data; /* reinstate the address to reply to */ ioctl_reply->error = 0; return 0;#endif case VINUM_CREATE: /* create a vinum object */ error = lock_config(); /* get the config for us alone */ if (error) /* can't do it, */ return error; /* give up */ error = setjmp(command_fail); /* come back here on error */ if (error == 0) /* first time, */ ioctl_reply->error = parse_user_config((char *) data, /* update the config */ &keyword_set); else if (ioctl_reply->error == 0) { /* longjmp, but no error status */ ioctl_reply->error = EINVAL; /* note that something's up */ ioctl_reply->msg[0] = '/0'; /* no message? */ } unlock_config(); return 0; /* must be 0 to return the real error info */ case VINUM_GETCONFIG: /* get the configuration information */ bcopy(&vinum_conf, data, sizeof(vinum_conf)); return 0; /* start configuring the subsystem */ case VINUM_STARTCONFIG: return start_config(*(int *) data); /* just lock it. Parameter is 'force' */ /* * Move the individual parts of the config to user space. * * Specify the index of the object in the first word of data, * and return the object there */ case VINUM_DRIVECONFIG: index = *(int *) data; /* get the index */ if (index >= (unsigned) vinum_conf.drives_allocated) /* can't do it */ return ENXIO; /* bang */ bcopy(&DRIVE[index], data, sizeof(struct _drive)); /* copy the config item out */ return 0; case VINUM_SDCONFIG: index = *(int *) data; /* get the index */ if (index >= (unsigned) vinum_conf.subdisks_allocated) /* can't do it */ return ENXIO; /* bang */ bcopy(&SD[index], data, sizeof(struct _sd)); /* copy the config item out */ return 0; case VINUM_PLEXCONFIG: index = *(int *) data; /* get the index */ if (index >= (unsigned) vinum_conf.plexes_allocated) /* can't do it */ return ENXIO; /* bang */ bcopy(&PLEX[index], data, sizeof(struct _plex)); /* copy the config item out */ return 0; case VINUM_VOLCONFIG: index = *(int *) data; /* get the index */ if (index >= (unsigned) vinum_conf.volumes_allocated) /* can't do it */ return ENXIO; /* bang */ bcopy(&VOL[index], data, sizeof(struct _volume)); /* copy the config item out */ return 0; case VINUM_PLEXSDCONFIG: index = *(int *) data; /* get the plex index */ sdno = ((int *) data)[1]; /* and the sd index */ if ((index >= (unsigned) vinum_conf.plexes_allocated) /* plex doesn't exist *///.........这里部分代码省略.........
开发者ID:MarginC,项目名称:kame,代码行数:101,
示例15: initarm//.........这里部分代码省略......... * and second level page tables. Pages of memory will be allocated * and mapped for other structures that are required for system * operation. When it returns, physical_freestart and free_pages will * have been updated to reflect the allocations that were made. In * addition, kernel_l1pt, kernel_pt_table[], systempage, irqstack, * abtstack, undstack, kernelstack, msgbufphys will be set to point to * the memory that was allocated for them. */ setup_real_page_tables(); /* * Moved from cpu_startup() as data_abort_handler() references * this during uvm init. */ proc0paddr = (struct user *)kernelstack.pv_va; lwp0.l_addr = proc0paddr;#ifdef VERBOSE_INIT_ARM printf("bootstrap done./n");#endif arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL); /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. * We must now set the r13 registers in the different CPU modes to * point to these stacks. * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */#ifdef VERBOSE_INIT_ARM printf("init subsystems: stacks ");#endif set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); /* * Well we should set a data abort handler. * Once things get going this will change as we will need a proper * handler. * Until then we will use a handler that just panics but tells us * why. * Initialisation of the vectors will just panic on a data abort. * This just fills in a slightly better one. */#ifdef VERBOSE_INIT_ARM printf("vectors ");#endif data_abort_handler_address = (u_int)data_abort_handler; prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; /* Initialise the undefined instruction handlers */#ifdef VERBOSE_INIT_ARM printf("undefined ");#endif undefined_init(); /* Load memory into UVM. */#ifdef VERBOSE_INIT_ARM printf("page ");#endif uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */ uvm_page_physload(atop(physical_freestart), atop(physical_freeend), atop(physical_freestart), atop(physical_freeend), VM_FREELIST_DEFAULT); /* Boot strap pmap telling it where the kernel page table is */#ifdef VERBOSE_INIT_ARM printf("pmap ");#endif pmap_bootstrap(KERNEL_VM_BASE, KERNEL_VM_BASE + KERNEL_VM_SIZE);#ifdef VERBOSE_INIT_ARM printf("done./n");#endif#ifdef KGDB if (boothowto & RB_KDB) { kgdb_debug_init = 1; kgdb_connect(1); }#endif#ifdef DDB db_machine_init(); /* Firmware doesn't load symbols. */ ddb_init(0, NULL, NULL); if (boothowto & RB_KDB) Debugger();#endif /* We return the new stack pointer address */ return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:101,
示例16: x86_ipi_dbvoidx86_ipi_db(struct cpu_info *ci){ Debugger();}
开发者ID:darksoul42,项目名称:bitrig,代码行数:5,
示例17: netbsd32_sendsig_sigcontextstatic voidnetbsd32_sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask){ int sig = ksi->ksi_signo; struct lwp *l = curlwp; struct proc *p = l->l_proc; struct sparc32_sigframe *fp; struct trapframe64 *tf; int addr, onstack, error; struct rwindow32 *oldsp, *newsp; register32_t sp; sig_t catcher = SIGACTION(p, sig).sa_handler; struct sparc32_sigframe sf; extern char netbsd32_sigcode[], netbsd32_esigcode[];#define szsigcode (netbsd32_esigcode - netbsd32_sigcode) tf = l->l_md.md_tf; /* Need to attempt to zero extend this 32-bit pointer */ oldsp = (struct rwindow32 *)(u_long)(u_int)tf->tf_out[6]; /* Do we need to jump onto the signal stack? */ onstack = (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; if (onstack) { fp = (struct sparc32_sigframe *)((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size); l->l_sigstk.ss_flags |= SS_ONSTACK; } else fp = (struct sparc32_sigframe *)oldsp; fp = (struct sparc32_sigframe *)((u_long)(fp - 1) & ~7);#ifdef DEBUG sigpid = p->p_pid; if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) { printf("sendsig: %s[%d] sig %d newusp %p scp %p oldsp %p/n", p->p_comm, p->p_pid, sig, fp, &fp->sf_sc, oldsp); if (sigdebug & SDB_DDB) Debugger(); }#endif /* * Now set up the signal frame. We build it in kernel space * and then copy it out. We probably ought to just build it * directly in user space.... */ sf.sf_signo = sig; sf.sf_code = (u_int)ksi->ksi_trap;#if defined(COMPAT_SUNOS) || defined(MODULAR) sf.sf_scp = (u_long)&fp->sf_sc;#endif sf.sf_addr = 0; /* XXX */ /* * Build the signal context to be used by sigreturn. */ sf.sf_sc.sc_onstack = onstack; sf.sf_sc.sc_mask = *mask; sf.sf_sc.sc_sp = (u_long)oldsp; sf.sf_sc.sc_pc = tf->tf_pc; sf.sf_sc.sc_npc = tf->tf_npc; sf.sf_sc.sc_psr = TSTATECCR_TO_PSR(tf->tf_tstate); /* XXX */ sf.sf_sc.sc_g1 = tf->tf_global[1]; sf.sf_sc.sc_o0 = tf->tf_out[0]; /* * Put the stack in a consistent state before we whack away * at it. Note that write_user_windows may just dump the * registers into the pcb; we need them in the process's memory. * We also need to make sure that when we start the signal handler, * its %i6 (%fp), which is loaded from the newly allocated stack area, * joins seamlessly with the frame it was in when the signal occurred, * so that the debugger and _longjmp code can back up through it. */ sendsig_reset(l, sig); mutex_exit(p->p_lock); newsp = (struct rwindow32 *)((long)fp - sizeof(struct rwindow32)); write_user_windows();#ifdef DEBUG if ((sigdebug & SDB_KSTACK)) printf("sendsig: saving sf to %p, setting stack pointer %p to %p/n", fp, &(((struct rwindow32 *)newsp)->rw_in[6]), oldsp);#endif sp = NETBSD32PTR32I(oldsp); error = (rwindow_save(l) || copyout(&sf, fp, sizeof sf) || copyout(&sp, &(((struct rwindow32 *)newsp)->rw_in[6]), sizeof(sp))); mutex_enter(p->p_lock); if (error) { /* * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */#ifdef DEBUG mutex_exit(p->p_lock); if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig: window save or copyout error/n"); printf("sendsig: stack was trashed trying to send sig %d, sending SIGILL/n", sig); if (sigdebug & SDB_DDB) Debugger(); mutex_enter(p->p_lock);#endif//.........这里部分代码省略.........
开发者ID:ycui1984,项目名称:netbsd-src,代码行数:101,
示例18: ddb_sysctlintddb_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen, struct proc *p){ int error, ctlval; /* All sysctl names at this level are terminal. */ if (namelen != 1) return (ENOTDIR); switch (name[0]) { case DBCTL_RADIX: return sysctl_int(oldp, oldlenp, newp, newlen, &db_radix); case DBCTL_MAXWIDTH: return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_width); case DBCTL_TABSTOP: return sysctl_int(oldp, oldlenp, newp, newlen, &db_tab_stop_width); case DBCTL_MAXLINE: return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_line); case DBCTL_PANIC: if (securelevel > 0) return (sysctl_int_lower(oldp, oldlenp, newp, newlen, &db_panic)); else { ctlval = db_panic; if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &ctlval)) || newp == NULL) return (error); if (ctlval != 1 && ctlval != 0) return (EINVAL); db_panic = ctlval; return (0); } break; case DBCTL_CONSOLE: if (securelevel > 0) return (sysctl_int_lower(oldp, oldlenp, newp, newlen, &db_console)); else { ctlval = db_console; if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &ctlval)) || newp == NULL) return (error); if (ctlval != 1 && ctlval != 0) return (EINVAL); db_console = ctlval; return (0); } break; case DBCTL_LOG: return (sysctl_int(oldp, oldlenp, newp, newlen, &db_log)); case DBCTL_TRIGGER: if (newp && db_console) { struct process *pr = curproc->p_p; if (securelevel < 1 || (pr->ps_flags & PS_CONTROLT && cn_tab && cn_tab->cn_dev == pr->ps_session->s_ttyp->t_dev)) { Debugger(); newp = NULL; } else return (ENODEV); } return (sysctl_rdint(oldp, oldlenp, newp, 0)); default: return (EOPNOTSUPP); } /* NOTREACHED */}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:70,
示例19: initarm//.........这里部分代码省略......... * Moved from cpu_startup() as data_abort_handler() references * this during uvm init */ proc0paddr = (struct user *)kernelstack.pv_va; lwp0.l_addr = proc0paddr;#ifdef VERBOSE_INIT_ARM printf("done!/n");#endif#ifdef VERBOSE_INIT_ARM printf("bootstrap done./n");#endif arm32_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. * We must now set the r13 registers in the different CPU modes to * point to these stacks. * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */#ifdef VERBOSE_INIT_ARM printf("init subsystems: stacks ");#endif set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); /* * Well we should set a data abort handler. * Once things get going this will change as we will need a proper * handler. * Until then we will use a handler that just panics but tells us * why. * Initialisation of the vectors will just panic on a data abort. * This just fills in a slightly better one. */#ifdef VERBOSE_INIT_ARM printf("vectors ");#endif data_abort_handler_address = (u_int)data_abort_handler; prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; /* Initialise the undefined instruction handlers */#ifdef VERBOSE_INIT_ARM printf("undefined ");#endif undefined_init(); /* Load memory into UVM. */#ifdef VERBOSE_INIT_ARM printf("page ");#endif uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */ uvm_page_physload(atop(physical_freestart), atop(physical_freeend), atop(physical_freestart), atop(physical_freeend), VM_FREELIST_DEFAULT); /* Boot strap pmap telling it where the kernel page table is */#ifdef VERBOSE_INIT_ARM printf("pmap ");#endif pmap_bootstrap(KERNEL_VM_BASE, KERNEL_VM_BASE + KERNEL_VM_SIZE); /* Setup the IRQ system */#ifdef VERBOSE_INIT_ARM printf("irq ");#endif i80321_intr_init();#ifdef VERBOSE_INIT_ARM printf("done./n");#endif#ifdef BOOTHOWTO boothowto = BOOTHOWTO;#endif#if NKSYMS || defined(DDB) || defined(LKM) /* Firmware doesn't load symbols. */ ksyms_init(0, NULL, NULL);#endif#ifdef DDB db_machine_init(); if (boothowto & RB_KDB) Debugger();#endif /* We return the new stack pointer address */ return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:101,
示例20: kdp_callvoidkdp_call(void){ Debugger("inline call to debugger(machine_startup)");}
开发者ID:SbIm,项目名称:xnu-env,代码行数:5,
示例21: boot//.........这里部分代码省略......... */ if (panicstr == NULL) { shutdown_cleanup_proc(curproc); shutdown_cleanup_proc(&proc0); if (initproc) { if (initproc != curproc) { ksignal(initproc, SIGSTOP); tsleep(boot, 0, "shutdn", hz / 20); } shutdown_cleanup_proc(initproc); } vfs_cache_setroot(NULL, NULL); } /* * Now sync filesystems */ if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { int iter, nbusy, pbusy; waittime = 0; kprintf("/nsyncing disks... "); sys_sync(NULL); /* YYY was sync(&proc0, NULL). why proc0 ? */ /* * With soft updates, some buffers that are * written will be remarked as dirty until other * buffers are written. */ for (iter = pbusy = 0; iter < 20; iter++) { nbusy = scan_all_buffers(shutdown_busycount1, NULL); if (nbusy == 0) break; kprintf("%d ", nbusy); if (nbusy < pbusy) iter = 0; pbusy = nbusy; /* * XXX: * Process soft update work queue if buffers don't sync * after 6 iterations by permitting the syncer to run. */ if (iter > 5) bio_ops_sync(NULL); sys_sync(NULL); /* YYY was sync(&proc0, NULL). why proc0 ? */ tsleep(boot, 0, "shutdn", hz * iter / 20 + 1); } kprintf("/n"); /* * Count only busy local buffers to prevent forcing * a fsck if we're just a client of a wedged NFS server */ nbusy = scan_all_buffers(shutdown_busycount2, NULL); if (nbusy) { /* * Failed to sync all blocks. Indicate this and don't * unmount filesystems (thus forcing an fsck on reboot). */ kprintf("giving up on %d buffers/n", nbusy);#ifdef DDB if (debugger_on_panic) Debugger("busy buffer problem");#endif /* DDB */ tsleep(boot, 0, "shutdn", hz * 5 + 1); } else { kprintf("done/n"); /* * Unmount filesystems */ if (panicstr == NULL) vfs_unmountall(); } tsleep(boot, 0, "shutdn", hz / 10 + 1); } print_uptime(); /* * Dump before doing post_sync shutdown ops */ crit_enter(); if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold) { dumpsys(); } /* * Ok, now do things that assume all filesystem activity has * been completed. This will also call the device shutdown * methods. */ EVENTHANDLER_INVOKE(shutdown_post_sync, howto); /* Now that we're going to really halt the system... */ EVENTHANDLER_INVOKE(shutdown_final, howto); for(;;) ; /* safety against shutdown_reset not working */ /* NOTREACHED */}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:101,
示例22: initarm//.........这里部分代码省略......... /* * Moved from cpu_startup() as data_abort_handler() references * this during uvm init */ proc0paddr = (struct user *)kernelstack.pv_va; proc0.p_addr = proc0paddr;#ifdef VERBOSE_INIT_ARM printf("bootstrap done./n");#endif#ifdef HIGH_VECT arm32_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);#else arm32_vector_init(ARM_VECTORS_LOW, ARM_VEC_ALL);#endif /* * Pages were allocated during the secondary bootstrap for the * stacks for different CPU modes. * We must now set the r13 registers in the different CPU modes to * point to these stacks. * Since the ARM stacks use STMFD etc. we must set r13 to the top end * of the stack memory. */#ifdef VERBOSE_INIT_ARM printf("init subsystems: stacks ");#endif set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_ABT32_MODE, abtstack.pv_va + ABT_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); /* * Well we should set a data abort handler. * Once things get going this will change as we will need a proper * handler. * Until then we will use a handler that just panics but tells us * why. * Initialisation of the vectors will just panic on a data abort. * This just fills in a slightly better one. */#ifdef VERBOSE_INIT_ARM printf("vectors ");#endif data_abort_handler_address = (u_int)data_abort_handler; prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; /* Initialise the undefined instruction handlers */#ifdef VERBOSE_INIT_ARM printf("undefined ");#endif undefined_init(); /* Load memory into UVM. */#ifdef VERBOSE_INIT_ARM printf("page ");#endif uvm_setpagesize(); /* initialize PAGE_SIZE-dependent variables */ uvm_page_physload(atop(physical_freestart), atop(physical_freeend), atop(physical_freestart), atop(physical_freeend), 0); /* Boot strap pmap telling it where the kernel page table is */#ifdef VERBOSE_INIT_ARM printf("pmap ");#endif pmap_bootstrap((pd_entry_t *)kernel_l1pt.pv_va, KERNEL_VM_BASE, KERNEL_VM_BASE + KERNEL_VM_SIZE); /* Update dump information */ cpu_kcore_hdr.pmap_kernel_l1 = (u_int32_t)pmap_kernel()->pm_l1; cpu_kcore_hdr.pmap_kernel_l2 = (u_int32_t)&(pmap_kernel()->pm_l2); /* Setup the IRQ system */#ifdef VERBOSE_INIT_ARM printf("irq ");#endif i80321intc_intr_init();#ifdef VERBOSE_INIT_ARM printf("done./n");#endif#ifdef DDB db_machine_init(); /* Firmware doesn't load symbols. */ ddb_init(); if (boothowto & RB_KDB) Debugger();#endif /* We return the new stack pointer address */ return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:101,
示例23: cpu_reboot/* * Halt or reboot the machine after syncing/dumping according to howto. */voidcpu_reboot(int howto, char *what){ static int syncing; static char str[256]; char *ap = str, *ap1 = ap; boothowto = howto; if (!cold && !(howto & RB_NOSYNC) && !syncing) { syncing = 1; vfs_shutdown(); /* sync */ resettodr(); /* set wall clock */ } splhigh(); if (!cold && (howto & RB_DUMP)) ibm4xx_dumpsys(); doshutdownhooks(); pmf_system_shutdown(boothowto); if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { /* Power off here if we know how...*/ } if (howto & RB_HALT) { printf("halted/n/n");#if 0 goto reboot; /* XXX for now... */#endif#ifdef DDB printf("dropping to debugger/n"); while(1) Debugger();#endif } printf("rebooting/n/n"); if (what && *what) { if (strlen(what) > sizeof str - 5) printf("boot string too large, ignored/n"); else { strcpy(str, what); ap1 = ap = str + strlen(str); *ap++ = ' '; } } *ap++ = '-'; if (howto & RB_SINGLE) *ap++ = 's'; if (howto & RB_KDB) *ap++ = 'd'; *ap++ = 0; if (ap[-2] == '-') *ap1 = 0; /* flush cache for msgbuf */ __syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE));#if 0 reboot:#endif ppc4xx_reset(); printf("ppc4xx_reset() failed!/n");#ifdef DDB while(1) Debugger();#else while (1) /* nothing */;#endif}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:80,
示例24: mach_init//.........这里部分代码省略......... /* Load symbol table if present */ if (bi_syms != NULL) { ssym = (void *)(intptr_t)bi_syms->ssym; esym = (void *)(intptr_t)bi_syms->esym; kernend = (void *)mips_round_page(esym); }#endif bi_howto = lookup_bootinfo(BTINFO_HOWTO); if (bi_howto != NULL) boothowto = bi_howto->bi_howto; cobalt_id = read_board_id(); if (cobalt_id >= COBALT_MODELS || cobalt_model[cobalt_id] == NULL) cpu_setmodel("Cobalt unknown model (board ID %u)", cobalt_id); else cpu_setmodel("%s", cobalt_model[cobalt_id]); switch (cobalt_id) { case COBALT_ID_QUBE2700: case COBALT_ID_RAQ: cpuspeed = 150; /* MHz */ break; case COBALT_ID_QUBE2: case COBALT_ID_RAQ2: cpuspeed = 250; /* MHz */ break; default: /* assume the fastest, so that delay(9) works */ cpuspeed = 250; break; } curcpu()->ci_cpu_freq = cpuspeed * 1000 * 1000; curcpu()->ci_cycles_per_hz = (curcpu()->ci_cpu_freq + hz / 2) / hz; curcpu()->ci_divisor_delay = ((curcpu()->ci_cpu_freq + (1000000 / 2)) / 1000000); /* all models have Rm5200, which is CPU_MIPS_DOUBLE_COUNT */ curcpu()->ci_cycles_per_hz /= 2; curcpu()->ci_divisor_delay /= 2; physmem = btoc(memsize - MIPS_KSEG0_START); consinit(); KASSERT(&lwp0 == curlwp); if (bi_msg != NULL) printf("%s: magic=%#x bip=%p/n", bi_msg, bim, bip); uvm_setpagesize(); /* * The boot command is passed in the top 512 bytes, * so don't clobber that. */ mem_clusters[0].start = 0; mem_clusters[0].size = ctob(physmem) - 512; mem_cluster_cnt = 1; memcpy(bootstring, (char *)(memsize - 512), 512); memset((char *)(memsize - 512), 0, 512); bootstring[511] = '/0'; decode_bootstring();#if NKSYMS || defined(DDB) || defined(MODULAR) /* init symbols if present */ if ((bi_syms != NULL) && (esym != NULL)) ksyms_addsyms_elf(esym - ssym, ssym, esym);#endif KASSERT(&lwp0 == curlwp);#ifdef DDB if (boothowto & RB_KDB) Debugger();#endif#ifdef KGDB if (boothowto & RB_KDB) kgdb_connect(0);#endif /* * Load the rest of the available pages into the VM system. */ first = round_page(MIPS_KSEG0_TO_PHYS(kernend)); last = mem_clusters[0].start + mem_clusters[0].size; uvm_page_physload(atop(first), atop(last), atop(first), atop(last), VM_FREELIST_DEFAULT); /* * Initialize error message buffer (at end of core). */ mips_init_msgbuf(); pmap_bootstrap(); /* * Allocate space for proc0's USPACE. */ mips_init_lwp0_uarea();}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,
示例25: lck_rw_lock_shared_gen/* * Routine: lck_rw_lock_shared_gen */voidlck_rw_lock_shared_gen( lck_rw_t *lck){ int i; wait_result_t res;#if MACH_LDEBUG int decrementer;#endif /* MACH_LDEBUG */ boolean_t istate;#if CONFIG_DTRACE uint64_t wait_interval = 0; int slept = 0; int readers_at_sleep;#endif istate = lck_interlock_lock(lck);#if CONFIG_DTRACE readers_at_sleep = lck->lck_rw_shared_count;#endif#if MACH_LDEBUG decrementer = DECREMENTER_TIMEOUT;#endif /* MACH_LDEBUG */ while ((lck->lck_rw_want_write || lck->lck_rw_want_upgrade) && ((lck->lck_rw_shared_count == 0) || lck->lck_rw_priv_excl)) { i = lock_wait_time[lck->lck_rw_can_sleep ? 1 : 0]; KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_SHARED_CODE) | DBG_FUNC_START, (int)lck, lck->lck_rw_want_write, lck->lck_rw_want_upgrade, i, 0);#if CONFIG_DTRACE if ((lockstat_probemap[LS_LCK_RW_LOCK_SHARED_SPIN] || lockstat_probemap[LS_LCK_RW_LOCK_SHARED_BLOCK]) && wait_interval == 0) { wait_interval = mach_absolute_time(); } else { wait_interval = -1; }#endif if (i != 0) { lck_interlock_unlock(lck, istate);#if MACH_LDEBUG if (!--decrementer) Debugger("timeout - wait no writers");#endif /* MACH_LDEBUG */ while (--i != 0 && (lck->lck_rw_want_write || lck->lck_rw_want_upgrade) && ((lck->lck_rw_shared_count == 0) || lck->lck_rw_priv_excl)) lck_rw_lock_pause(istate); istate = lck_interlock_lock(lck); } if (lck->lck_rw_can_sleep && (lck->lck_rw_want_write || lck->lck_rw_want_upgrade) && ((lck->lck_rw_shared_count == 0) || lck->lck_rw_priv_excl)) { lck->lck_r_waiting = TRUE; res = assert_wait(RW_LOCK_READER_EVENT(lck), THREAD_UNINT); if (res == THREAD_WAITING) { lck_interlock_unlock(lck, istate); res = thread_block(THREAD_CONTINUE_NULL);#if CONFIG_DTRACE slept = 1;#endif istate = lck_interlock_lock(lck); } } KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_SHARED_CODE) | DBG_FUNC_END, (int)lck, lck->lck_rw_want_write, lck->lck_rw_want_upgrade, res, 0); } lck->lck_rw_shared_count++; lck_interlock_unlock(lck, istate);#if CONFIG_DTRACE if (wait_interval != 0 && wait_interval != (unsigned) -1) { if (slept == 0) { LOCKSTAT_RECORD2(LS_LCK_RW_LOCK_SHARED_SPIN, lck, mach_absolute_time() - wait_interval, 0); } else { LOCKSTAT_RECORD4(LS_LCK_RW_LOCK_SHARED_BLOCK, lck, mach_absolute_time() - wait_interval, 0, (readers_at_sleep == 0 ? 1 : 0), readers_at_sleep); } } LOCKSTAT_RECORD(LS_LCK_RW_LOCK_SHARED_ACQUIRE, lck, 0);#endif}
开发者ID:MACasuba,项目名称:MACasuba-Utils-git,代码行数:89,
示例26: initarm//.........这里部分代码省略.........#if NISADMA > 0 paddr_t istart, isize; extern struct arm32_dma_range *footbridge_isa_dma_ranges; extern int footbridge_isa_dma_nranges;#endif if (start < physical_freestart) start = physical_freestart; if (end > physical_freeend) end = physical_freeend;#if 0 printf("%d: %lx -> %lx/n", loop, start, end - 1);#endif#if NISADMA > 0 if (arm32_dma_range_intersect(footbridge_isa_dma_ranges, footbridge_isa_dma_nranges, start, end - start, &istart, &isize)) { /* * Place the pages that intersect with the * ISA DMA range onto the ISA DMA free list. */#if 0 printf(" ISADMA 0x%lx -> 0x%lx/n", istart, istart + isize - 1);#endif uvm_page_physload(atop(istart), atop(istart + isize), atop(istart), atop(istart + isize), VM_FREELIST_ISADMA); /* * Load the pieces that come before the * intersection onto the default free list. */ if (start < istart) {#if 0 printf(" BEFORE 0x%lx -> 0x%lx/n", start, istart - 1);#endif uvm_page_physload(atop(start), atop(istart), atop(start), atop(istart), VM_FREELIST_DEFAULT); } /* * Load the pieces that come after the * intersection onto the default free list. */ if ((istart + isize) < end) {#if 0 printf(" AFTER 0x%lx -> 0x%lx/n", (istart + isize), end - 1);#endif uvm_page_physload(atop(istart + isize), atop(end), atop(istart + isize), atop(end), VM_FREELIST_DEFAULT); } } else { uvm_page_physload(atop(start), atop(end), atop(start), atop(end), VM_FREELIST_DEFAULT); }#else /* NISADMA > 0 */ uvm_page_physload(atop(start), atop(end), atop(start), atop(end), VM_FREELIST_DEFAULT);#endif /* NISADMA > 0 */ } /* Boot strap pmap telling it where the kernel page table is */ printf("pmap "); pmap_bootstrap(KERNEL_VM_BASE, KERNEL_VM_BASE + KERNEL_VM_SIZE); /* Now that pmap is inited, we can set cpu_reset_address */ cpu_reset_address_paddr = vtophys((vaddr_t)netwinder_reset); /* Setup the IRQ system */ printf("irq "); footbridge_intr_init(); printf("done./n"); /* * Warn the user if the bootinfo was bogus. We already * faked up some safe values. */ if (nwbootinfo.bi_pagesize == 0xdeadbeef) printf("WARNING: NeTTrom boot info corrupt/n");#ifdef DDB db_machine_init(); if (boothowto & RB_KDB) Debugger();#endif /* Turn the led green */ ISA_PUTBYTE(0x338, 0x06); /* We return the new stack pointer address */ return(kernelstack.pv_va + USPACE_SVC_STACK_TOP);}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:101,
示例27: lck_rw_lock_exclusive/* * Routine: lck_rw_lock_exclusive */voidlck_rw_lock_exclusive( lck_rw_t *lck){ int i; wait_result_t res;#if MACH_LDEBUG int decrementer;#endif /* MACH_LDEBUG */ boolean_t istate;#if CONFIG_DTRACE uint64_t wait_interval = 0; int slept = 0; int readers_at_sleep;#endif istate = lck_interlock_lock(lck);#if CONFIG_DTRACE readers_at_sleep = lck->lck_rw_shared_count;#endif#if MACH_LDEBUG decrementer = DECREMENTER_TIMEOUT;#endif /* MACH_LDEBUG */ /* * Try to acquire the lck_rw_want_write bit. */ while (lck->lck_rw_want_write) { KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_EXCLUSIVE_CODE) | DBG_FUNC_START, (int)lck, 0, 0, 0, 0); /* * Either sleeping or spinning is happening, start * a timing of our delay interval now. */#if CONFIG_DTRACE if ((lockstat_probemap[LS_LCK_RW_LOCK_EXCL_SPIN] || lockstat_probemap[LS_LCK_RW_LOCK_EXCL_BLOCK]) && wait_interval == 0) { wait_interval = mach_absolute_time(); } else { wait_interval = -1; }#endif i = lock_wait_time[lck->lck_rw_can_sleep ? 1 : 0]; if (i != 0) { lck_interlock_unlock(lck, istate);#if MACH_LDEBUG if (!--decrementer) Debugger("timeout - lck_rw_want_write");#endif /* MACH_LDEBUG */ while (--i != 0 && lck->lck_rw_want_write) lck_rw_lock_pause(istate); istate = lck_interlock_lock(lck); } if (lck->lck_rw_can_sleep && lck->lck_rw_want_write) { lck->lck_w_waiting = TRUE; res = assert_wait(RW_LOCK_WRITER_EVENT(lck), THREAD_UNINT); if (res == THREAD_WAITING) { lck_interlock_unlock(lck, istate); res = thread_block(THREAD_CONTINUE_NULL);#if CONFIG_DTRACE slept = 1;#endif istate = lck_interlock_lock(lck); } } KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_EXCLUSIVE_CODE) | DBG_FUNC_END, (int)lck, res, 0, 0, 0); } lck->lck_rw_want_write = TRUE; /* Wait for readers (and upgrades) to finish */#if MACH_LDEBUG decrementer = DECREMENTER_TIMEOUT;#endif /* MACH_LDEBUG */ while ((lck->lck_rw_shared_count != 0) || lck->lck_rw_want_upgrade) { i = lock_wait_time[lck->lck_rw_can_sleep ? 1 : 0]; KERNEL_DEBUG(MACHDBG_CODE(DBG_MACH_LOCKS, LCK_RW_LCK_EXCLUSIVE1_CODE) | DBG_FUNC_START, (int)lck, lck->lck_rw_shared_count, lck->lck_rw_want_upgrade, i, 0);#if CONFIG_DTRACE /* * Either sleeping or spinning is happening, start * a timing of our delay interval now. If we set it * to -1 we don't have accurate data so we cannot later * decide to record a dtrace spin or sleep event. */ if ((lockstat_probemap[LS_LCK_RW_LOCK_EXCL_SPIN] || lockstat_probemap[LS_LCK_RW_LOCK_EXCL_BLOCK]) && wait_interval == 0) { wait_interval = mach_absolute_time(); } else { wait_interval = (unsigned) -1; }#endif//.........这里部分代码省略.........
开发者ID:MACasuba,项目名称:MACasuba-Utils-git,代码行数:101,
示例28: get_bootpath_from_promstatic voidget_bootpath_from_prom(void){ struct btinfo_bootdev *bdev = NULL; char sbuf[OFPATHLEN], *cp; int chosen; /* * Grab boot path from PROM */ if ((chosen = OF_finddevice("/chosen")) == -1) return; bdev = lookup_bootinfo(BTINFO_BOOTDEV); if (bdev != NULL) { strcpy(ofbootpath, bdev->name); } else { if (OF_getprop(chosen, "bootpath", sbuf, sizeof(sbuf)) < 0) return; strcpy(ofbootpath, sbuf); } DPRINTF(ACDB_BOOTDEV, ("bootpath: %s/n", ofbootpath)); ofbootpackage = prom_finddevice(ofbootpath); /* * Strip partition or boot protocol */ cp = strrchr(ofbootpath, ':'); if (cp) { *cp = '/0'; ofbootpartition = cp+1; } cp = strrchr(ofbootpath, '@'); if (cp) { for (; cp != ofbootpath; cp--) { if (*cp == '/') { ofboottarget = cp+1; break; } } } DPRINTF(ACDB_BOOTDEV, ("bootpath phandle: 0x%x/n", ofbootpackage)); DPRINTF(ACDB_BOOTDEV, ("boot target: %s/n", ofboottarget ? ofboottarget : "<none>")); DPRINTF(ACDB_BOOTDEV, ("boot partition: %s/n", ofbootpartition ? ofbootpartition : "<none>")); /* Setup pointer to boot flags */ if (OF_getprop(chosen, "bootargs", sbuf, sizeof(sbuf)) == -1) return; strcpy(ofbootargs, sbuf); cp = ofbootargs; /* Find start of boot flags */ while (*cp) { while(*cp == ' ' || *cp == '/t') cp++; if (*cp == '-' || *cp == '/0') break; while(*cp != ' ' && *cp != '/t' && *cp != '/0') cp++; if (*cp != '/0') *cp++ = '/0'; } if (cp != ofbootargs) ofbootfile = ofbootargs; ofbootflags = cp; if (*cp != '-') return; for (;*++cp;) { int fl; fl = 0; BOOT_FLAG(*cp, fl); if (!fl) { printf("unknown option `%c'/n", *cp); continue; } boothowto |= fl; /* specialties */ if (*cp == 'd') {#if defined(KGDB) kgdb_break_at_attach = 1;#elif defined(DDB) Debugger();#else printf("kernel has no debugger/n");#endif } else if (*cp == 't') { /* turn on traptrace w/o breaking into kdb */ extern int trap_trace_dis; trap_trace_dis = 0; } }}
开发者ID:gvsurenderreddy,项目名称:frankenlibc,代码行数:98,
注:本文中的Debugger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DebuggerAppendMsg函数代码示例 C++ DebugUnwind函数代码示例 |