Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
ffc3de76
There was an error fetching the commit references. Please try again later.
Commit
ffc3de76
authored
5 years ago
by
bunnei
Browse files
Options
Downloads
Patches
Plain Diff
kernel: process_capability: Update to use Memory::PageTable.
parent
84f1b6d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/hle/kernel/process_capability.cpp
+12
-12
12 additions, 12 deletions
src/core/hle/kernel/process_capability.cpp
src/core/hle/kernel/process_capability.h
+13
-11
13 additions, 11 deletions
src/core/hle/kernel/process_capability.h
with
25 additions
and
23 deletions
src/core/hle/kernel/process_capability.cpp
+
12
−
12
View file @
ffc3de76
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/kernel/process_capability.h
+
13
−
11
View file @
ffc3de76
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment