Example #1
0
 def cmd_rd(self, ui, args, n):
     """memory read command for n bits"""
     if util.wrong_argc(ui, args, (1, )):
         return
     adr = util.sex_arg(ui, args[0], self.cpu.width)
     if adr == None:
         return
     adr = util.align(adr, n)
     ui.put('[0x%08x] = ' % adr)
     ui.put('0x%%0%dx\n' % (n / 4) % self.cpu.rd(adr, n))
Example #2
0
File: mem.py Project: deadsy/pycs
 def cmd_rd(self, ui, args, n):
   """memory read command for n bits"""
   if util.wrong_argc(ui, args, (1,)):
     return
   adr = util.sex_arg(ui, args[0], self.cpu.width)
   if adr == None:
     return
   adr = util.align(adr, n)
   ui.put('[0x%08x] = ' % adr)
   ui.put('0x%%0%dx\n' % (n/4) % self.cpu.rd(adr, n))
Example #3
0
 def cmd_wr(self, ui, args, n):
     """memory write command for n bits"""
     if util.wrong_argc(ui, args, (1, 2)):
         return
     adr = util.sex_arg(ui, args[0], self.cpu.width)
     if adr == None:
         return
     adr = util.align(adr, n)
     val = 0
     if len(args) == 2:
         val = util.int_arg(ui, args[1], util.limit_32, 16)
         if val == None:
             return
     val = util.mask_val(val, n)
     self.cpu.wr(adr, val, n)
     ui.put('[0x%08x] = ' % adr)
     ui.put('0x%%0%dx\n' % (n / 4) % val)
Example #4
0
File: mem.py Project: deadsy/pycs
 def cmd_wr(self, ui, args, n):
   """memory write command for n bits"""
   if util.wrong_argc(ui, args, (1,2)):
     return
   adr = util.sex_arg(ui, args[0], self.cpu.width)
   if adr == None:
     return
   adr = util.align(adr, n)
   val = 0
   if len(args) == 2:
     val = util.int_arg(ui, args[1], util.limit_32, 16)
     if val == None:
       return
   val = util.mask_val(val, n)
   self.cpu.wr(adr, val, n)
   ui.put('[0x%08x] = ' % adr)
   ui.put('0x%%0%dx\n' % (n/4) % val)
Example #5
0
 def cmd_disassemble(self, ui, args):
   """disassemble memory"""
   if util.wrong_argc(ui, args, (0, 1, 2)):
     return
   n = 16
   if len(args) == 0:
     # read the pc
     self.halt()
     adr = self.dbgio.rdreg('pc')
   if len(args) >= 1:
     adr = util.sex_arg(ui, args[0], 32)
     if adr is None:
       return
   if len(args) == 2:
     n = util.int_arg(ui, args[1], (1, 2048), 16)
     if n is None:
       return
   # align the address to 32 bits
   adr = util.align(adr, 32)
   # disassemble
   md = iobuf.arm_disassemble(ui, adr)
   self.rdmem32(adr, n, md)