void exp0()

in src/CodeSetSize/CodeSetSize.cpp [34:64]


void exp0(const int memSize)
{
	auto buf = (char*)VirtualAlloc(nullptr, memSize, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
	if (!buf)
	{
		cerr << "Argh 0\n";
		return;
	}

	auto i = startSize;
	ErrorHistogram e;
	for (; i < memSize; i += stepSize)
	{
		memset(buf, 0x90, i);
		buf[i] = 0xc3;
		e.clear();
		bool success = false;
		for (int j = 0; j < nRetries; j++)
		{
			auto status = transaction(buf);
			success = status == _XBEGIN_STARTED;
			if (success) break;
			e[status]++;
			Sleep(0);
		}
		if (!success) break;
	}

	cout << "Max. bytes executed: " << i << "\n"
		<< "Abort reasons:\n" << e << "\n";
}