Exemple #1
0
    def __init__(self, cpu, cell_name, param, mem_utils, unistd, unistd32,
                 RUN_FROM_SNAP, lgr):
        self.cpu = cpu
        self.cell_name = cell_name
        self.lgr = lgr
        self.param = param
        self.mem_utils = mem_utils
        self.phys_current_task = None
        self.exit_cycles = 0
        self.exit_pid = 0
        self.exec_addrs = {}
        self.swapper = None

        if RUN_FROM_SNAP is not None:
            phys_current_task_file = os.path.join('./', RUN_FROM_SNAP,
                                                  cell_name,
                                                  'phys_current_task.pickle')
            if os.path.isfile(phys_current_task_file):
                self.phys_current_task = pickle.load(
                    open(phys_current_task_file, 'rb'))
            exec_addrs_file = os.path.join('./', RUN_FROM_SNAP,
                                           'exec_addrs.pickle')
            if os.path.isfile(exec_addrs_file):
                self.exec_addrs = pickle.load(open(exec_addrs_file, 'rb'))
        if self.phys_current_task is None:
            ''' address of current_task symbol, pointer at this address points to the current task record '''
            ''' use physical address because some are relative to FS segment '''
            #phys_block = cpu.iface.processor_info.logical_to_physical(param.current_task, Sim_Access_Read)
            phys = self.mem_utils.v2p(cpu, param.current_task)
            #self.phys_current_task = phys_block.address
            self.phys_current_task = phys
            #if param.current_task_fs:
            #    cmd = 'logical-to-physical fs:0x%x' % param.current_task
            #else:
            #    cmd = 'logical-to-physical 0x%x' % param.current_task
            #SIM_run_command('pselect cpu-name = %s' % cpu.name)
            #try:
            #    self.phys_current_task = SIM_run_command(cmd)
            if self.phys_current_task > 0xffffffff:
                self.lgr.debug(
                    'TaskUtils cell %s phys address for 0x%x is too large' %
                    (self.cell_name, param.current_task))
                self.phys_current_task = 0
                return None
            #except:
            #    self.phys_current_task = 0
            #    self.lgr.debug('TaskUtils init failed to get phys addr of 0x%x' % (param.current_task))
            #    return None
        self.lgr.debug(
            'TaskUtils init cell %s with current_task of 0x%x, phys: 0x%x' %
            (cell_name, param.current_task, self.phys_current_task))
        self.syscall_numbers = syscallNumbers.SyscallNumbers(unistd, self.lgr)
        if unistd32 is not None:
            self.syscall_numbers32 = syscallNumbers.SyscallNumbers(
                unistd32, self.lgr)
        else:
            self.syscall_numbers32 = None
Exemple #2
0
    def __init__(self, cpu, param, mem_utils, unistd, RUN_FROM_SNAP, lgr):
        self.cpu = cpu
        self.lgr = lgr
        self.param = param
        self.mem_utils = mem_utils
        self.phys_current_task = None
        self.exit_cycles = 0
        self.exit_pid = 0
        self.exec_addrs = {}

        if RUN_FROM_SNAP is not None:
            phys_current_task_file = os.path.join('./', RUN_FROM_SNAP,
                                                  'phys_current_task.pickle')
            if os.path.isfile(phys_current_task_file):
                self.phys_current_task = pickle.load(
                    open(phys_current_task_file, 'rb'))
            exec_addrs_file = os.path.join('./', RUN_FROM_SNAP,
                                           'exec_addrs.pickle')
            if os.path.isfile(exec_addrs_file):
                self.exec_addrs = pickle.load(open(exec_addrs_file, 'rb'))
        if self.phys_current_task is None:
            ''' address of current_task symbol, pointer at this address points to the current task record '''
            ''' use physical address because some are relative to FS segment '''
            if param.current_task_fs:
                cmd = 'logical-to-physical fs:0x%x' % param.current_task
            else:
                cmd = 'logical-to-physical 0x%x' % param.current_task
            try:
                self.phys_current_task = SIM_run_command(cmd)
            except:
                self.phys_current_task = 0
                self.lgr.debug(
                    'TaskUtils init failed to get phys addr of 0x%x' %
                    (param.current_task))
                return None
        self.lgr.debug('TaskUtils init with current_task of 0x%x, phys: 0x%x' %
                       (param.current_task, self.phys_current_task))
        self.syscall_numbers = syscallNumbers.SyscallNumbers(unistd, self.lgr)