Browse Source

remove hacks and fix up logging cause it flipping works!!!!!!!!!!

pull/2858/head
JPikachu 4 months ago
committed by crueter
parent
commit
7442223b18
  1. 1
      src/core/hle/kernel/k_page_table_base.cpp
  2. 8
      src/core/hle/kernel/svc.cpp
  3. 27
      src/core/hle/kernel/svc/svc_process_memory.cpp

1
src/core/hle/kernel/k_page_table_base.cpp

@ -1292,7 +1292,6 @@ Result KPageTableBase::UnmapCodeMemory(KProcessAddress dst_address, KProcessAddr
KMemoryPermission::None, KMemoryAttribute::All,
KMemoryAttribute::Locked));
// WIP 2 step verification:
// Check one page to determine the state
KMemoryState dst_state;
size_t num_dst_allocator_blocks_first;

8
src/core/hle/kernel/svc.cpp

@ -1828,7 +1828,7 @@ static void SvcWrap_SetProcessMemoryPermission64From32(Core::System& system, std
uint64_t size{};
MemoryPermission perm{};
LOG_DEBUG(Kernel_SVC, "Raw args: [0]={:#x} [1]={:#x} [2]={:#x} [3]={:#x} [4]={:#x} [5]={:#x}",
LOG_DEBUG(Kernel_SVC, "Raw args, [0]={:#x} [1]={:#x} [2]={:#x} [3]={:#x} [4]={:#x} [5]={:#x}",
GetArg32(args, 0), GetArg32(args, 1), GetArg32(args, 2),
GetArg32(args, 3), GetArg32(args, 4), GetArg32(args, 5));
@ -1919,7 +1919,7 @@ static void SvcWrap_MapProcessCodeMemory64From32(Core::System& system, std::span
uint64_t src_address{};
uint64_t size{};
LOG_DEBUG(Kernel_SVC, "Raw args: [0]={:#x} [1]={:#x} [2]={:#x} [3]={:#x} [4]={:#x} [5]={:#x} [6]={:#x}",
LOG_DEBUG(Kernel_SVC, "Raw args, [0]={:#x} [1]={:#x} [2]={:#x} [3]={:#x} [4]={:#x} [5]={:#x} [6]={:#x}",
GetArg32(args, 0), GetArg32(args, 1), GetArg32(args, 2),
GetArg32(args, 3), GetArg32(args, 4), GetArg32(args, 5), GetArg32(args, 6));
@ -1950,7 +1950,7 @@ static void SvcWrap_UnmapProcessCodeMemory64From32(Core::System& system, std::sp
uint64_t src_address{};
uint64_t size{};
LOG_DEBUG(Kernel_SVC, "Raw args: [0]={:#x} [1]={:#x} [2]={:#x} [3]={:#x} [4]={:#x} [5]={:#x} [6]={:#x}",
LOG_DEBUG(Kernel_SVC, "Raw args, [0]={:#x} [1]={:#x} [2]={:#x} [3]={:#x} [4]={:#x} [5]={:#x} [6]={:#x}",
GetArg32(args, 0), GetArg32(args, 1), GetArg32(args, 2),
GetArg32(args, 3), GetArg32(args, 4), GetArg32(args, 5), GetArg32(args, 6));
@ -1968,7 +1968,7 @@ static void SvcWrap_UnmapProcessCodeMemory64From32(Core::System& system, std::sp
size_gather[1] = GetArg32(args, 6);
size = Convert<uint64_t>(size_gather);
LOG_DEBUG(Kernel_SVC, "Reconstructed: handle={:#x} dst={:#x} src={:#x} size={:#x}",
LOG_DEBUG(Kernel_SVC, "Reconstructed, handle={:#x} dst={:#x} src={:#x} size={:#x}",
process_handle, dst_address, src_address, size);
ret = UnmapProcessCodeMemory64From32(system, process_handle, dst_address, src_address, size);

27
src/core/hle/kernel/svc/svc_process_memory.cpp

@ -35,17 +35,10 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, u
"called, process_handle={:#X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}",
process_handle, address, size, perm);
// Workaround for Skyline 32-bit bug
if (size == 0) {
LOG_DEBUG(Kernel_SVC, "called. size=0, bypassing for now.");
R_RETURN(ResultSuccess);
}
// Validate the address/size.
R_UNLESS(Common::IsAligned(address, PageSize), ResultInvalidAddress);
R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize);
// Removed for the workaround, temp. (DO NOT MERGE)
// R_UNLESS(size > 0, ResultInvalidSize);
R_UNLESS(size > 0, ResultInvalidSize);
R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
R_UNLESS(address == static_cast<uint64_t>(address), ResultInvalidCurrentMemory);
R_UNLESS(size == static_cast<uint64_t>(size), ResultInvalidCurrentMemory);
@ -147,12 +140,6 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst
"src_address=0x{:016X}, size=0x{:016X}",
process_handle, dst_address, src_address, size);
// Workaround for Skyline 32Bit bug
if (size == 0) {
LOG_WARNING(Kernel_SVC, "called. size=0, bypassing for now.");
R_RETURN(ResultSuccess);
}
if (!Common::Is4KBAligned(src_address)) {
LOG_ERROR(Kernel_SVC, "src_address is not page-aligned (src_address=0x{:016X}).",
src_address);
@ -165,8 +152,7 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst
R_THROW(ResultInvalidAddress);
}
// "size == 0 ||" removed for the workaround, temp. (DO NOT MERGE)
if (!Common::Is4KBAligned(size)) {
if (size == 0 || !Common::Is4KBAligned(size)) {
LOG_ERROR(Kernel_SVC, "Size is zero or not page-aligned (size=0x{:016X})", size);
R_THROW(ResultInvalidSize);
}
@ -214,12 +200,6 @@ Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 d
"size=0x{:016X}",
process_handle, dst_address, src_address, size);
// Workaround for Skyline 32Bit bug
if (size == 0) {
LOG_WARNING(Kernel_SVC, "called. size=0, bypassing for now.");
R_RETURN(ResultSuccess);
}
if (!Common::Is4KBAligned(dst_address)) {
LOG_ERROR(Kernel_SVC, "dst_address is not page-aligned (dst_address=0x{:016X}).",
dst_address);
@ -232,8 +212,7 @@ Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 d
R_THROW(ResultInvalidAddress);
}
// "size == 0 ||" removed for the workaround, temp. (DO NOT MERGE)
if (!Common::Is4KBAligned(size)) {
if (size == 0 || !Common::Is4KBAligned(size)) {
LOG_ERROR(Kernel_SVC, "Size is zero or not page-aligned (size=0x{:016X}).", size);
R_THROW(ResultInvalidSize);
}

Loading…
Cancel
Save