MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / testLockedInc

Function testLockedInc

source/test/testCPU.cpp:11046–11070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11044}
11045
11046void testLockedInc(U32 address) {
11047 const U32 numberOfThreads = 10;
11048 const U32 numberOfIterationsPerThread = 1000000;
11049
11050 memory->writed(cpu->seg[DS].address + address, 0);
11051
11052 // inc memory
11053 newInstructionWithRM(0xff, 5, 0, 0xf0);
11054 pushCode32(address);
11055
11056 // loop
11057 pushCode8(0xe2);
11058 pushCode8((U8)(S8)(-9)); // jump amount if ecx is not 0
11059
11060 setupForThread();
11061 std::vector<KThread*> threads;
11062 for (U32 i = 0; i < numberOfThreads; i++) {
11063 threads.push_back(doLockedIncThread(numberOfIterationsPerThread));
11064 }
11065 for (U32 i = 0; i < numberOfThreads; i++) {
11066 joinThread(threads[i]);
11067 }
11068 U32 value = memory->readd(cpu->seg[DS].address + address);
11069 assertTrue(value == numberOfIterationsPerThread * numberOfThreads);
11070}
11071
11072void testLockedInc() {
11073 testLockedInc(0xc8); // aligned 8

Callers

nothing calls this directly

Calls 10

newInstructionWithRMFunction · 0.85
pushCode32Function · 0.85
pushCode8Function · 0.85
setupForThreadFunction · 0.85
doLockedIncThreadFunction · 0.85
joinThreadFunction · 0.85
assertTrueFunction · 0.85
writedMethod · 0.45
push_backMethod · 0.45
readdMethod · 0.45

Tested by

no test coverage detected