Exemplo n.º 1
0
Arquivo: rsp.py Projeto: chaosAD/pyrsp
 def refresh_regs(self):
     """ loads and caches values of the registers on the device """
     self.send('g')
     if self.arch['endian']:
         self.regs=dict(zip(self.registers,(switch_endian(reg) for reg in split_by_n(self.readpkt(),self.arch['bitsize']>>2))))
     else:
         self.regs=dict(zip(self.registers,split_by_n(self.readpkt(),self.arch['bitsize']>>2)))
Exemplo n.º 2
0
Arquivo: rsp.py Projeto: chaosAD/pyrsp
 def store(self, data, addr=None):
     """ stores data at addr if given otherwise at beginning of
         .text segment aka self.elf.workarea"""
     if addr==None:
         addr=self.elf.workarea
     for pkt in split_by_n(data, 400): # TODO should pktmaxsize, see todo in __init__
         pktlen = len(pkt)
         self.fetchOK('X%x,%x:%s' % (addr, pktlen, pkt))
         addr+=pktlen
Exemplo n.º 3
0
 def refresh_regs(self):
     """ loads and caches values of the registers on the device """
     self.send(b'g')
     enc_reg_blob = self.readpkt()
     reg_blob = rsp_decode(enc_reg_blob)
     raw_regs = split_by_n(reg_blob, self.arch['bitsize'] >> 2)
     if self.arch['endian']:
         raw_regs = iter(switch_endian(reg) for reg in raw_regs)
     self.regs = dict(zip(self.registers, raw_regs))
Exemplo n.º 4
0
Arquivo: rsp.py Projeto: stef/pyrsp
 def refresh_regs(self):
     """ loads and caches values of the registers on the device """
     self.send(b'g')
     enc_reg_blob = self.readpkt()
     reg_blob = rsp_decode(enc_reg_blob)
     raw_regs = split_by_n(reg_blob, self.arch['bitsize']>>2)
     if self.arch['endian']:
         raw_regs = iter(switch_endian(reg) for reg in raw_regs)
     self.regs = dict(zip(self.registers, raw_regs))
Exemplo n.º 5
0
Arquivo: rsp.py Projeto: stef/pyrsp
 def store(self, data, addr=None):
     """ stores data at addr if given otherwise at beginning of
         .text segment aka self.elf.workarea"""
     if addr==None:
         addr=self.elf.workarea
     for pkt in split_by_n(hexlify(data), int(self.feats[b'PacketSize'],16) - 20):
         pktlen = len(pkt)//2
         self.fetchOK(b'M%x,%x:%s' % (addr, pktlen, pkt))
         addr+=pktlen
Exemplo n.º 6
0
 def store(self, data, addr=None):
     """ stores data at addr if given otherwise at beginning of
         .text segment aka self.elf.workarea"""
     if addr == None:
         addr = self.elf.workarea
     for pkt in split_by_n(hexlify(data),
                           int(self.feats['PacketSize'], 16) - 20):
         pktlen = len(pkt) / 2
         self.fetchOK('M%x,%x:%s' % (addr, pktlen, pkt))
         addr += pktlen
Exemplo n.º 7
0
 def store(self, data, addr=None):
     """ stores data at addr if given otherwise at beginning of
         .text segment aka self.elf.workarea"""
     if addr == None:
         addr = self.elf.workarea
     for pkt in split_by_n(
             data, 400):  # TODO should pktmaxsize, see todo in __init__
         pktlen = len(pkt)
         self.fetchOK('X%x,%x:%s' % (addr, pktlen, pkt))
         addr += pktlen
Exemplo n.º 8
0
Arquivo: rsp.py Projeto: stef/pyrsp
    def refresh_regs(self):
        """ loads and caches values of the registers on the device """
        self.send(b'g')
        enc_reg_blob = self.readpkt()
        reg_blob = rsp_decode(enc_reg_blob)
        raw_regs = split_by_n(reg_blob, self.arch['bitsize'] >> 2)
        if self.arch['endian']:
            raw_regs = iter(switch_endian(reg) for reg in raw_regs)
        self.regs = dict(zip(self.registers, raw_regs))

        pktsz = len(enc_reg_blob) + 4  # 4 adds back the header and checksum
        if pktsz > self.maxsize_g_packet:
            self.maxsize_g_packet = pktsz