本文整理汇总了C++中restore_context函数的典型用法代码示例。如果您正苦于以下问题:C++ restore_context函数的具体用法?C++ restore_context怎么用?C++ restore_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了restore_context函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mono_x86_throw_exception
/*
* mono_x86_throw_exception:
*
* C function called from the throw trampolines.
*/
void
mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc,
mgreg_t eip, gboolean rethrow)
{
static void (*restore_context) (MonoContext *);
MonoContext ctx;
if (!restore_context)
restore_context = mono_get_restore_context ();
ctx.esp = regs [X86_ESP];
ctx.eip = eip;
ctx.ebp = regs [X86_EBP];
ctx.edi = regs [X86_EDI];
ctx.esi = regs [X86_ESI];
ctx.ebx = regs [X86_EBX];
ctx.edx = regs [X86_EDX];
ctx.ecx = regs [X86_ECX];
ctx.eax = regs [X86_EAX];
#ifdef __APPLE__
/* The OSX ABI specifies 16 byte alignment at call sites */
g_assert ((ctx.esp % MONO_ARCH_FRAME_ALIGNMENT) == 0);
#endif
if (mono_object_isinst (exc, mono_defaults.exception_class)) {
MonoException *mono_ex = (MonoException*)exc;
if (!rethrow)
mono_ex->stack_trace = NULL;
}
if (mono_debug_using_mono_debugger ()) {
guint8 buf [16], *code;
mono_breakpoint_clean_code (NULL, (gpointer)eip, 8, buf, sizeof (buf));
code = buf + 8;
if (buf [3] == 0xe8) {
MonoContext ctx_cp = ctx;
ctx_cp.eip = eip - 5;
if (mono_debugger_handle_exception (&ctx_cp, exc)) {
restore_context (&ctx_cp);
g_assert_not_reached ();
}
}
}
/* adjust eip so that it point into the call instruction */
ctx.eip -= 1;
mono_handle_exception (&ctx, exc);
restore_context (&ctx);
g_assert_not_reached ();
}
开发者ID:efcastrillon,项目名称:mono,代码行数:62,代码来源:exceptions-x86.c
示例2: ill_handler
/**********************************************************************
* ill_handler
*
* Handler for SIGILL.
*/
static void ill_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
{
EXCEPTION_RECORD rec;
CONTEXT context;
switch ( info->si_code )
{
default:
case ILL_ILLOPC:
case ILL_ILLOPN:
case ILL_ILLADR:
case ILL_ILLTRP:
rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION;
break;
case ILL_PRVOPC:
case ILL_PRVREG:
rec.ExceptionCode = EXCEPTION_PRIV_INSTRUCTION;
break;
case ILL_BADSTK:
rec.ExceptionCode = EXCEPTION_STACK_OVERFLOW;
break;
}
save_context( &context, ucontext );
rec.ExceptionRecord = NULL;
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
rec.ExceptionAddress = (LPVOID)context.pc;
rec.NumberParameters = 0;
__regs_RtlRaiseException( &rec, &context );
restore_context( &context, ucontext );
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:38,代码来源:signal_sparc.c
示例3: throw_exception
static void
throw_exception (MonoObject *exc, gpointer sp, gpointer ip, gboolean rethrow)
{
MonoContext ctx;
static void (*restore_context) (MonoContext *);
gpointer *window;
if (!restore_context)
restore_context = mono_get_restore_context ();
window = MONO_SPARC_WINDOW_ADDR (sp);
ctx.sp = (gpointer*)sp;
ctx.ip = ip;
ctx.fp = (gpointer*)(MONO_SPARC_WINDOW_ADDR (sp) [sparc_i6 - 16]);
if (mono_object_isinst (exc, mono_defaults.exception_class)) {
MonoException *mono_ex = (MonoException*)exc;
if (!rethrow)
mono_ex->stack_trace = NULL;
}
mono_handle_exception (&ctx, exc);
restore_context (&ctx);
g_assert_not_reached ();
}
开发者ID:Adamcbrz,项目名称:mono,代码行数:25,代码来源:exceptions-sparc.c
示例4: mono_arm_throw_exception
void
mono_arm_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, gulong *int_regs, gdouble *fp_regs)
{
static void (*restore_context) (MonoContext *);
MonoContext ctx;
gboolean rethrow = eip & 1;
if (!restore_context)
restore_context = mono_get_restore_context ();
eip &= ~1; /* clear the optional rethrow bit */
/* adjust eip so that it point into the call instruction */
eip -= 4;
/*printf ("stack in throw: %p\n", esp);*/
MONO_CONTEXT_SET_BP (&ctx, int_regs [ARMREG_FP - 4]);
MONO_CONTEXT_SET_SP (&ctx, esp);
MONO_CONTEXT_SET_IP (&ctx, eip);
memcpy (((guint8*)&ctx.regs) + (4 * 4), int_regs, sizeof (gulong) * 8);
/* memcpy (&ctx.fregs, fp_regs, sizeof (double) * MONO_SAVED_FREGS); */
if (mono_object_isinst (exc, mono_defaults.exception_class)) {
MonoException *mono_ex = (MonoException*)exc;
if (!rethrow)
mono_ex->stack_trace = NULL;
}
mono_handle_exception (&ctx, exc, (gpointer)(eip + 4), FALSE);
restore_context (&ctx);
g_assert_not_reached ();
}
开发者ID:massimiliano-mantione,项目名称:mono,代码行数:30,代码来源:exceptions-arm.c
示例5: vdadec_decode
static int vdadec_decode(AVCodecContext *avctx,
void *data, int *got_frame, AVPacket *avpkt)
{
VDADecoderContext *ctx = avctx->priv_data;
AVFrame *pic = data;
int ret;
set_context(avctx);
ret = ff_h264_decoder.decode(avctx, data, got_frame, avpkt);
restore_context(avctx);
if (*got_frame) {
AVBufferRef *buffer = pic->buf[0];
VDABufferContext *context = av_buffer_get_opaque(buffer);
CVPixelBufferRef cv_buffer = (CVPixelBufferRef)pic->data[3];
CVPixelBufferRetain(cv_buffer);
CVPixelBufferLockBaseAddress(cv_buffer, 0);
context->cv_buffer = cv_buffer;
pic->format = ctx->pix_fmt;
if (CVPixelBufferIsPlanar(cv_buffer)) {
int i, count = CVPixelBufferGetPlaneCount(cv_buffer);
av_assert0(count < 4);
for (i = 0; i < count; i++) {
pic->data[i] = CVPixelBufferGetBaseAddressOfPlane(cv_buffer, i);
pic->linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(cv_buffer, i);
}
} else {
pic->data[0] = CVPixelBufferGetBaseAddress(cv_buffer);
pic->linesize[0] = CVPixelBufferGetBytesPerRow(cv_buffer);
}
}
avctx->pix_fmt = ctx->pix_fmt;
return ret;
}
开发者ID:15806905685,项目名称:FFmpeg,代码行数:35,代码来源:vda_h264_dec.c
示例6: throw_exception
static void
throw_exception (MonoObject *exc, guint64 rethrow)
{
unw_context_t unw_ctx;
MonoContext ctx;
MonoJitInfo *ji;
unw_word_t ip, sp;
int res;
if (mono_object_isinst (exc, mono_defaults.exception_class)) {
MonoException *mono_ex = (MonoException*)exc;
if (!rethrow) {
mono_ex->stack_trace = NULL;
mono_ex->trace_ips = NULL;
}
}
res = unw_getcontext (&unw_ctx);
g_assert (res == 0);
res = unw_init_local (&ctx.cursor, &unw_ctx);
g_assert (res == 0);
/*
* Unwind until the first managed frame. This is needed since
* mono_handle_exception expects the variables in the original context to
* correspond to the method returned by mono_find_jit_info.
*/
while (TRUE) {
res = unw_get_reg (&ctx.cursor, UNW_IA64_IP, &ip);
g_assert (res == 0);
res = unw_get_reg (&ctx.cursor, UNW_IA64_SP, &sp);
g_assert (res == 0);
ji = mini_jit_info_table_find (mono_domain_get (), (gpointer)ip, NULL);
//printf ("UN: %s %lx %lx\n", ji ? jinfo_get_method (ji)->name : "", ip, sp);
if (ji)
break;
res = unw_step (&ctx.cursor);
if (res == 0) {
/*
* This means an unhandled exception during the compilation of a
* topmost method like Main
*/
break;
}
g_assert (res >= 0);
}
ctx.precise_ip = FALSE;
mono_handle_exception (&ctx, exc);
restore_context (&ctx);
g_assert_not_reached ();
}
开发者ID:red-gate,项目名称:mono,代码行数:59,代码来源:exceptions-ia64.c
示例7: SVC_Handler
void SVC_Handler(void)
{
save_context();
asm("bl sched_run");
/* call scheduler update sched_active_thread variable with pdc of next thread
* the thread that has higest priority and is in PENDING state */
restore_context();
}
开发者ID:A-L-E-X,项目名称:RIOT,代码行数:8,代码来源:atom.c
示例8: __attribute__
__attribute__((naked))void PendSV_Handler(void)
{
save_context();
/* call scheduler update fk_thread variable with pdc of next thread */
asm("bl sched_run");
/* the thread that has higest priority and is in PENDING state */
restore_context();
}
开发者ID:trinhanh92,项目名称:thirdparty_cpu,代码行数:8,代码来源:cpu.c
示例9: HANDLER_DEF
/**********************************************************************
* usr1_handler
*
* Handler for SIGUSR1, used to signal a thread that it got suspended.
*/
static HANDLER_DEF(usr1_handler)
{
CONTEXT context;
save_context( &context, HANDLER_CONTEXT );
wait_suspend( &context );
restore_context( &context, HANDLER_CONTEXT );
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:13,代码来源:signal_sparc.c
示例10: preload_objects
/* New version used when not in -o mode. The epilog() in master.c is
* supposed to return an array of files (castles in 2.4.5) to load. The array
* returned by apply() will be freed at next call of apply(), which means that
* the ref count has to be incremented to protect against deallocation.
*
* The master object is asked to do the actual loading.
*/
void preload_objects (int eflag)
{
VOLATILE array_t *prefiles;
svalue_t *ret;
VOLATILE int ix;
error_context_t econ;
save_context(&econ);
if (SETJMP(econ.context)) {
restore_context(&econ);
pop_context(&econ);
return;
}
push_number(eflag);
ret = apply_master_ob(APPLY_EPILOG, 1);
pop_context(&econ);
if ((ret == 0) || (ret == (svalue_t *)-1) || (ret->type != T_ARRAY))
return;
else
prefiles = ret->u.arr;
if ((prefiles == 0) || (prefiles->size < 1))
return;
debug_message("\nLoading preloaded files ...\n");
prefiles->ref++;
ix = 0;
/* in case of an error, effectively do a 'continue' */
save_context(&econ);
if (SETJMP(econ.context)) {
restore_context(&econ);
ix++;
}
for ( ; ix < prefiles->size; ix++) {
if (prefiles->item[ix].type != T_STRING)
continue;
set_eval(max_cost);
push_svalue(((array_t *)prefiles)->item + ix);
(void) apply_master_ob(APPLY_PRELOAD, 1);
}
free_array((array_t *)prefiles);
pop_context(&econ);
} /* preload_objects() */
开发者ID:Hobbitron,项目名称:tmi2_fluffos_v3,代码行数:51,代码来源:backend.c
示例11: scheme_start
void scheme_start( word *globals )
{
cont_t f = 0;
word *stkp = (word*)globals[ G_STKP ];
int x;
if (already_running)
panic_abort( "Recursive call to scheme_start (FFI?)" );
already_running = 1;
/* Patch in bootstrap code if necessary */
if (procedure_ref( globals[ G_REG0 ], IDX_PROC_CODE ) == FALSE_CONST)
procedure_set( globals[ G_REG0 ], IDX_PROC_CODE, (word)twobit_start );
/* Return address for bottom-most frame */
stkp[ STK_RETADDR ] = (word)i386_dispatch_loop_return;
stkp[ STK_REG0 ] = 0;
/* The dispatch loop is a doubly-nested quasi-loop.
The outer loop uses setjmp/longjmp for control and is entered but
rarely; most of the time is spent in the inner loop. The job of
the outer loop is to provide the inner loop with the address of
the first block to execute.
The inner loop is implemented entirely in compiled code: we just
jump to the entry point, and any return is done through a longjmp
to the outer loop.
*/
/* Outer loop */
switch (x = setjmp( dispatch_jump_buffer )) {
case 0 :
case DISPATCH_CALL_R0 :
f = procedure_ref( globals[ G_REG0 ], IDX_PROC_CODE );
break;
case DISPATCH_EXIT:
already_running = 0;
return;
case DISPATCH_RETURN_FROM_S2S_CALL :
f = restore_context( globals );
break;
case DISPATCH_STKUFLOW :
f = refill_stack_cache( globals );
break;
case DISPATCH_SIGFPE :
handle_sigfpe( globals );
panic_exit( "handle_sigfpe() returned." );
default :
panic_exit( "Unexpected value %d from setjmp in scheme_start()", x );
}
/* Inner loop */
i386_scheme_jump(globals,f); /* Never returns */
}
开发者ID:TaylanUB,项目名称:larceny,代码行数:55,代码来源:i386-driver.c
示例12: altstack_handle_and_restore
static void
altstack_handle_and_restore (MonoContext *ctx, gpointer obj, gboolean stack_ovf)
{
void (*restore_context) (MonoContext *);
MonoContext mctx;
restore_context = mono_get_restore_context ();
mctx = *ctx;
if (mono_debugger_handle_exception (&mctx, (MonoObject *)obj)) {
if (stack_ovf)
prepare_for_guard_pages (&mctx);
restore_context (&mctx);
}
mono_handle_exception (&mctx, obj);
if (stack_ovf)
prepare_for_guard_pages (&mctx);
restore_context (&mctx);
}
开发者ID:efcastrillon,项目名称:mono,代码行数:20,代码来源:exceptions-x86.c
示例13: altstack_handle_and_restore
static void
altstack_handle_and_restore (void *sigctx, gpointer obj, gboolean stack_ovf)
{
void (*restore_context) (MonoContext *);
MonoContext mctx;
restore_context = mono_get_restore_context ();
mono_arch_sigctx_to_monoctx (sigctx, &mctx);
if (mono_debugger_handle_exception (&mctx, (MonoObject *)obj)) {
if (stack_ovf)
prepare_for_guard_pages (&mctx);
restore_context (&mctx);
}
mono_handle_exception (&mctx, obj, (gpointer)mctx.eip, FALSE);
if (stack_ovf)
prepare_for_guard_pages (&mctx);
restore_context (&mctx);
}
开发者ID:massimiliano-mantione,项目名称:mono,代码行数:20,代码来源:exceptions-x86.c
示例14: c_caught_error
void c_caught_error(error_context_t * econ) {
restore_context(econ);
STACK_INC;
*sp = catch_value;
catch_value = const1;
/* if it's too deep or max eval, we can't let them catch it */
pop_context(econ);
if (max_eval_error)
error("Can't catch eval cost too big error.\n");
if (too_deep_error)
error("Can't catch too deep recursion error.\n");
}
开发者ID:xcw0579,项目名称:mudOS,代码行数:13,代码来源:cfuns.c
示例15: vdadec_close
static av_cold int vdadec_close(AVCodecContext *avctx)
{
VDADecoderContext *ctx = avctx->priv_data;
/* release buffers and decoder */
ff_vda_destroy_decoder(&ctx->vda_ctx);
/* close H.264 decoder */
if (ctx->h264_initialized) {
set_context(avctx);
ff_h264_decoder.close(avctx);
restore_context(avctx);
}
return 0;
}
开发者ID:15806905685,项目名称:FFmpeg,代码行数:13,代码来源:vda_h264_dec.c
示例16: do_resume
static int do_resume(struct target *t)
{
/* needs proper handling later */
t->state = TARGET_DEBUG_RUNNING;
if (restore_context(t) != ERROR_OK)
return ERROR_FAIL;
if (exit_probemode(t) != ERROR_OK)
return ERROR_FAIL;
t->state = TARGET_RUNNING;
t->debug_reason = DBG_REASON_NOTHALTED;
LOG_USER("target running");
return target_call_event_callbacks(t, TARGET_EVENT_RESUMED);
}
开发者ID:01org,项目名称:CODK-A-Flashpack,代码行数:15,代码来源:lakemont.c
示例17: __attribute__
/**
* Entry point for the vcore. Basic job is to either resume the thread that
* was interrupted in the case of a notification coming in, or to find a new
* thread from the user level threading library and launch it.
**/
void __attribute__((noreturn)) vcore_entry()
{
/* Grab references to the current vcoreid vcore preemption data, and the
* vcoremap */
assert(in_vcore_context());
uint32_t vcoreid = vcore_id();
struct preempt_data *vcpd = &__procdata.vcore_preempt_data[vcoreid];
struct vcore *vc = &__procinfo.vcoremap[vcoreid];
tdebug("current=%s, vcore=%d\n",
current_thread?current_thread->name : "NULL", vcoreid);
/* Assert that notifications are disabled. Should always have notifications
* disabled when coming in here. */
assert(vcpd->notif_enabled == FALSE);
/* Put this in the loop that deals with notifications. It will return if
* there is no preempt pending. */
if (vc->preempt_pending)
sys_yield(TRUE);
/* When running vcore_entry(), we are using the TLS of the vcore, not any
* particular thread. If current_thread is set in the vcore's TLS, then
* that means the thread did not yield voluntarily, and was, instead,
* interrupted by a notification. We therefore need to restore the thread
* context from the notification trapframe, not the one stored in the
* thread struct itself. */
if (unlikely(current_thread)) {
vcpd->notif_pending = 0;
/* Do one last check for notifs after clearing pending */
// TODO: call the handle_notif() here (first)
/* Copy the notification trapframe into the current
* threads trapframe */
memcpy(¤t_thread->context->utf, &vcpd->notif_tf,
sizeof(struct user_trapframe));
/* Restore the context from the current_thread's trapframe */
restore_context(current_thread->context);
assert(0);
}
/* Otherwise either a vcore is coming up for the first time, or a thread
* has just yielded and vcore_entry() was called directly. In this case we
* need to figure out which thread to schedule next on the vcore */
run_next_thread();
assert(0);
}
开发者ID:kstraube,项目名称:hysim,代码行数:53,代码来源:vcore.c
示例18: handle_signal_exception
/*
* handle_exception:
*
* Called by resuming from a signal handler.
*/
static void
handle_signal_exception (gpointer obj, gboolean test_only)
{
MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
MonoContext ctx;
static void (*restore_context) (MonoContext *);
if (!restore_context)
restore_context = mono_get_restore_context ();
memcpy (&ctx, &jit_tls->ex_ctx, sizeof (MonoContext));
mono_handle_exception (&ctx, obj, MONO_CONTEXT_GET_IP (&ctx), test_only);
restore_context (&ctx);
}
开发者ID:massimiliano-mantione,项目名称:mono,代码行数:21,代码来源:exceptions-arm.c
示例19: handle_signal_exception
/*
* handle_exception:
*
* Called by resuming from a signal handler.
*/
static void
handle_signal_exception (gpointer obj)
{
MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
MonoContext ctx;
static void (*restore_context) (MonoContext *);
if (!restore_context)
restore_context = mono_get_restore_context ();
memcpy (&ctx, &jit_tls->ex_ctx, sizeof (MonoContext));
mono_handle_exception (&ctx, obj);
restore_context (&ctx);
}
开发者ID:rnagy,项目名称:mono-1,代码行数:21,代码来源:exceptions-mips.c
示例20: int_handler
/**********************************************************************
* int_handler
*
* Handler for SIGINT.
*/
static void int_handler( int signal, siginfo_t *info, ucontext_t *ucontext )
{
if (!dispatch_signal(SIGINT))
{
EXCEPTION_RECORD rec;
CONTEXT context;
save_context( &context, ucontext );
rec.ExceptionCode = CONTROL_C_EXIT;
rec.ExceptionFlags = EXCEPTION_CONTINUABLE;
rec.ExceptionRecord = NULL;
rec.ExceptionAddress = (LPVOID)context.pc;
rec.NumberParameters = 0;
__regs_RtlRaiseException( &rec, &context );
restore_context( &context, ucontext );
}
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:22,代码来源:signal_sparc.c
注:本文中的restore_context函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论