void DS_close(void) { context_close(); /* DalvikMterpOpcodes_close(); DalvikDisableJit_close();*/ }
int main(int argc, char **argv) { int i; context_t ctx; char *entry_hook_line = "{exec {print-str ' entry:'} [var 0 0]" "\n {while <is-le [var 0] 10>" "\n {exec" "\n {print-char 32}" "\n {print-hex0 [reg [var 0]]}" "\n {if <is-null [reg [var 0]]>" "\n (break)" "\n }" "\n [var 0 (add [var 0] 1)]" "\n }" "\n }" "\n (print-char 10)" "\n}"; char *exit_hook_line = "{exec {print-str ' exit:'} [var 0 0]" "\n {while <is-le [var 0] 10>" "\n {exec {print-str ' '} (print-hex0 [reg [var 0]]) [var 0 (add [var 0] 1)]}" "\n }" "\n (print-char 10)" "\n}"; hook_p h; if (strings_init(STRING_BUFF) || atoms_init(MAX_ATOMS) || symbols_init(MAX_SYMBOLS) || ringbuf_init(4096) || hooks_init(4, NULL, NULL)) return -1; if (argc > 1) entry_hook_line = argv[1]; if (argc > 2) exit_hook_line = argv[2]; h = hook_install((uint_t)funnn, entry_hook_line, exit_hook_line, NULL, ringbuf_dump, splinter_test_mode); if (!h) { fprintf(stderr, "%s", splinter_error_get()); return -1; } h->enabled = 1; memset(&ctx, 0, sizeof(ctx)); for(i = 0; i < 1; i++) { context_call(&h->entry_chain, h, &ctx); context_call(&h->exit_chain, h, &ctx); context_close(h, &ctx); } dump_ringbuffer(); return 0; }
static void next_context(output_plaintext_move_context_type *context, move_effect_journal_index_type start, char const *opening_sequence, char const *closing_sequence) { context_close(context); context_open(context, context->engine, context->file, context->symbol_table, start, opening_sequence, closing_sequence); }
static void write_singlebox_type3_promotion(output_engine_type const *engine, FILE *file, output_symbol_table_type const *symbol_table) { move_effect_journal_index_type const base = move_effect_journal_base[nbply]; move_effect_journal_index_type const sb3_prom = find_pre_move_effect(move_effect_piece_change, move_effect_reason_singlebox_promotion); if (sb3_prom!=move_effect_journal_index_null) { output_plaintext_move_context_type context; context_open(&context,engine,file,symbol_table,base,"[","]"); write_singlebox_promotion(&context,sb3_prom); context_close(&context); } }
void output_plaintext_write_move(output_engine_type const *engine, FILE *file, output_symbol_table_type const *symbol_table) { output_plaintext_move_context_type context; #ifdef _SE_DECORATE_SOLUTION_ se_move(mov); #endif if (CondFlag[singlebox] && SingleBoxType==ConditionType3) write_singlebox_type3_promotion(engine,file,symbol_table); context_open(&context,engine,file,symbol_table,move_effect_journal_base[nbply],"",""); write_regular_move(&context); write_other_effects(&context); context_close(&context); }
static void __destroy_hw_context(struct i915_gem_context *ctx, struct drm_i915_file_private *file_priv) { idr_remove(&file_priv->context_idr, ctx->user_handle); context_close(ctx); }
static struct i915_gem_context * __create_hw_context(struct drm_i915_private *dev_priv, struct drm_i915_file_private *file_priv) { struct i915_gem_context *ctx; int ret; ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (ctx == NULL) return ERR_PTR(-ENOMEM); ret = assign_hw_id(dev_priv, &ctx->hw_id); if (ret) { kfree(ctx); return ERR_PTR(ret); } kref_init(&ctx->ref); list_add_tail(&ctx->link, &dev_priv->context_list); ctx->i915 = dev_priv; if (dev_priv->hw_context_size) { struct drm_i915_gem_object *obj; struct i915_vma *vma; obj = alloc_context_obj(dev_priv, dev_priv->hw_context_size); if (IS_ERR(obj)) { ret = PTR_ERR(obj); goto err_out; } vma = i915_vma_instance(obj, &dev_priv->ggtt.base, NULL); if (IS_ERR(vma)) { i915_gem_object_put(obj); ret = PTR_ERR(vma); goto err_out; } ctx->engine[RCS].state = vma; } /* Default context will never have a file_priv */ ret = DEFAULT_CONTEXT_HANDLE; if (file_priv) { ret = idr_alloc(&file_priv->context_idr, ctx, DEFAULT_CONTEXT_HANDLE, 0, GFP_KERNEL); if (ret < 0) goto err_out; } ctx->user_handle = ret; ctx->file_priv = file_priv; if (file_priv) { ctx->pid = get_task_pid(current, PIDTYPE_PID); ctx->name = kasprintf(GFP_KERNEL, "%s[%d]/%x", current->comm, pid_nr(ctx->pid), ctx->user_handle); if (!ctx->name) { ret = -ENOMEM; goto err_pid; } } /* NB: Mark all slices as needing a remap so that when the context first * loads it will restore whatever remap state already exists. If there * is no remap info, it will be a NOP. */ ctx->remap_slice = ALL_L3_SLICES(dev_priv); i915_gem_context_set_bannable(ctx); ctx->ring_size = 4 * PAGE_SIZE; ctx->desc_template = default_desc_template(dev_priv, dev_priv->mm.aliasing_ppgtt); /* GuC requires the ring to be placed above GUC_WOPCM_TOP. If GuC is not * present or not in use we still need a small bias as ring wraparound * at offset 0 sometimes hangs. No idea why. */ if (HAS_GUC(dev_priv) && i915.enable_guc_loading) ctx->ggtt_offset_bias = GUC_WOPCM_TOP; else ctx->ggtt_offset_bias = I915_GTT_PAGE_SIZE; return ctx; err_pid: put_pid(ctx->pid); idr_remove(&file_priv->context_idr, ctx->user_handle); err_out: context_close(ctx); return ERR_PTR(ret); }