summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-04-08 23:30:34 +0200
committerbunnei <bunneidev@gmail.com>2020-04-17 06:59:31 +0200
commitffc3de762b9e4f6d7475c183f4b4e797a1383d42 (patch)
treef25e44c1753687ca2333a267ed10d7caee0aa452 /src/core
parentkernel: memory: Add PageTable class, to manage process address space. (diff)
downloadyuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.tar
yuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.tar.gz
yuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.tar.bz2
yuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.tar.lz
yuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.tar.xz
yuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.tar.zst
yuzu-ffc3de762b9e4f6d7475c183f4b4e797a1383d42.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/process_capability.cpp24
-rw-r--r--src/core/hle/kernel/process_capability.h24
2 files changed, 25 insertions, 23 deletions
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp
index 583e35b79..48e5ae682 100644
--- a/src/core/hle/kernel/process_capability.cpp
+++ b/src/core/hle/kernel/process_capability.cpp
@@ -5,8 +5,8 @@
#include "common/bit_util.h"
#include "core/hle/kernel/errors.h"
#include "core/hle/kernel/handle_table.h"
+#include "core/hle/kernel/memory/page_table.h"
#include "core/hle/kernel/process_capability.h"
-#include "core/hle/kernel/vm_manager.h"
namespace Kernel {
namespace {
@@ -66,7 +66,7 @@ u32 GetFlagBitOffset(CapabilityType type) {
ResultCode ProcessCapabilities::InitializeForKernelProcess(const u32* capabilities,
std::size_t num_capabilities,
- VMManager& vm_manager) {
+ Memory::PageTable& page_table) {
Clear();
// Allow all cores and priorities.
@@ -74,15 +74,15 @@ ResultCode ProcessCapabilities::InitializeForKernelProcess(const u32* capabiliti
priority_mask = 0xFFFFFFFFFFFFFFFF;
kernel_version = PackedKernelVersion;
- return ParseCapabilities(capabilities, num_capabilities, vm_manager);
+ return ParseCapabilities(capabilities, num_capabilities, page_table);
}
ResultCode ProcessCapabilities::InitializeForUserProcess(const u32* capabilities,
std::size_t num_capabilities,
- VMManager& vm_manager) {
+ Memory::PageTable& page_table) {
Clear();
- return ParseCapabilities(capabilities, num_capabilities, vm_manager);
+ return ParseCapabilities(capabilities, num_capabilities, page_table);
}
void ProcessCapabilities::InitializeForMetadatalessProcess() {
@@ -105,7 +105,7 @@ void ProcessCapabilities::InitializeForMetadatalessProcess() {
ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities,
std::size_t num_capabilities,
- VMManager& vm_manager) {
+ Memory::PageTable& page_table) {
u32 set_flags = 0;
u32 set_svc_bits = 0;
@@ -127,13 +127,13 @@ ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities,
return ERR_INVALID_COMBINATION;
}
- const auto result = HandleMapPhysicalFlags(descriptor, size_flags, vm_manager);
+ const auto result = HandleMapPhysicalFlags(descriptor, size_flags, page_table);
if (result.IsError()) {
return result;
}
} else {
const auto result =
- ParseSingleFlagCapability(set_flags, set_svc_bits, descriptor, vm_manager);
+ ParseSingleFlagCapability(set_flags, set_svc_bits, descriptor, page_table);
if (result.IsError()) {
return result;
}
@@ -144,7 +144,7 @@ ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities,
}
ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits,
- u32 flag, VMManager& vm_manager) {
+ u32 flag, Memory::PageTable& page_table) {
const auto type = GetCapabilityType(flag);
if (type == CapabilityType::Unset) {
@@ -172,7 +172,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s
case CapabilityType::Syscall:
return HandleSyscallFlags(set_svc_bits, flag);
case CapabilityType::MapIO:
- return HandleMapIOFlags(flag, vm_manager);
+ return HandleMapIOFlags(flag, page_table);
case CapabilityType::Interrupt:
return HandleInterruptFlags(flag);
case CapabilityType::ProgramType:
@@ -269,12 +269,12 @@ ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags)
}
ResultCode ProcessCapabilities::HandleMapPhysicalFlags(u32 flags, u32 size_flags,
- VMManager& vm_manager) {
+ Memory::PageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
}
-ResultCode ProcessCapabilities::HandleMapIOFlags(u32 flags, VMManager& vm_manager) {
+ResultCode ProcessCapabilities::HandleMapIOFlags(u32 flags, Memory::PageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
}
diff --git a/src/core/hle/kernel/process_capability.h b/src/core/hle/kernel/process_capability.h
index 5cdd80747..ea9d12c16 100644
--- a/src/core/hle/kernel/process_capability.h
+++ b/src/core/hle/kernel/process_capability.h
@@ -12,7 +12,9 @@ union ResultCode;
namespace Kernel {
-class VMManager;
+namespace Memory {
+class PageTable;
+}
/// The possible types of programs that may be indicated
/// by the program type capability descriptor.
@@ -81,27 +83,27 @@ public:
///
/// @param capabilities The capabilities to parse
/// @param num_capabilities The number of capabilities to parse.
- /// @param vm_manager The memory manager to use for handling any mapping-related
+ /// @param page_table The memory manager to use for handling any mapping-related
/// operations (such as mapping IO memory, etc).
///
/// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized,
/// otherwise, an error code upon failure.
///
ResultCode InitializeForKernelProcess(const u32* capabilities, std::size_t num_capabilities,
- VMManager& vm_manager);
+ Memory::PageTable& page_table);
/// Initializes this process capabilities instance for a userland process.
///
/// @param capabilities The capabilities to parse.
/// @param num_capabilities The total number of capabilities to parse.
- /// @param vm_manager The memory manager to use for handling any mapping-related
+ /// @param page_table The memory manager to use for handling any mapping-related
/// operations (such as mapping IO memory, etc).
///
/// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized,
/// otherwise, an error code upon failure.
///
ResultCode InitializeForUserProcess(const u32* capabilities, std::size_t num_capabilities,
- VMManager& vm_manager);
+ Memory::PageTable& page_table);
/// Initializes this process capabilities instance for a process that does not
/// have any metadata to parse.
@@ -181,13 +183,13 @@ private:
///
/// @param capabilities The sequence of capability descriptors to parse.
/// @param num_capabilities The number of descriptors within the given sequence.
- /// @param vm_manager The memory manager that will perform any memory
+ /// @param page_table The memory manager that will perform any memory
/// mapping if necessary.
///
/// @return RESULT_SUCCESS if no errors occur, otherwise an error code.
///
ResultCode ParseCapabilities(const u32* capabilities, std::size_t num_capabilities,
- VMManager& vm_manager);
+ Memory::PageTable& page_table);
/// Attempts to parse a capability descriptor that is only represented by a
/// single flag set.
@@ -196,13 +198,13 @@ private:
/// flags being initialized more than once when they shouldn't be.
/// @param set_svc_bits Running set of bits representing the allowed supervisor calls mask.
/// @param flag The flag to attempt to parse.
- /// @param vm_manager The memory manager that will perform any memory
+ /// @param page_table The memory manager that will perform any memory
/// mapping if necessary.
///
/// @return RESULT_SUCCESS if no errors occurred, otherwise an error code.
///
ResultCode ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits, u32 flag,
- VMManager& vm_manager);
+ Memory::PageTable& page_table);
/// Clears the internal state of this process capability instance. Necessary,
/// to have a sane starting point due to us allowing running executables without
@@ -226,10 +228,10 @@ private:
ResultCode HandleSyscallFlags(u32& set_svc_bits, u32 flags);
/// Handles flags related to mapping physical memory pages.
- ResultCode HandleMapPhysicalFlags(u32 flags, u32 size_flags, VMManager& vm_manager);
+ ResultCode HandleMapPhysicalFlags(u32 flags, u32 size_flags, Memory::PageTable& page_table);
/// Handles flags related to mapping IO pages.
- ResultCode HandleMapIOFlags(u32 flags, VMManager& vm_manager);
+ ResultCode HandleMapIOFlags(u32 flags, Memory::PageTable& page_table);
/// Handles flags related to the interrupt capability flags.
ResultCode HandleInterruptFlags(u32 flags);