summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-07-15 03:58:20 +0200
committerLiam <byteslice@airmail.cc>2023-07-15 04:33:10 +0200
commit474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd (patch)
tree288901313abc231a71faf3a95b24eabbca3a04d0 /src/core/hle/kernel/svc
parentk_process: PageTable -> GetPageTable (diff)
downloadyuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.tar
yuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.tar.gz
yuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.tar.bz2
yuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.tar.lz
yuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.tar.xz
yuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.tar.zst
yuzu-474db2d8dafebffc9a16dd3c9d1d21a63fdbeddd.zip
Diffstat (limited to 'src/core/hle/kernel/svc')
-rw-r--r--src/core/hle/kernel/svc/svc_memory.cpp25
-rw-r--r--src/core/hle/kernel/svc/svc_physical_memory.cpp8
-rw-r--r--src/core/hle/kernel/svc/svc_process.cpp4
-rw-r--r--src/core/hle/kernel/svc/svc_process_memory.cpp20
-rw-r--r--src/core/hle/kernel/svc/svc_thread.cpp2
5 files changed, 10 insertions, 49 deletions
diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp
index bcf3d0d2b..2cab74127 100644
--- a/src/core/hle/kernel/svc/svc_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_memory.cpp
@@ -63,36 +63,13 @@ Result MapUnmapMemorySanityChecks(const KPageTable& manager, u64 dst_addr, u64 s
R_THROW(ResultInvalidCurrentMemory);
}
- if (!manager.IsInsideAddressSpace(src_addr, size)) {
+ if (!manager.Contains(src_addr, size)) {
LOG_ERROR(Kernel_SVC,
"Source is not within the address space, addr=0x{:016X}, size=0x{:016X}",
src_addr, size);
R_THROW(ResultInvalidCurrentMemory);
}
- if (manager.IsOutsideStackRegion(dst_addr, size)) {
- LOG_ERROR(Kernel_SVC,
- "Destination is not within the stack region, addr=0x{:016X}, size=0x{:016X}",
- dst_addr, size);
- R_THROW(ResultInvalidMemoryRegion);
- }
-
- if (manager.IsInsideHeapRegion(dst_addr, size)) {
- LOG_ERROR(Kernel_SVC,
- "Destination does not fit within the heap region, addr=0x{:016X}, "
- "size=0x{:016X}",
- dst_addr, size);
- R_THROW(ResultInvalidMemoryRegion);
- }
-
- if (manager.IsInsideAliasRegion(dst_addr, size)) {
- LOG_ERROR(Kernel_SVC,
- "Destination does not fit within the map region, addr=0x{:016X}, "
- "size=0x{:016X}",
- dst_addr, size);
- R_THROW(ResultInvalidMemoryRegion);
- }
-
R_SUCCEED();
}
diff --git a/src/core/hle/kernel/svc/svc_physical_memory.cpp b/src/core/hle/kernel/svc/svc_physical_memory.cpp
index 56643c75c..d3545f232 100644
--- a/src/core/hle/kernel/svc/svc_physical_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_physical_memory.cpp
@@ -51,14 +51,14 @@ Result MapPhysicalMemory(Core::System& system, u64 addr, u64 size) {
R_THROW(ResultInvalidState);
}
- if (!page_table.IsInsideAddressSpace(addr, size)) {
+ if (!page_table.Contains(addr, size)) {
LOG_ERROR(Kernel_SVC,
"Address is not within the address space, addr=0x{:016X}, size=0x{:016X}", addr,
size);
R_THROW(ResultInvalidMemoryRegion);
}
- if (page_table.IsOutsideAliasRegion(addr, size)) {
+ if (!page_table.IsInAliasRegion(addr, size)) {
LOG_ERROR(Kernel_SVC,
"Address is not within the alias region, addr=0x{:016X}, size=0x{:016X}", addr,
size);
@@ -100,14 +100,14 @@ Result UnmapPhysicalMemory(Core::System& system, u64 addr, u64 size) {
R_THROW(ResultInvalidState);
}
- if (!page_table.IsInsideAddressSpace(addr, size)) {
+ if (!page_table.Contains(addr, size)) {
LOG_ERROR(Kernel_SVC,
"Address is not within the address space, addr=0x{:016X}, size=0x{:016X}", addr,
size);
R_THROW(ResultInvalidMemoryRegion);
}
- if (page_table.IsOutsideAliasRegion(addr, size)) {
+ if (!page_table.IsInAliasRegion(addr, size)) {
LOG_ERROR(Kernel_SVC,
"Address is not within the alias region, addr=0x{:016X}, size=0x{:016X}", addr,
size);
diff --git a/src/core/hle/kernel/svc/svc_process.cpp b/src/core/hle/kernel/svc/svc_process.cpp
index 4b438fe52..caa8bee9a 100644
--- a/src/core/hle/kernel/svc/svc_process.cpp
+++ b/src/core/hle/kernel/svc/svc_process.cpp
@@ -66,8 +66,8 @@ Result GetProcessList(Core::System& system, s32* out_num_processes, u64 out_proc
auto& kernel = system.Kernel();
const auto total_copy_size = out_process_ids_size * sizeof(u64);
- if (out_process_ids_size > 0 && !GetCurrentProcess(kernel).GetPageTable().IsInsideAddressSpace(
- out_process_ids, total_copy_size)) {
+ if (out_process_ids_size > 0 &&
+ !GetCurrentProcess(kernel).GetPageTable().Contains(out_process_ids, total_copy_size)) {
LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}",
out_process_ids, out_process_ids + total_copy_size);
R_THROW(ResultInvalidCurrentMemory);
diff --git a/src/core/hle/kernel/svc/svc_process_memory.cpp b/src/core/hle/kernel/svc/svc_process_memory.cpp
index ee11e9639..07cd48175 100644
--- a/src/core/hle/kernel/svc/svc_process_memory.cpp
+++ b/src/core/hle/kernel/svc/svc_process_memory.cpp
@@ -179,7 +179,7 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst
}
auto& page_table = process->GetPageTable();
- if (!page_table.IsInsideAddressSpace(src_address, size)) {
+ if (!page_table.Contains(src_address, size)) {
LOG_ERROR(Kernel_SVC,
"Source address range is not within the address space (src_address=0x{:016X}, "
"size=0x{:016X}).",
@@ -187,14 +187,6 @@ Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst
R_THROW(ResultInvalidCurrentMemory);
}
- if (!page_table.IsInsideASLRRegion(dst_address, size)) {
- LOG_ERROR(Kernel_SVC,
- "Destination address range is not within the ASLR region (dst_address=0x{:016X}, "
- "size=0x{:016X}).",
- dst_address, size);
- R_THROW(ResultInvalidMemoryRegion);
- }
-
R_RETURN(page_table.MapCodeMemory(dst_address, src_address, size));
}
@@ -247,7 +239,7 @@ Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 d
}
auto& page_table = process->GetPageTable();
- if (!page_table.IsInsideAddressSpace(src_address, size)) {
+ if (!page_table.Contains(src_address, size)) {
LOG_ERROR(Kernel_SVC,
"Source address range is not within the address space (src_address=0x{:016X}, "
"size=0x{:016X}).",
@@ -255,14 +247,6 @@ Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 d
R_THROW(ResultInvalidCurrentMemory);
}
- if (!page_table.IsInsideASLRRegion(dst_address, size)) {
- LOG_ERROR(Kernel_SVC,
- "Destination address range is not within the ASLR region (dst_address=0x{:016X}, "
- "size=0x{:016X}).",
- dst_address, size);
- R_THROW(ResultInvalidMemoryRegion);
- }
-
R_RETURN(page_table.UnmapCodeMemory(dst_address, src_address, size,
KPageTable::ICacheInvalidationStrategy::InvalidateAll));
}
diff --git a/src/core/hle/kernel/svc/svc_thread.cpp b/src/core/hle/kernel/svc/svc_thread.cpp
index d102e94a8..92bcea72b 100644
--- a/src/core/hle/kernel/svc/svc_thread.cpp
+++ b/src/core/hle/kernel/svc/svc_thread.cpp
@@ -236,7 +236,7 @@ Result GetThreadList(Core::System& system, s32* out_num_threads, u64 out_thread_
const auto total_copy_size = out_thread_ids_size * sizeof(u64);
if (out_thread_ids_size > 0 &&
- !current_process->GetPageTable().IsInsideAddressSpace(out_thread_ids, total_copy_size)) {
+ !current_process->GetPageTable().Contains(out_thread_ids, total_copy_size)) {
LOG_ERROR(Kernel_SVC, "Address range outside address space. begin=0x{:016X}, end=0x{:016X}",
out_thread_ids, out_thread_ids + total_copy_size);
R_THROW(ResultInvalidCurrentMemory);