Example #1
0
int vmi_pgd_changed(CPUState *cpu, target_ulong oldval, target_ulong newval) {
    uint32_t i;
    OsiProcs *ps, *in, *out;
    ps = in = out = NULL;

    /* some callback has to be registered for retrieving processes */
    assert(PPP_CHECK_CB(on_get_processes) != 0);

    /* update process state */
    ps = get_processes(cpu);
    procstate_update(ps, &in, &out);

    /* invoke callbacks for finished processes */
    if (out != NULL) {
        for (i=0; i<out->num; i++) {
            PPP_RUN_CB(on_finished_process, cpu, &out->proc[i]);
        }
        free_osiprocs(out);
    }

    /* invoke callbacks for new processes */
    if (in != NULL) {
        for (i=0; i<in->num; i++) {
            PPP_RUN_CB(on_new_process, cpu, &in->proc[i]);
        }
        free_osiprocs(in);
    }

    return 0;
}
Example #2
0
int vmi_pgd_changed(CPUState *env, target_ulong oldval, target_ulong newval) {
    uint32_t i;
    OsiProcs *ps, *in, *out;
    ps = in = out = NULL;

    /* update process state */
    ps = get_processes(env);
    procstate_update(ps, &in, &out);

    /* invoke callbacks for finished processes */
    if (out != NULL) {
        for (i=0; i<out->num; i++) {
            PPP_RUN_CB(on_finished_process, env, &out->proc[i]);
        }
        free_osiprocs(out);
    }

    /* invoke callbacks for new processes */
    if (in != NULL) {
        for (i=0; i<in->num; i++) {
            PPP_RUN_CB(on_new_process, env, &in->proc[i]);
        }
        free_osiprocs(in);
    }

    return 0;
}
Example #3
0
int before_block_exec(CPUState *env, TranslationBlock *tb) {
    int i;

    OsiProc *current = get_current_process(env);
    printf("Current process: %s PID:" TARGET_FMT_ld " PPID:" TARGET_FMT_ld "\n", current->name, current->pid, current->ppid);

    OsiModules *ms = get_libraries(env, current);
    if (ms == NULL) {
        printf("No mapped dynamic libraries.\n");
    }
    else {
        printf("Dynamic libraries list (%d libs):\n", ms->num);
        for (i = 0; i < ms->num; i++)
            printf("\t0x" TARGET_FMT_lx "\t" TARGET_FMT_ld "\t%-24s %s\n", ms->module[i].base, ms->module[i].size, ms->module[i].name, ms->module[i].file);
    }

    printf("\n");

    OsiProcs *ps = get_processes(env);
    if (ps == NULL) {
        printf("Process list not available.\n");
    }
    else {
        printf("Process list (%d procs):\n", ps->num);
        for (i = 0; i < ps->num; i++)
            printf("  %-16s\t" TARGET_FMT_ld "\t" TARGET_FMT_ld "\n", ps->proc[i].name, ps->proc[i].pid, ps->proc[i].ppid);
    }

    printf("\n");

    OsiModules *kms = get_modules(env);
    if (kms == NULL) {
        printf("No mapped kernel modules.\n");
    }
    else {
        printf("Kernel module list (%d modules):\n", kms->num);
        for (i = 0; i < kms->num; i++)
            printf("\t0x" TARGET_FMT_lx "\t" TARGET_FMT_ld "\t%-24s %s\n", kms->module[i].base, kms->module[i].size, kms->module[i].name, kms->module[i].file);
    }

    printf("\n-------------------------------------------------\n\n");

    // Cleanup
    free_osiproc(current);
    free_osiprocs(ps);
    free_osimodules(ms);

    return 0;
}