您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ trap_dispatch函数代码示例

51自学网 2021-06-03 08:58:19
  C++
这篇教程C++ trap_dispatch函数代码示例写得很实用,希望能帮到您。

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

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

示例1: mips_trap

/* * General trap (exception) handling function for mips. * This is called by the assembly-language exception handler once * the trapframe has been set up. */  voidmips_trap(struct trapframe *tf){//kprintf("mips_trap:epc=0x%x cause=%x badvaddr=0x%08x/n", tf->tf_epc, (tf->tf_cause >> 2) & 0x1F, tf->tf_vaddr);  // dispatch based on what type of trap occurred  // used for previous projects  if (current == NULL) {    trap_dispatch(tf);  }  else {    // keep a trapframe chain in stack    struct trapframe *otf = current->tf;    current->tf = tf;    bool in_kernel = trap_in_kernel(tf);    trap_dispatch(tf);    current->tf = otf;    if (!in_kernel) {      if (current->flags & PF_EXITING) {        do_exit(-E_KILLED);      }      if (current->need_resched) {        schedule();      }    }  }}
开发者ID:TySag,项目名称:project,代码行数:33,


示例2: trap

/* * * trap - handles or dispatches an exception/interrupt. if and when trap() returns, * the code in kern/trap/trapentry.S restores the old CPU state saved in the * trapframe and then uses the iret instruction to return from the exception. * */voidtrap(struct trapframe *tf) {    // dispatch based on what type of trap occurred    // used for previous projects    if (current == NULL) {        trap_dispatch(tf);    }    else {        // keep a trapframe chain in stack        struct trapframe *otf = current->tf;        current->tf = tf;            bool in_kernel = trap_in_kernel(tf);            trap_dispatch(tf);            current->tf = otf;        if (!in_kernel) {            if (current->flags & PF_EXITING) {                do_exit(-E_KILLED);            }            if (current->need_resched) {                schedule();            }        }    }}
开发者ID:thuyangyu,项目名称:ucore_lab,代码行数:32,


示例3: trap

voidtrap(struct Trapframe *tf){	asm volatile("cld" : : : "cc");	assert(!(read_eflags() & FL_IF));	// cprintf("Incoming TRAP frame at %p/n", tf);	if ((tf->tf_cs & 3) == 3) {		// Trapped from user mode.		// Copy trap frame (which is currently on the stack)		// into 'curenv->env_tf', so that running the environment		// will restart at the trap point.		assert(curenv);		curenv->env_tf = *tf;		// The trapframe on the stack should be ignored from here on.		tf = &curenv->env_tf;	}		// Dispatch based on what type of trap occurred	trap_dispatch(tf);	// If we made it to this point, then no other environment was	// scheduled, so we should return to the current environment	// if doing so makes sense.	if (curenv && curenv->env_status == ENV_RUNNABLE)		env_run(curenv);	else		sched_yield();}
开发者ID:Hzwcode,项目名称:MIT-JOS,代码行数:30,


示例4: trap

voidtrap(struct Trapframe *tf){	// The environment may have set DF and some versions	// of GCC rely on DF being clear	asm volatile("cld" ::: "cc");	// Halt the CPU if some other CPU has called panic()	extern char *panicstr;	if (panicstr)		asm volatile("hlt");	// Re-acqurie the big kernel lock if we were halted in	// sched_yield()	if (xchg(&thiscpu->cpu_status, CPU_STARTED) == CPU_HALTED)		lock_kernel();	// Check that interrupts are disabled.  If this assertion	// fails, DO NOT be tempted to fix it by inserting a "cli" in	// the interrupt path.	assert(!(read_eflags() & FL_IF));	if ((tf->tf_cs & 3) == 3) {		// Trapped from user mode.		// Acquire the big kernel lock before doing any		// serious kernel work.		// LAB 4: Your code here.		assert(curenv);		lock_kernel();		// Garbage collect if current enviroment is a zombie		if (curenv->env_status == ENV_DYING) {			env_free(curenv);			curenv = NULL;			sched_yield();		}		// Copy trap frame (which is currently on the stack)		// into 'curenv->env_tf', so that running the environment		// will restart at the trap point.		curenv->env_tf = *tf;		// The trapframe on the stack should be ignored from here on.		tf = &curenv->env_tf;	}	// Record that tf is the last real trapframe so	// print_trapframe can print some additional information.	last_tf = tf;	// Dispatch based on what type of trap occurred	trap_dispatch(tf);	// If we made it to this point, then no other environment was	// scheduled, so we should return to the current environment	// if doing so makes sense.	if (curenv && curenv->env_status == ENV_RUNNING)		env_run(curenv);	else		sched_yield();}
开发者ID:chenkexin,项目名称:jos,代码行数:60,


示例5: trap

voidtrap(struct Trapframe *tf){	// The environment may have set DF and some versions	// of GCC rely on DF being clear	asm volatile("cld" ::: "cc");	// Check that interrupts are disabled.  If this assertion	// fails, DO NOT be tempted to fix it by inserting a "cli" in	// the interrupt path.	assert(!(read_eflags() & FL_IF));	if ((tf->tf_cs & 3) == 3) {		// Trapped from user mode.		// Copy trap frame (which is currently on the stack)		// into 'curenv->env_tf', so that running the environment		// will restart at the trap point.		assert(curenv);		curenv->env_tf = *tf;		// The trapframe on the stack should be ignored from here on.		tf = &curenv->env_tf;	}		// Dispatch based on what type of trap occurred	trap_dispatch(tf);	// If we made it to this point, then no other environment was	// scheduled, so we should return to the current environment	// if doing so makes sense.	if (curenv && curenv->env_status == ENV_RUNNABLE)		env_run(curenv);	else		sched_yield();}
开发者ID:ProsenSark,项目名称:SBUcse506,代码行数:34,


示例6: trap

void trap(struct trapframe *tf){	// used for previous projects	if (pls_read(current) == NULL) {		trap_dispatch(tf);	} else {		// keep a trapframe chain in stack		struct trapframe *otf = pls_read(current)->tf;		pls_read(current)->tf = tf;		bool in_kernel = trap_in_kernel(tf);		trap_dispatch(tf);		pls_read(current)->tf = otf;		if (!in_kernel) {			may_killed();			if (pls_read(current)->need_resched) {				schedule();			}		}	}}
开发者ID:TySag,项目名称:project,代码行数:23,


示例7: trap

void trap(struct frame *tf){		// The environment may have set DF and some versions	// of GCC rely on DF being clear	asm volatile("cld" ::: "cc");	assert(!(read_eflags() & FL_IF));		curtask->trapframe = tf;	if ((tf->tf_cs & 3) == 3) {			} else {		//print_frame(tf);		//panic("kernel double fault/n");	}	trap_dispatch(tf);		schedule();}
开发者ID:Zhang626,项目名称:miniOS,代码行数:22,


示例8: trap

voidtrap(struct Trapframe *tf){    //struct Trapframe *tf = &tf_;	// The environment may have set DF and some versions	// of GCC rely on DF being clear	asm volatile("cld" ::: "cc");	// Check that interrupts are disabled.  If this assertion	// fails, DO NOT be tempted to fix it by inserting a "cli" in	// the interrupt path.	assert(!(read_eflags() & FL_IF));	cprintf("Incoming TRAP frame at %p/n", tf);	if ((tf->tf_cs & 3) == 3) {		// Trapped from user mode.		assert(curenv);		// Copy trap frame (which is currently on the stack)		// into 'curenv->env_tf', so that running the environment		// will restart at the trap point.		curenv->env_tf = *tf;		// The trapframe on the stack should be ignored from here on.		tf = &curenv->env_tf;	}	// Record that tf is the last real trapframe so	// print_trapframe can print some additional information.	last_tf = tf;	// Dispatch based on what type of trap occurred	trap_dispatch(tf);	// Return to the current environment, which should be running.	assert(curenv && curenv->env_status == ENV_RUNNING);	env_run(curenv);}
开发者ID:GeneralYun,项目名称:MIT-JOS-64bit-CSE506,代码行数:38,


示例9: trap

/* * * trap - handles or dispatches an exception/interrupt. if and when trap() returns, * the code in kern/trap/trapentry.S restores the old CPU state saved in the * trapframe and then uses the iret instruction to return from the exception. * */voidtrap(struct trapframe *tf) {    // dispatch based on what type of trap occurred    trap_dispatch(tf);}
开发者ID:dwt136,项目名称:ucore_lab,代码行数:10,



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


C++ trap_in_kernel函数代码示例
C++ trap_Trace函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。