• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ die_if_kernel函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中die_if_kernel函数的典型用法代码示例。如果您正苦于以下问题:C++ die_if_kernel函数的具体用法?C++ die_if_kernel怎么用?C++ die_if_kernel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了die_if_kernel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: do_page_fault

/*
 * This routine handles page faults.  It determines the address,
 * and the problem, and then passes it off to handle_mm_fault().
 *
 * mmcsr:
 *	0 = translation not valid
 *	1 = access violation
 *	2 = fault-on-read
 *	3 = fault-on-execute
 *	4 = fault-on-write
 *
 * cause:
 *	-1 = instruction fetch
 *	0 = load
 *	1 = store
 */
asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr, long cause,
	unsigned long a3, unsigned long a4, unsigned long a5,
	struct pt_regs regs)
{
	struct vm_area_struct * vma;

	vma = find_vma(current, address);
	if (!vma)
		goto bad_area;
	if (vma->vm_start <= address)
		goto good_area;
	if (!(vma->vm_flags & VM_GROWSDOWN))
		goto bad_area;
	if (expand_stack(vma, address))
		goto bad_area;
/*
 * Ok, we have a good vm_area for this memory access, so
 * we can handle it..
 */
good_area:
	if (cause < 0) {
		if (!(vma->vm_flags & VM_EXEC))
			goto bad_area;
	} else if (!cause) {
		/* Allow reads even for write-only mappings */
		if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
			goto bad_area;
	} else {
		if (!(vma->vm_flags & VM_WRITE))
			goto bad_area;
	}
	tbis(address);
	handle_mm_fault(vma, address, cause > 0);
	return;

/*
 * Something tried to access memory that isn't in our memory map..
 * Fix it, but check if it's kernel or user first..
 */
bad_area:
	if (user_mode(&regs)) {
		printk("%s: memory violation at pc=%08lx rp=%08lx (bad address = %08lx)\n",
			current->comm, regs.pc, regs.r26, address);
		die_if_kernel("oops", &regs, cause);
		force_sig(SIGSEGV, current);
		return;
	}
/*
 * Oops. The kernel tried to access some bad page. We'll have to
 * terminate things with extreme prejudice.
 */
	printk(KERN_ALERT 
	       "Unable to handle kernel paging request at virtual address %016lx\n", address);
	die_if_kernel("Oops", &regs, cause);
	do_exit(SIGKILL);
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:72,代码来源:fault.c


示例2: do_entArith

asmlinkage void
do_entArith(unsigned long summary, unsigned long write_mask,
	    struct pt_regs *regs)
{
	long si_code = FPE_FLTINV;
	siginfo_t info;

	if (summary & 1) {
		/*                                                  
                                                        
                                                   */
		if (!amask(AMASK_PRECISE_TRAP))
			si_code = alpha_fp_emul(regs->pc - 4);
		else
			si_code = alpha_fp_emul_imprecise(regs, write_mask);
		if (si_code == 0)
			return;
	}
	die_if_kernel("Arithmetic fault", regs, 0, NULL);

	info.si_signo = SIGFPE;
	info.si_errno = 0;
	info.si_code = si_code;
	info.si_addr = (void __user *) regs->pc;
	send_sig_info(SIGFPE, &info, current);
}
开发者ID:curbthepain,项目名称:android_kernel_us990_rev,代码行数:26,代码来源:traps.c


示例3: send_fault_sig

int send_fault_sig(struct pt_regs *regs)
{
	int signo, si_code;
	void __user *addr;

	signo = current->thread.signo;
	si_code = current->thread.code;
	addr = (void __user *)current->thread.faddr;
	pr_debug("send_fault_sig: %p,%d,%d\n", addr, signo, si_code);

	if (user_mode(regs)) {
		force_sig_fault(signo, si_code, addr, current);
	} else {
		if (fixup_exception(regs))
			return -1;

		//if (signo == SIGBUS)
		//	force_sig_fault(si_signo, si_code, addr, current);

		/*
		 * Oops. The kernel tried to access some bad page. We'll have to
		 * terminate things with extreme prejudice.
		 */
		if ((unsigned long)addr < PAGE_SIZE)
			pr_alert("Unable to handle kernel NULL pointer dereference");
		else
			pr_alert("Unable to handle kernel access");
		pr_cont(" at virtual address %p\n", addr);
		die_if_kernel("Oops", regs, 0 /*error_code*/);
		do_exit(SIGKILL);
	}

	return 1;
}
开发者ID:CCNITSilchar,项目名称:linux,代码行数:34,代码来源:fault.c


示例4: do_entArith

asmlinkage void
do_entArith(unsigned long summary, unsigned long write_mask,
	    struct pt_regs *regs)
{
	long si_code = FPE_FLTINV;
	siginfo_t info;

	if (summary & 1) {
		/* Software-completion summary bit is set, so try to
		   emulate the instruction.  If the processor supports
		   precise exceptions, we don't have to search.  */
		if (!amask(AMASK_PRECISE_TRAP))
			si_code = alpha_fp_emul(regs->pc - 4);
		else
			si_code = alpha_fp_emul_imprecise(regs, write_mask);
		if (si_code == 0)
			return;
	}
	die_if_kernel("Arithmetic fault", regs, 0, NULL);

	info.si_signo = SIGFPE;
	info.si_errno = 0;
	info.si_code = si_code;
	info.si_addr = (void __user *) regs->pc;
	send_sig_info(SIGFPE, &info, current);
}
开发者ID:Lord-Devices,项目名称:cm_kernel_samsung_hlte,代码行数:26,代码来源:traps.c


示例5: do_adelinsn

asmlinkage void do_adelinsn(struct pt_regs *regs)
{
	printk("do_ADE-linsn:ema:0x%08lx:epc:0x%08lx\n",
		 regs->cp0_ema, regs->cp0_epc);
	die_if_kernel("do_ade execution Exception\n", regs);
	force_sig(SIGBUS, current);
}
开发者ID:Gangfeng,项目名称:linux-1,代码行数:7,代码来源:traps.c


示例6: do_entArith

asmlinkage void
do_entArith(unsigned long summary, unsigned long write_mask,
	    unsigned long a2, unsigned long a3, unsigned long a4,
	    unsigned long a5, struct pt_regs regs)
{
	if (summary & 1) {
		/* Software-completion summary bit is set, so try to
		   emulate the instruction.  */
		if (!amask(AMASK_PRECISE_TRAP)) {
			/* 21264 (except pass 1) has precise exceptions.  */
			if (alpha_fp_emul(regs.pc - 4))
				return;
		} else {
			if (alpha_fp_emul_imprecise(&regs, write_mask))
				return;
		}
	}

#if 0
	printk("%s: arithmetic trap at %016lx: %02lx %016lx\n",
		current->comm, regs.pc, summary, write_mask);
#endif
	die_if_kernel("Arithmetic fault", &regs, 0, 0);
	send_sig(SIGFPE, current, 1);
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:25,代码来源:traps.c


示例7: data_store_error

/*
 * data store error - should only happen if accessing inactive or self-refreshing SDRAM
 */
asmlinkage void data_store_error(unsigned long esfr1, unsigned long esr15)
{
	die_if_kernel("-- Data Store Error --\n"
		      "ESR15 : %08lx\n",
		      esr15);
	BUG();
} /* end data_store_error() */
开发者ID:ForayJones,项目名称:iods,代码行数:10,代码来源:traps.c


示例8: do_simd_coprocessor_error

dotraplinkage void
do_simd_coprocessor_error(struct pt_regs *regs, long error_code)
{
	conditional_sti(regs);

#ifdef CONFIG_X86_32
	if (cpu_has_xmm) {
		/* Handle SIMD FPU exceptions on PIII+ processors. */
		ignore_fpu_irq = 1;
		simd_math_error((void __user *)regs->ip);
		return;
	}
	/*
	 * Handle strange cache flush from user space exception
	 * in all other cases.  This is undocumented behaviour.
	 */
	if (regs->flags & X86_VM_MASK) {
		handle_vm86_fault((struct kernel_vm86_regs *)regs, error_code);
		return;
	}
	current->thread.trap_no = 19;
	current->thread.error_code = error_code;
	die_if_kernel("cache flush denied", regs, error_code);
	force_sig(SIGSEGV, current);
#else
	if (!user_mode(regs) &&
			kernel_math_error(regs, "kernel simd math error", 19))
		return;
	simd_math_error((void __user *)regs->ip);
#endif
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:31,代码来源:traps.c


示例9: do_entDbg

asmlinkage void
do_entDbg(struct pt_regs *regs)
{
	die_if_kernel("Instruction fault", regs, 0, NULL);

	force_sig_fault(SIGILL, ILL_ILLOPC, (void __user *)regs->pc, 0, current);
}
开发者ID:0x7f454c46,项目名称:linux,代码行数:7,代码来源:traps.c


示例10: memory_access_exception

/*
 * instruction or data access exception
 */
asmlinkage void memory_access_exception(unsigned long esr0,
					unsigned long ear0,
					unsigned long epcr0)
{
	siginfo_t info;

#ifdef CONFIG_MMU
	unsigned long fixup;

	fixup = search_exception_table(__frame->pc);
	if (fixup) {
		__frame->pc = fixup;
		return;
	}
#endif

	die_if_kernel("-- Memory Access Exception --\n"
		      "ESR0  : %08lx\n"
		      "EAR0  : %08lx\n"
		      "EPCR0 : %08lx\n",
		      esr0, ear0, epcr0);

	info.si_signo	= SIGSEGV;
	info.si_code	= SEGV_ACCERR;
	info.si_errno	= 0;
	info.si_addr	= NULL;

	if ((esr0 & (ESRx_VALID | ESR0_EAV)) == (ESRx_VALID | ESR0_EAV))
		info.si_addr = (void __user *) ear0;

	force_sig_info(info.si_signo, &info, current);

} /* end memory_access_exception() */
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:36,代码来源:traps.c


示例11: be_ip22_interrupt

void be_ip22_interrupt(int irq, struct pt_regs *regs)
{
	save_and_clear_buserr();
	printk(KERN_ALERT "Bus error, epc == %08lx, ra == %08lx\n",
	       regs->cp0_epc, regs->regs[31]);
	die_if_kernel("Oops", regs);
	force_sig(SIGBUS, current);
}
开发者ID:dduval,项目名称:kernel-rhel3,代码行数:8,代码来源:ip22-berr.c


示例12: do_entDbg

asmlinkage void
do_entDbg(unsigned long type, unsigned long a1,
	  unsigned long a2, unsigned long a3, unsigned long a4,
	  unsigned long a5, struct pt_regs regs)
{
	die_if_kernel("Instruction fault", &regs, type, 0);
	force_sig(SIGILL, current);
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:8,代码来源:traps.c


示例13: do_priv_instruction

void do_priv_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
			 unsigned long psr)
{
	if(psr & PSR_PS)
		die_if_kernel("Penguin instruction from Penguin mode??!?!", regs);
	current->tss.sig_address = pc;
	current->tss.sig_desc = SUBSIG_PRIVINST;
	send_sig(SIGILL, current, 1);
}
开发者ID:andreiw,项目名称:mkunity,代码行数:9,代码来源:traps.c


示例14: do_reserved

asmlinkage void do_reserved(struct pt_regs *regs)
{
	/*
	 * Game over - no way to handle this if it ever occurs.  Most probably
	 * caused by a new unknown cpu type or after another deadly
	 * hard/software error.
	 */
	die_if_kernel("do_reserved execution Exception", regs);
	show_regs(regs);
	panic("Caught reserved exception - should not happen.");
}
开发者ID:Gangfeng,项目名称:linux-1,代码行数:11,代码来源:traps.c


示例15: do_hw_interrupt

void do_hw_interrupt(unsigned long type, unsigned long psr, unsigned long pc)
{
	siginfo_t info;

	if(type < 0x80) {
		/* Sun OS's puke from bad traps, Linux survives! */
		printk("Unimplemented Sparc TRAP, type = %02lx\n", type);
		die_if_kernel("Whee... Hello Mr. Penguin", current->thread.kregs);
	}	

	if(psr & PSR_PS)
		die_if_kernel("Kernel bad trap", current->thread.kregs);

	info.si_signo = SIGILL;
	info.si_errno = 0;
	info.si_code = ILL_ILLTRP;
	info.si_addr = (void *)pc;
	info.si_trapno = type - 0x80;
	force_sig_info(SIGILL, &info, current);
}
开发者ID:romanalexander,项目名称:Trickles,代码行数:20,代码来源:traps.c


示例16: do_ov

asmlinkage void do_ov(struct pt_regs *regs)
{
	siginfo_t info;

	die_if_kernel("do_ov execution Exception", regs);

	info.si_code = FPE_INTOVF;
	info.si_signo = SIGFPE;
	info.si_errno = 0;
	info.si_addr = (void *)regs->cp0_epc;
	force_sig_info(SIGFPE, &info, current);
}
开发者ID:Gangfeng,项目名称:linux-1,代码行数:12,代码来源:traps.c


示例17: compound_exception

asmlinkage void compound_exception(unsigned long esfr1,
				   unsigned long esr0, unsigned long esr14, unsigned long esr15,
				   unsigned long msr0, unsigned long msr1)
{
	die_if_kernel("-- Compound Exception --\n"
		      "ESR0  : %08lx\n"
		      "ESR15 : %08lx\n"
		      "ESR15 : %08lx\n"
		      "MSR0  : %08lx\n"
		      "MSR1  : %08lx\n",
		      esr0, esr14, esr15, msr0, msr1);
	BUG();
} /* end compound_exception() */
开发者ID:ForayJones,项目名称:iods,代码行数:13,代码来源:traps.c


示例18: do_adedata

asmlinkage void do_adedata(struct pt_regs *regs)
{
	const struct exception_table_entry *fixup;
	fixup = search_exception_tables(regs->cp0_epc);
	if (fixup) {
		regs->cp0_epc = fixup->fixup;
		return;
	}
	printk("do_ADE-data:ema:0x%08lx:epc:0x%08lx\n",
		 regs->cp0_ema, regs->cp0_epc);
	die_if_kernel("do_ade execution Exception\n", regs);
	force_sig(SIGBUS, current);
}
开发者ID:Gangfeng,项目名称:linux-1,代码行数:13,代码来源:traps.c


示例19: do_memaccess_unaligned

void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, unsigned long npc,
			    unsigned long psr)
{
	if(regs->psr & PSR_PS) {
		printk("KERNEL MNA at pc %08lx npc %08lx called by %08lx\n", pc, npc,
		       regs->u_regs[UREG_RETPC]);
		die_if_kernel("BOGUS", regs);
		/* die_if_kernel("Kernel MNA access", regs); */
	}
	current->tss.sig_address = pc;
	current->tss.sig_desc = SUBSIG_PRIVINST;
	send_sig(SIGBUS, current, 1);
}
开发者ID:andreiw,项目名称:mkunity,代码行数:13,代码来源:traps.c


示例20: do_illegal_instruction

void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
			    unsigned long psr)
{
	if(psr & PSR_PS)
		die_if_kernel("Kernel illegal instruction", regs);
#ifdef TRAP_DEBUG
	printk("Ill instr. at pc=%08lx instruction is %08lx\n",
	       regs->pc, *(unsigned long *)regs->pc);
#endif
	current->tss.sig_address = pc;
	current->tss.sig_desc = SUBSIG_ILLINST;
	send_sig(SIGILL, current, 1);
}
开发者ID:andreiw,项目名称:mkunity,代码行数:13,代码来源:traps.c



注:本文中的die_if_kernel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dif函数代码示例发布时间:2022-05-30
下一篇:
C++ die_errno函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap