Esempio n. 1
0
/* <save> restore - */
static int
z2restore(i_ctx_t *i_ctx_p)
{
    while (gs_state_saved(gs_state_saved(igs))) {
        if (restore_page_device(igs, gs_state_saved(igs)))
            return push_callout(i_ctx_p, "%restore1pagedevice");
        gs_grestore(igs);
    }
    if (restore_page_device(igs, gs_state_saved(igs)))
        return push_callout(i_ctx_p, "%restorepagedevice");
    return zrestore(i_ctx_p);
}
Esempio n. 2
0
/* - grestoreall - */
static int
z2grestoreall(i_ctx_t *i_ctx_p)
{
    for (;;) {
        if (!restore_page_device(igs, gs_state_saved(igs))) {
            bool done = !gs_state_saved(gs_state_saved(igs));

            gs_grestore(igs);
            if (done)
                break;
        } else
            return push_callout(i_ctx_p, "%grestoreallpagedevice");
    }
    return 0;
}
Esempio n. 3
0
/* - grestore - */
static int
z2grestore(i_ctx_t *i_ctx_p)
{
    if (!restore_page_device(igs, gs_state_saved(igs)))
        return gs_grestore(igs);
    return push_callout(i_ctx_p, "%grestorepagedevice");
}
Esempio n. 4
0
/* <save> .forgetsave - */
static int
zforgetsave(i_ctx_t *i_ctx_p)
{
    os_ptr op = osp;
    alloc_save_t *asave;
    vm_save_t *vmsave;
    int code = restore_check_operand(op, &asave, idmemory);

    if (code < 0)
        return 0;
    vmsave = alloc_save_client_data(asave);
    /* Reset l_new in all stack entries if the new save level is zero. */
    restore_fix_stack(&o_stack, asave, false);
    restore_fix_stack(&e_stack, asave, false);
    restore_fix_stack(&d_stack, asave, false);
    /*
     * Forget the gsaves, by deleting the bottom gstate on
     * the current stack and the top one on the saved stack and then
     * concatenating the stacks together.
     */
    {
        gs_state *pgs = igs;
        gs_state *last;

        while (gs_state_saved(last = gs_state_saved(pgs)) != 0)
            pgs = last;
        gs_state_swap_saved(last, vmsave->gsave);
        gs_grestore(last);
        gs_grestore(last);
    }
    /* Forget the save in the memory manager. */
    code = alloc_forget_save_in(idmemory, asave);
    if (code < 0)
        return code;
    {
        uint space = icurrent_space;

        ialloc_set_space(idmemory, avm_local);
        /* See above for why we clear the gsave pointer here. */
        vmsave->gsave = 0;
        ifree_object(vmsave, "zrestore");
        ialloc_set_space(idmemory, space);
    }
    pop(1);
    return 0;
}