diff options
author | Ryan Long <ryan.long@oarcorp.com> | 2021-10-20 10:11:34 -0400 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-12-10 11:05:16 -0600 |
commit | 361e30450c5a6c8c3c18bac041ac1afc15f76d02 (patch) | |
tree | 0ed34757e7453aa74a80d01a56697630128827ac /tester/covoar/Target_i386.cc | |
parent | TargetFactory.cc: Convert to C++ (diff) | |
download | rtems-tools-361e30450c5a6c8c3c18bac041ac1afc15f76d02.tar.bz2 |
Target: Convert to C++
Diffstat (limited to 'tester/covoar/Target_i386.cc')
-rw-r--r-- | tester/covoar/Target_i386.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tester/covoar/Target_i386.cc b/tester/covoar/Target_i386.cc index 2990273..cb8e64d 100644 --- a/tester/covoar/Target_i386.cc +++ b/tester/covoar/Target_i386.cc @@ -57,39 +57,41 @@ namespace Target { } bool Target_i386::isNopLine( - const char* const line, - int& size + const std::string& line, + int& size ) { - if (!strcmp( &line[strlen(line)-3], "nop")) { + size_t stringLen = line.length(); + + if ( line.substr( stringLen - 3 ) == "nop" ) { size = 1; return true; } // i386 has some two and three byte nops - if (!strncmp( &line[strlen(line)-14], "xchg %ax,%ax", 14)) { + if ( line.substr( stringLen - 14 ) == "xchg %ax,%ax" ) { size = 2; return true; } - if (!strncmp( &line[strlen(line)-16], "xor %eax,%eax", 16)) { + if ( line.substr( stringLen - 16 ) == "xor %eax,%eax" ) { size = 2; return true; } - if (!strncmp( &line[strlen(line)-16], "xor %ebx,%ebx", 16)) { + if ( line.substr( stringLen - 16 ) == "xor %ebx,%ebx" ) { size = 2; return true; } - if (!strncmp( &line[strlen(line)-16], "xor %esi,%esi", 16)) { + if ( line.substr( stringLen - 16 ) == "xor %esi,%esi" ) { size = 2; return true; } - if (!strncmp( &line[strlen(line)-21], "lea 0x0(%esi),%esi", 21)) { + if ( line.substr( stringLen - 21 ) == "lea 0x0(%esi),%esi" ) { size = 3; return true; } - if (!strncmp( &line[strlen(line)-28], "lea 0x0(%esi,%eiz,1),%esi", 28)) { + if ( line.substr( stringLen - 28 ) == "lea 0x0(%esi,%eiz,1),%esi" ) { // Could be 4 or 7 bytes of padding. - if (!strncmp( &line[strlen(line)-32], "00", 2)) { + if ( line.substr( stringLen - 32, 2 ) == "00" ) { size = 7; } else { size = 4; |