def current_process(cpu, task = None):
    if not task:
        task = SIM_read_register(cpu, ar_kr6)
    try:
        pid = SIM_read_phys_memory(cpu, task + task_pid_offset, 4)
        comm = linux_read_bytes(cpu, task + task_name_offset, 16)
        name = ""
        for c in comm:
            if c == 0:
                break
            name += chr(c)        
        return pid, name
    except sim_core.SimExc_Memory:
        return None, None