diff options
| author | Mary <mary@mary.zone> | 2023-06-14 18:02:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-14 18:02:41 +0200 |
| commit | 6f28c4abadfead6fb5146caa5775dba1641bd79f (patch) | |
| tree | 921d19035ddf57f31aa9cfa78a81699848169a36 /src/Ryujinx.Tests/Cpu/CpuTest32.cs | |
| parent | 105c9712c1cf8400b3ff34c3a69a8af81ee4431e (diff) | |
test: Make tests runnable on system without 4KiB page size (#5184)
* ARMeilleure: Do not hardcode 4KiB page size in JitCache
* test: Do not hardcode page size to 4KiB for Ryujinx.Tests.Memory.Tests
Fix running tests on Asahi Linux with 16KiB pages.
* test: Do not hardcode page size to 4KiB for Ryujinx.Tests.Cpu
Fix running tests on Asahi Linux.
Test runner still crash when trying to run all test suite.
* test: Do not hardcode page size to 4KiB for Ryujinx.Tests.Cpu
Fix somecrashes on Asahi Linux.
* test: Ignore Vshl test on ARM64 due to unicorn crashes
* test: Workaround hardcoded size on some tests
Change mapping of code and data in case of non 4KiB configuration.
* test: Make CpuTestT32Flow depends on code address
Fix failure with different page size.
* test: Disable CpuTestThumb.TestRandomTestCases when page size isn't 4KiB
The test data needs to be reevaluated to take different page size into account.
* Address gdkchan's comments
Diffstat (limited to 'src/Ryujinx.Tests/Cpu/CpuTest32.cs')
| -rw-r--r-- | src/Ryujinx.Tests/Cpu/CpuTest32.cs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/Ryujinx.Tests/Cpu/CpuTest32.cs b/src/Ryujinx.Tests/Cpu/CpuTest32.cs index 47dc9f8a..a1f6431c 100644 --- a/src/Ryujinx.Tests/Cpu/CpuTest32.cs +++ b/src/Ryujinx.Tests/Cpu/CpuTest32.cs @@ -13,9 +13,9 @@ namespace Ryujinx.Tests.Cpu [TestFixture] public class CpuTest32 { - protected const uint Size = 0x1000; - protected const uint CodeBaseAddress = 0x1000; - protected const uint DataBaseAddress = CodeBaseAddress + Size; + protected static readonly uint Size = (uint)MemoryBlock.GetPageSize(); + protected static uint CodeBaseAddress = Size; + protected static uint DataBaseAddress = CodeBaseAddress + Size; private uint _currAddress; @@ -33,12 +33,24 @@ namespace Ryujinx.Tests.Cpu [SetUp] public void Setup() { - _currAddress = CodeBaseAddress; + int pageBits = (int)ulong.Log2(Size); _ram = new MemoryBlock(Size * 2); - _memory = new MemoryManager(_ram, 1ul << 16); + _memory = new MemoryManager(_ram, 1ul << (pageBits + 4)); _memory.IncrementReferenceCount(); - _memory.Map(CodeBaseAddress, 0, Size * 2, MemoryMapFlags.Private); + + // Some tests depends on hardcoded address that were computed for 4KiB. + // We change the layout on non 4KiB platforms to keep compat here. + if (Size > 0x1000) + { + DataBaseAddress = 0; + CodeBaseAddress = Size; + } + + _currAddress = CodeBaseAddress; + + _memory.Map(CodeBaseAddress, 0, Size, MemoryMapFlags.Private); + _memory.Map(DataBaseAddress, Size, Size, MemoryMapFlags.Private); _context = CpuContext.CreateExecutionContext(); _context.IsAarch32 = true; |
