mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-22 19:06:15 +08:00
3c500d2cf0
The Gen5 caller supplies a one-byte flag. Preserve pointer and memory-fault behavior while writing only that byte, and cover a seeded guest-memory boundary that rejects the former four-byte write.
30 lines
925 B
C#
30 lines
925 B
C#
// Copyright (C) 2026 SharpEmu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
using SharpEmu.HLE;
|
|
using SharpEmu.Libs.SystemService;
|
|
using Xunit;
|
|
|
|
namespace SharpEmu.Libs.Tests.SystemService;
|
|
|
|
public sealed class SystemServiceExportsTests
|
|
{
|
|
private const ulong MemoryBase = 0x1_0000_0000;
|
|
|
|
[Fact]
|
|
public void GetNoticeScreenSkipFlagWritesOneByteAtMemoryBoundary()
|
|
{
|
|
var memory = new FakeCpuMemory(MemoryBase, 1);
|
|
var context = new CpuContext(memory, Generation.Gen5);
|
|
Assert.True(memory.TryWrite(MemoryBase, new byte[] { 0xA5 }));
|
|
context[CpuRegister.Rdi] = MemoryBase;
|
|
|
|
Assert.Equal(0, SystemServiceExports.SystemServiceGetNoticeScreenSkipFlag(context));
|
|
Assert.Equal(0UL, context[CpuRegister.Rax]);
|
|
|
|
Span<byte> flag = stackalloc byte[1];
|
|
Assert.True(memory.TryRead(MemoryBase, flag));
|
|
Assert.Equal(0, flag[0]);
|
|
}
|
|
}
|