| Index: embios/trunk/tools/embios.py | 
| — | — | @@ -168,7 +168,10 @@ | 
| 169 | 169 | print "      <priority> the priority of the thread, from 1 to 255" | 
| 170 | 170 | print "      <state> the thread's initial state, valid are: 1 => ready, 0 => suspended" | 
| 171 | 171 | print "" | 
|  | 172 | +  print "  execimage <offset>" | 
|  | 173 | +  print "    Executes the emBIOS executable image at <offset>." | 
| 172 | 174 | print "" | 
|  | 175 | +  print "" | 
| 173 | 176 | print "  flushcaches" | 
| 174 | 177 | print "    Flushes the CPUs data and instruction caches." | 
| 175 | 178 | print "" | 
| — | — | @@ -338,7 +341,11 @@ | 
| 339 | 342 | if len(argv) != 9: usage() | 
| 340 | 343 | dev.createthread(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16), int(argv[6], 16), int(argv[7], 16), int(argv[8], 16)) | 
| 341 | 344 |  | 
|  | 345 | +  elif argv[1] == "execimage": | 
|  | 346 | +    if len(argv) != 3: usage | 
|  | 347 | +    dev.execimage(int(argv[2], 16)) | 
| 342 | 348 |  | 
|  | 349 | + | 
| 343 | 350 | elif argv[1] == "flushcaches": | 
| 344 | 351 | if len(argv) != 2: usage() | 
| 345 | 352 | dev.flushcaches() | 
| — | — | @@ -345,6 +352,5 @@ | 
| 346 | 353 |  | 
| 347 | 354 | else: usage() | 
| 348 | 355 |  | 
| 349 |  | -
 | 
| 350 | 356 | dev = libembios.embios() | 
| 351 | 357 | parsecommand(dev, sys.argv) | 
| Index: embios/trunk/tools/libembios.py | 
| — | — | @@ -380,7 +380,7 @@ | 
| 381 | 381 |  | 
| 382 | 382 |  | 
| 383 | 383 | def uploadfile(self, offset, file, usedma = 1, freezesched = 0, silent = 0): | 
| 384 |  | -    self.__myprint("Uploading %s to 0x%8x..." % (file, offset), silent)
 | 
|  | 384 | +    self.__myprint("Uploading %s to 0x%08x..." % (file, offset), silent) | 
| 385 | 385 | f = open(file, "rb") | 
| 386 | 386 |  | 
| 387 | 387 | while True: | 
| — | — | @@ -394,7 +394,7 @@ | 
| 395 | 395 |  | 
| 396 | 396 |  | 
| 397 | 397 | def downloadfile(self, offset, size, file, usedma = 1, freezesched = 0, silent = 0): | 
| 398 |  | -    self.__myprint("Downloading 0x%x bytes from 0x%8x to %s..." % (size, offset, file), silent)
 | 
|  | 398 | +    self.__myprint("Downloading 0x%x bytes from 0x%08x to %s..." % (size, offset, file), silent) | 
| 399 | 399 | f = open(file, "wb") | 
| 400 | 400 |  | 
| 401 | 401 | while True: | 
| — | — | @@ -410,15 +410,15 @@ | 
| 411 | 411 |  | 
| 412 | 412 |  | 
| 413 | 413 | def uploadint(self, offset, data, silent = 0): | 
| 414 |  | -    self.__myprint("Uploading 0x%8x to 0x%8x..." % (data, offset), silent)
 | 
|  | 414 | +    self.__myprint("Uploading 0x%08x to 0x%08x..." % (data, offset), silent) | 
| 415 | 415 | self.write(offset, data, 0, 0) | 
| 416 | 416 | self.__myprint(" done\n", silent) | 
| 417 | 417 |  | 
| 418 | 418 |  | 
| 419 | 419 | def downloadint(self, offset, silent = 0): | 
| 420 |  | -    self.__myprint("Downloading 0x%8x from 0x%8x..." % (data, offset), silent)
 | 
|  | 420 | +    self.__myprint("Downloading 0x%08x from 0x%08x..." % (data, offset), silent) | 
| 421 | 421 | data = self.read(offset, data, 0, 0) | 
| 422 |  | -    self.__myprint(" done\nValue was: 0x%8x\n" % (data), silent)
 | 
|  | 422 | +    self.__myprint(" done\nValue was: 0x%08x\n" % (data), silent) | 
| 423 | 423 |  | 
| 424 | 424 | return data | 
| 425 | 425 |  | 
| — | — | @@ -715,10 +715,10 @@ | 
| 716 | 716 |  | 
| 717 | 717 | def suspendthread(self, suspend, threadid, silent = 0): | 
| 718 | 718 | if (suspend): | 
| 719 |  | -      self.__myprint("Suspending thread 0x%8x...", silent) % threadid
 | 
|  | 719 | +      self.__myprint("Suspending thread 0x%08x..." % threadid, silent) | 
| 720 | 720 | suspend = 1 | 
| 721 | 721 | else: | 
| 722 |  | -      self.__myprint("Unsuspending thread 0x%8x...", silent) % threadid
 | 
|  | 722 | +      self.__myprint("Unsuspending thread 0x%08x..." % threadid, silent) | 
| 723 | 723 | suspend = 0 | 
| 724 | 724 |  | 
| 725 | 725 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 17, suspend, threadid, 0)) | 
| — | — | @@ -729,7 +729,7 @@ | 
| 730 | 730 |  | 
| 731 | 731 |  | 
| 732 | 732 | def killthread(self, threadid, silent = 0): | 
| 733 |  | -    self.__myprint("Killing thread 0x%8x...", silent) % threadid
 | 
|  | 733 | +    self.__myprint("Killing thread 0x%08x..." % threadid, silent) | 
| 734 | 734 |  | 
| 735 | 735 | self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 18, threadid, 0, 0)) | 
| 736 | 736 | response = self.__getbulk(self.handle, self.__cinep, 0x10) | 
| — | — | @@ -1002,8 +1002,8 @@ | 
| 1003 | 1003 | processinfoprint += "--------------------------------------------------------------------------------" | 
| 1004 | 1004 |  | 
| 1005 | 1005 | self.__myprint(" done\n\ | 
| 1006 |  | -                    Process information struct version: 0x%8x\n\
 | 
| 1007 |  | -                    Total size of process information table: 0x%8x\n\
 | 
|  | 1006 | +                    Process information struct version: 0x%08x\n\ | 
|  | 1007 | +                    Total size of process information table: 0x%08x\n\ | 
| 1008 | 1008 | %s" | 
| 1009 | 1009 | % (out[0], out[1], procinfoprint) | 
| 1010 | 1010 | , silent) | 
| — | — | @@ -1011,7 +1011,18 @@ | 
| 1012 | 1012 | return out | 
| 1013 | 1013 |  | 
| 1014 | 1014 |  | 
|  | 1015 | +  def execimage(self, offset): | 
|  | 1016 | +    self.__myprint("Executing emBIOS executable image at 0x%08x..." % offset, silent) | 
|  | 1017 | + | 
|  | 1018 | +    self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 18, threadid, 0, 0)) | 
|  | 1019 | +    response = self.__getbulk(self.handle, self.__cinep, 0x10) | 
|  | 1020 | +    self.__checkstatus(response) | 
| 1015 | 1021 |  | 
|  | 1022 | +    self.__myprint(" done\n    execimage() return code: 0x%08x\n" % struct.unpack("<I", response[4:8]), silent) | 
|  | 1023 | + | 
|  | 1024 | +    return struct.unpack("<I", response[4:8]) | 
|  | 1025 | + | 
|  | 1026 | + | 
| 1016 | 1027 | #===================================================================================== | 
| 1017 | 1028 |  | 
| 1018 | 1029 |  |