Index: embios/trunk/tools/libembios.py |
— | — | @@ -498,7 +498,7 @@ |
499 | 499 | response = self.__getbulk(self.handle, self.__cinep, blocklen + 0x10)
|
500 | 500 | self.__checkstatus(response)
|
501 | 501 |
|
502 | | - readbytes, buffersize, bytesleft = struct.unpack("<III", response[4:])
|
| 502 | + readbytes, buffersize, bytesleft = struct.unpack("<III", response[4:16])
|
503 | 503 | out_data += response[0x10:0x10+readbytes]
|
504 | 504 | size -= blocklen
|
505 | 505 |
|
— | — | @@ -565,7 +565,7 @@ |
566 | 566 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
567 | 567 | self.__checkstatus(response)
|
568 | 568 |
|
569 | | - sendbytes = struct.unpack("<I", response[4:])[0]
|
| 569 | + sendbytes = struct.unpack("<I", response[4:8])[0]
|
570 | 570 | if sendbytes < blocklen: # not everything has been written, need to resent some stuff but wait a bit before doing so
|
571 | 571 | time.sleep(0.1)
|
572 | 572 | timeoutcounter += 1
|
— | — | @@ -617,7 +617,7 @@ |
618 | 618 | response = self.__getbulk(self.handle, self.__cinep, blocklen + 0x10)
|
619 | 619 | self.__checkstatus(response)
|
620 | 620 |
|
621 | | - readbytes = struct.unpack("<III", response[4:])[0]
|
| 621 | + readbytes = struct.unpack("<III", response[4:8])[0]
|
622 | 622 | out_data += response[0x10:0x10+readbytes]
|
623 | 623 | size -= blocklen
|
624 | 624 |
|
— | — | @@ -770,39 +770,39 @@ |
771 | 771 | while ptr < len(processinfo):
|
772 | 772 | retval.append({})
|
773 | 773 |
|
774 | | - retval[process_n]['regs'] = struct.unpack("<IIIIIIIIIIIIIIII", processinfo[ptr:])
|
| 774 | + retval[process_n]['regs'] = struct.unpack("<IIIIIIIIIIIIIIII", processinfo[ptr:ptr+64])
|
775 | 775 | ptr += 16 * 0x4
|
776 | | - retval[process_n]['cpsr'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 776 | + retval[process_n]['cpsr'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
777 | 777 | ptr += 1 * 0x4
|
778 | | - retval[process_n]['state'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 778 | + retval[process_n]['state'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
779 | 779 | ptr += 1 * 0x4
|
780 | | - retval[process_n]['name_ptr'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 780 | + retval[process_n]['name_ptr'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
781 | 781 | ptr += 1 * 0x4
|
782 | | - retval[process_n]['cputime_current'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 782 | + retval[process_n]['cputime_current'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
783 | 783 | ptr += 1 * 0x4
|
784 | | - retval[process_n]['cputime_total'] = struct.unpack("<Q", processinfo[ptr:])[0]
|
| 784 | + retval[process_n]['cputime_total'] = struct.unpack("<Q", processinfo[ptr:ptr+8])[0]
|
785 | 785 | ptr += 1 * 0x8
|
786 | | - retval[process_n]['startusec'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 786 | + retval[process_n]['startusec'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
787 | 787 | ptr += 1 * 0x4
|
788 | | - retval[process_n]['queue_next_ptr'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 788 | + retval[process_n]['queue_next_ptr'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
789 | 789 | ptr += 1 * 0x4
|
790 | | - retval[process_n]['timeout'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 790 | + retval[process_n]['timeout'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
791 | 791 | ptr += 1 * 0x4
|
792 | | - retval[process_n]['blocked_since'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 792 | + retval[process_n]['blocked_since'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
793 | 793 | ptr += 1 * 0x4
|
794 | | - retval[process_n]['blocked_by_ptr'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 794 | + retval[process_n]['blocked_by_ptr'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
795 | 795 | ptr += 1 * 0x4
|
796 | | - retval[process_n]['stack_ptr'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 796 | + retval[process_n]['stack_ptr'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
797 | 797 | ptr += 1 * 0x4
|
798 | | - retval[process_n]['err_no'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 798 | + retval[process_n]['err_no'] = struct.unpack("<I", processinfo[ptr:ptr+4])[0]
|
799 | 799 | ptr += 1 * 0x4
|
800 | | - retval[process_n]['block_type'] = struct.unpack("<B", processinfo[ptr:])[0]
|
| 800 | + retval[process_n]['block_type'] = struct.unpack("<B", processinfo[ptr:ptr+1])[0]
|
801 | 801 | ptr += 1 * 0x1
|
802 | | - retval[process_n]['thread_type'] = struct.unpack("<B", processinfo[ptr:])[0]
|
| 802 | + retval[process_n]['thread_type'] = struct.unpack("<B", processinfo[ptr:ptr+1])[0]
|
803 | 803 | ptr += 1 * 0x1
|
804 | | - retval[process_n]['priority'] = struct.unpack("<B", processinfo[ptr:])[0]
|
| 804 | + retval[process_n]['priority'] = struct.unpack("<B", processinfo[ptr:ptr+1])[0]
|
805 | 805 | ptr += 1 * 0x1
|
806 | | - retval[process_n]['cpuload'] = struct.unpack("<B", processinfo[ptr:])[0]
|
| 806 | + retval[process_n]['cpuload'] = struct.unpack("<B", processinfo[ptr:ptr+1])[0]
|
807 | 807 | ptr += 1 * 0x1
|
808 | 808 |
|
809 | 809 | process_n += 1
|
— | — | @@ -864,12 +864,12 @@ |
865 | 865 | response = self.__getbulk(self.handle, self.__cinep, blocklen + 0x10)
|
866 | 866 | self.__checkstatus(response)
|
867 | 867 |
|
868 | | - size = struct.unpack("<I", response[8:])[0]
|
| 868 | + size = struct.unpack("<I", response[8:12])[0]
|
869 | 869 |
|
870 | 870 | if size <= offset + blocklen:
|
871 | 871 | procinfo += response[0x10:0x10 + size]
|
872 | | - structversion = struct.unpack("<I", response[4:])[0]
|
873 | | - tablesize = struct.unpack("<I", response[8:])[0]
|
| 872 | + structversion = struct.unpack("<I", response[4:8])[0]
|
| 873 | + tablesize = struct.unpack("<I", response[8:12])[0]
|
874 | 874 | break
|
875 | 875 | else:
|
876 | 876 | procinfo += response[0x10:0x10 + blocklen]
|
— | — | @@ -901,9 +901,9 @@ |
902 | 902 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
903 | 903 | self.__checkstatus(response)
|
904 | 904 |
|
905 | | - self.__myprint(" done\n execimage() return code: 0x%08x\n" % struct.unpack("<I", response[4:])[0], silent)
|
| 905 | + self.__myprint(" done\n execimage() return code: 0x%08x\n" % struct.unpack("<I", response[4:8])[0], silent)
|
906 | 906 |
|
907 | | - return struct.unpack("<I", response[4:])[0]
|
| 907 | + return struct.unpack("<I", response[4:8])[0]
|
908 | 908 |
|
909 | 909 |
|
910 | 910 | #=====================================================================================
|