Sync source edition with VCC Plus 3.7.0 build 63
This commit is contained in:
1 parent
c652a5276d
commit
b2ecec4d87
86 files changed
+10519
-472
No files matched your search
@@ -264,6 +264,130 @@ void checkBankedDevelopment(Processor processor) {
|
||||
machine.debuggerClearDevelopmentBreakpoints();
|
||||
require(!machine.snapshot().debuggerBankedDevelopment, "Explicit detach clears bank-qualified mode");
|
||||
}
|
||||
void checkPhysicalOverlayDevelopment(Processor processor) {
|
||||
const Bytes a{0x12,0x86,0x11,0xb7,0x50,0x00,0x7e,0x11,0x00};
|
||||
const Bytes b{0x12,0x86,0x22,0xb7,0x50,0x00,0x7e,0x12,0x00};
|
||||
auto loader = [](unsigned source, unsigned count) -> Bytes {
|
||||
// LDX #$4000; LDY #source; LDB #count;
|
||||
// loop: LDA ,Y+; STA ,X+; DECB; BNE loop; JMP $4000.
|
||||
return {0x8e,0x40,0x00,0x10,0x8e,std::uint8_t(source>>8),std::uint8_t(source),0xc6,std::uint8_t(count),
|
||||
0xa6,0xa0,0xa7,0x80,0x5a,0x26,0xf9,0x7e,0x40,0x00};
|
||||
};
|
||||
const auto loadA = loader(0x2000, unsigned(a.size()));
|
||||
const auto loadB = loader(0x2100, unsigned(b.size()));
|
||||
auto modules = [&] {
|
||||
return std::vector<DebugBankedModule>{
|
||||
{"a",{{2,2}},{{0x4000,a}},std::nullopt,"game","A"},
|
||||
{"b",{{2,2}},{{0x4000,b}},std::nullopt,"game","B"},
|
||||
{"loader",{{0,0}},{{0x1000,loadA},{0x1100,loadB},{0x1200,loadA}}}
|
||||
};
|
||||
};
|
||||
auto load = [&](MachineSession& machine, const Bytes& next, unsigned count) {
|
||||
machine.loadDiagnostic(processor);
|
||||
MmuSetMapType(1); Set_MmuEnabled(1);
|
||||
for (unsigned page=0;page<8;++page) SetMmuRegister(page,page);
|
||||
Bytes image;
|
||||
block(image,0x1000,loadA); block(image,0x1100,loader(0x2100,count)); block(image,0x1200,loadA);
|
||||
block(image,0x2000,a); block(image,0x2100,next); block(image,0x4800,{0xaa});
|
||||
finish(image,0x1000); machine.debuggerLoadBinary(image,0x1000);
|
||||
};
|
||||
auto run = [](MachineSession& machine) {
|
||||
machine.resume();
|
||||
for (unsigned n=0;n<10 && machine.snapshot().state==RunState::Running;++n) machine.advance();
|
||||
require(machine.snapshot().state==RunState::Paused && machine.snapshot().cpu.PC==0x4000,
|
||||
"Guest overlay loader reaches its qualified or independent manual entry stop");
|
||||
};
|
||||
{
|
||||
MachineSession machine; load(machine,b,unsigned(b.size()));
|
||||
const auto evidence = modules();
|
||||
machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},evidence);
|
||||
run(machine); const auto first=machine.snapshot();
|
||||
require(first.debuggerDevelopmentAttached && first.debuggerResidencyFingerprint!=0 && MemRead8(0x4002)==0x11,
|
||||
"Actual guest stores install owner A in declared shared physical RAM on both CPUs");
|
||||
run(machine); const auto second=machine.snapshot();
|
||||
require(second.debuggerDevelopmentAttached && second.debuggerResidencyFingerprint!=first.debuggerResidencyFingerprint && MemRead8(0x4002)==0x22 &&
|
||||
second.debuggerMappingFingerprint==first.debuggerMappingFingerprint && second.debuggerProgramRevision==first.debuggerProgramRevision,
|
||||
"Replacing shared physical code changes residency without a mapping or host program epoch change");
|
||||
run(machine); const auto third=machine.snapshot();
|
||||
require(third.debuggerDevelopmentAttached && third.debuggerResidencyFingerprint==first.debuggerResidencyFingerprint && MemRead8(0x4002)==0x11,
|
||||
"Actual guest A-to-B-to-A copies reestablish current byte ownership rather than a cached last owner");
|
||||
machine.debuggerArmBankedDevelopmentBreakpoints({},evidence);
|
||||
const std::vector<DebugSourceInstruction> steps{{0x4000,10,{0x12},"a"},{0x4000,20,{0x12},"b"}};
|
||||
rejects([&] { machine.debuggerStepSource(SourceStepMode::Into,steps,third.generation,third.debuggerProgramRevision,
|
||||
third.debuggerMappingFingerprint,third.cpu.PC,1000000,600,second.debuggerResidencyFingerprint); });
|
||||
machine.debuggerStepSource(SourceStepMode::Into,steps,third.generation,third.debuggerProgramRevision,
|
||||
third.debuggerMappingFingerprint,third.cpu.PC,1000000,600,third.debuggerResidencyFingerprint);
|
||||
machine.advance();
|
||||
require(machine.snapshot().state==RunState::Paused && machine.snapshot().cpu.PC==0x4000 && MemRead8(0x4002)==0x22 &&
|
||||
machine.snapshot().debuggerDevelopmentAttached && machine.debuggerSnapshot().stopReason=="C source location reached",
|
||||
"C stepping crosses an executing physical-overlay copy and identifies the newly resident owner despite identical entry opcodes");
|
||||
auto qualified=evidence; qualified[0].breakpointAddresses=std::vector<std::uint16_t>{0x4000}; qualified[1].breakpointAddresses=std::vector<std::uint16_t>{};
|
||||
machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},qualified);
|
||||
run(machine);
|
||||
require(MemRead8(0x4002)==0x11 && machine.snapshot().debuggerDevelopmentAttached,
|
||||
"An owner A breakpoint ignores B at the same physical and logical entry");
|
||||
auto invalid=evidence; invalid[1].overlayOwner="A";
|
||||
rejects([&] { machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},invalid); });
|
||||
invalid=evidence; invalid[1].overlayGroup="other";
|
||||
rejects([&] { machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},invalid); });
|
||||
invalid=evidence; invalid[1].overlayGroup.clear(); invalid[1].overlayOwner.clear();
|
||||
rejects([&] { machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},invalid); });
|
||||
for (unsigned boundary=0;boundary<4;++boundary) {
|
||||
invalid=evidence;
|
||||
if (boundary==0) { invalid[0].overlayGroup+='\0'; invalid[1].overlayGroup+='\0'; }
|
||||
if (boundary==1) invalid[0].overlayOwner+='\0';
|
||||
if (boundary==2) { invalid[0].overlayGroup=std::string(129,'g'); invalid[1].overlayGroup=invalid[0].overlayGroup; }
|
||||
if (boundary==3) invalid[0].overlayOwner=std::string(129,'o');
|
||||
rejects([&] { machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},invalid); });
|
||||
}
|
||||
std::vector<DebugBankedModule> manyGroups;
|
||||
for (unsigned group=0;group<65;++group) for (unsigned owner=0;owner<2;++owner) {
|
||||
const auto id=std::to_string(group);
|
||||
manyGroups.push_back({id+"-"+std::to_string(owner),{{1,1}},{{std::uint16_t(0x2000+group),{std::uint8_t(0x12+owner)}}},
|
||||
std::nullopt,"group-"+id,owner ? "B" : "A"});
|
||||
}
|
||||
rejects([&] { machine.debuggerArmBankedDevelopmentBreakpoints({},manyGroups); });
|
||||
require(machine.snapshot().debuggerDevelopmentAttached && machine.snapshot().debuggerResidencyFingerprint==first.debuggerResidencyFingerprint,
|
||||
"Rejected alias declarations preserve the existing verified overlay attachment");
|
||||
manyGroups.pop_back(); manyGroups.pop_back();
|
||||
machine.debuggerArmBankedDevelopmentBreakpoints({},manyGroups);
|
||||
require(machine.snapshot().debuggerResidencyFingerprint!=0,
|
||||
"Exactly 64 declared physical-code overlay groups remain within the supported contract");
|
||||
}
|
||||
// All modifications below are executed by the guest loader, never debugger
|
||||
// writes, register edits or host copies into a running program's RAM.
|
||||
for (unsigned scenario=0;scenario<4;++scenario) {
|
||||
MachineSession machine;
|
||||
auto payload=b; if (scenario==1) payload[4]=0x51;
|
||||
const unsigned count=scenario==0 ? 3 : unsigned(payload.size());
|
||||
load(machine,payload,count);
|
||||
auto evidence=modules(); evidence[2].guards[1].bytes=loader(0x2100,count);
|
||||
if (scenario==2) evidence[1].guards=evidence[0].guards; // Two owners fit the same complete code.
|
||||
if (scenario==3) {
|
||||
evidence.push_back({"a-helper",{{2,2}},{{0x4800,{0xaa}}},std::vector<std::uint16_t>{},"game","A"});
|
||||
evidence.push_back({"b-helper",{{2,2}},{{0x4800,{0xbb}}},std::vector<std::uint16_t>{},"game","B"});
|
||||
}
|
||||
machine.debuggerSetBreakpoints({0x4000}); // Independent manual point must survive source refusal.
|
||||
machine.debuggerArmBankedDevelopmentBreakpoints({0x4000},evidence);
|
||||
run(machine);
|
||||
if (scenario==2) {
|
||||
require(!machine.snapshot().debuggerDevelopmentAttached,
|
||||
"Multiple complete matching owners make physical overlay identity ambiguous, never first-match selected");
|
||||
} else {
|
||||
const auto before=machine.snapshot(); require(before.debuggerDevelopmentAttached,"Owner A is initially verified");
|
||||
run(machine); const auto after=machine.snapshot();
|
||||
require(!after.debuggerDevelopmentAttached && after.debuggerResidencyFingerprint!=before.debuggerResidencyFingerprint &&
|
||||
after.debuggerMappingFingerprint==before.debuggerMappingFingerprint,
|
||||
"Partial, corrupt or incompletely installed multi-module owners invalidate source attachment after actual guest stores");
|
||||
const std::vector<DebugSourceInstruction> steps{{0x4000,10,{0x12},"a"},{0x4000,20,{0x12},"b"}};
|
||||
rejects([&] { machine.debuggerStepSource(SourceStepMode::Into,steps,after.generation,after.debuggerProgramRevision,
|
||||
after.debuggerMappingFingerprint,after.cpu.PC,1000000,600,after.debuggerResidencyFingerprint); });
|
||||
}
|
||||
machine.debuggerClearDevelopmentBreakpoints();
|
||||
require(machine.debuggerSnapshot().breakpoints==std::vector<std::uint16_t>{0x4000},
|
||||
"Detaching physical-overlay evidence preserves the independent manual breakpoint");
|
||||
}
|
||||
}
|
||||
void checkAssemblyInstructionBoundary(Processor processor) {
|
||||
MachineSession machine;
|
||||
machine.loadDiagnostic(processor);
|
||||
@@ -392,6 +516,8 @@ void CheckBinaryMappedWrites() {
|
||||
checkCurrentGimeCanvases(Processor::HD6309);
|
||||
checkBankedDevelopment(Processor::MC6809);
|
||||
checkBankedDevelopment(Processor::HD6309);
|
||||
checkPhysicalOverlayDevelopment(Processor::MC6809);
|
||||
checkPhysicalOverlayDevelopment(Processor::HD6309);
|
||||
checkAssemblyInstructionBoundary(Processor::MC6809);
|
||||
checkAssemblyInstructionBoundary(Processor::HD6309);
|
||||
for (auto cpu : {Processor::MC6809, Processor::HD6309}) {
|
||||
|
||||
Reference in new issue
Block a user