From b76899f2bc7653a87cca791ad5dc6df3756f85b8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 28 Sep 2023 22:17:14 -0400 Subject: [PATCH] Undo broken extension-word DS assumption. 8 failures. --- InstructionSets/x86/Instruction.hpp | 3 -- OSBindings/Mac/Clock SignalTests/8088Tests.mm | 39 ++++++++++++------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/InstructionSets/x86/Instruction.hpp b/InstructionSets/x86/Instruction.hpp index 86a72eb8e..a50abc24d 100644 --- a/InstructionSets/x86/Instruction.hpp +++ b/InstructionSets/x86/Instruction.hpp @@ -906,9 +906,6 @@ template class Instruction { ++extension; } if(has_length_extension()) { - // As per the rule stated for segment(), this class provides ::DS for any instruction - // that doesn't have a segment override. - if(segment_override == Source::None) segment_override = Source::DS; extensions_[extension] = ImmediateT( (length << 6) | (int(repetition) << 4) | ((int(segment_override) & 7) << 1) | int(lock) ); diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index de3bd18c3..7ff618037 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -146,7 +146,7 @@ std::string to_string( - (NSArray *)testFiles { NSString *path = [NSString stringWithUTF8String:TestSuiteHome]; NSSet *allowList = [NSSet setWithArray:@[ - @"F6.7.json.gz", +// @"F6.7.json.gz", ]]; // Unofficial opcodes; ignored for now. @@ -286,7 +286,7 @@ std::string to_string( return [[NSString stringWithUTF8String:operation.c_str()] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; } -- (bool)applyDecodingTest:(NSDictionary *)test file:(NSString *)file { +- (bool)applyDecodingTest:(NSDictionary *)test file:(NSString *)file assert:(BOOL)assert { using Decoder = InstructionSet::x86::Decoder; Decoder decoder; @@ -306,15 +306,17 @@ std::string to_string( }; const auto decoded = decoder.decode(data.data(), data.size()); - XCTAssert( - decoded.first == [encoding count], - "Wrong length of instruction decoded for %@ — decoded %d rather than %lu from %@; file %@", - test[@"name"], - decoded.first, - (unsigned long)[encoding count], - hex_instruction(), - file - ); + if(assert) { + XCTAssert( + decoded.first == [encoding count], + "Wrong length of instruction decoded for %@ — decoded %d rather than %lu from %@; file %@", + test[@"name"], + decoded.first, + (unsigned long)[encoding count], + hex_instruction(), + file + ); + } if(decoded.first != [encoding count]) { return false; } @@ -365,7 +367,16 @@ std::string to_string( --adjustment; } - XCTAssert(isEqual, "%@ doesn't match %@ or similar, was %@ within %@", test[@"name"], [decodings anyObject], hex_instruction(), file); + if(assert) { + XCTAssert( + isEqual, + "%@ doesn't match %@ or similar, was %@ within %@", + test[@"name"], + [decodings anyObject], + hex_instruction(), + file + ); + } return isEqual; } @@ -380,11 +391,11 @@ std::string to_string( NSUInteger successes = 0; for(NSDictionary *test in testsInFile) { // A single failure per instruction is fine. - if(![self applyDecodingTest:test file:file]) { + if(![self applyDecodingTest:test file:file assert:YES]) { [failures addObject:file]; // Attempt a second decoding, to provide a debugger hook. - [self applyDecodingTest:test file:file]; + [self applyDecodingTest:test file:file assert:NO]; break; }