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
5017038c
There was an error fetching the commit references. Please try again later.
Commit
5017038c
authored
7 years ago
by
bunnei
Browse files
Options
Downloads
Patches
Plain Diff
svc: Implement svcWaitProcessWideKeyAtomic.
parent
91f10a14
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/svc.cpp
+49
-1
49 additions, 1 deletion
src/core/hle/kernel/svc.cpp
src/core/hle/kernel/svc_wrap.h
+5
-0
5 additions, 0 deletions
src/core/hle/kernel/svc_wrap.h
with
54 additions
and
1 deletion
src/core/hle/kernel/svc.cpp
+
49
−
1
View file @
5017038c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
"core/hle/kernel/object_address_table.h"
#include
"core/hle/kernel/object_address_table.h"
#include
"core/hle/kernel/process.h"
#include
"core/hle/kernel/process.h"
#include
"core/hle/kernel/resource_limit.h"
#include
"core/hle/kernel/resource_limit.h"
#include
"core/hle/kernel/semaphore.h"
#include
"core/hle/kernel/svc.h"
#include
"core/hle/kernel/svc.h"
#include
"core/hle/kernel/svc_wrap.h"
#include
"core/hle/kernel/svc_wrap.h"
#include
"core/hle/kernel/sync_object.h"
#include
"core/hle/kernel/sync_object.h"
...
@@ -471,6 +472,53 @@ static void SleepThread(s64 nanoseconds) {
...
@@ -471,6 +472,53 @@ static void SleepThread(s64 nanoseconds) {
Core
::
System
::
GetInstance
().
PrepareReschedule
();
Core
::
System
::
GetInstance
().
PrepareReschedule
();
}
}
/// Signal process wide key atomic
static
ResultCode
WaitProcessWideKeyAtomic
(
VAddr
mutex_addr
,
VAddr
semaphore_addr
,
Handle
thread_handle
,
s64
nano_seconds
)
{
LOG_TRACE
(
Kernel_SVC
,
"called mutex_addr=%llx, semaphore_addr=%llx, thread_handle=0x%08X, timeout=%d"
,
mutex_addr
,
semaphore_addr
,
thread_handle
,
nano_seconds
);
SharedPtr
<
Thread
>
thread
=
g_handle_table
.
Get
<
Thread
>
(
thread_handle
);
ASSERT
(
thread
);
SharedPtr
<
Mutex
>
mutex
=
g_object_address_table
.
Get
<
Mutex
>
(
mutex_addr
);
if
(
!
mutex
)
{
// Create a new mutex for the specified address if one does not already exist
mutex
=
Mutex
::
Create
(
thread
,
mutex_addr
);
mutex
->
name
=
Common
::
StringFromFormat
(
"mutex-%llx"
,
mutex_addr
);
}
SharedPtr
<
Semaphore
>
semaphore
=
g_object_address_table
.
Get
<
Semaphore
>
(
semaphore_addr
);
if
(
!
semaphore
)
{
// Create a new semaphore for the specified address if one does not already exist
semaphore
=
Semaphore
::
Create
(
semaphore_addr
,
mutex_addr
).
Unwrap
();
semaphore
->
name
=
Common
::
StringFromFormat
(
"semaphore-%llx"
,
semaphore_addr
);
}
ASSERT
(
semaphore
->
available_count
==
0
);
ASSERT
(
semaphore
->
mutex_addr
==
mutex_addr
);
CASCADE_CODE
(
WaitSynchronization1
(
semaphore
,
thread
.
get
(),
nano_seconds
,
[
mutex
](
ThreadWakeupReason
reason
,
SharedPtr
<
Thread
>
thread
,
SharedPtr
<
WaitObject
>
object
)
{
ASSERT
(
thread
->
status
==
THREADSTATUS_WAIT_SYNCH_ANY
);
if
(
reason
==
ThreadWakeupReason
::
Timeout
)
{
thread
->
SetWaitSynchronizationResult
(
RESULT_TIMEOUT
);
return
;
}
ASSERT
(
reason
==
ThreadWakeupReason
::
Signal
);
thread
->
SetWaitSynchronizationResult
(
WaitSynchronization1
(
mutex
,
thread
.
get
()));
thread
->
SetWaitSynchronizationOutput
(
thread
->
GetWaitObjectIndex
(
object
.
get
()));
}));
mutex
->
Release
(
thread
.
get
());
return
RESULT_SUCCESS
;
}
/// Signal process wide key
/// Signal process wide key
static
ResultCode
SignalProcessWideKey
(
VAddr
addr
,
u32
target
)
{
static
ResultCode
SignalProcessWideKey
(
VAddr
addr
,
u32
target
)
{
LOG_WARNING
(
Kernel_SVC
,
"(STUBBED) called, address=0x%llx, target=0x%08x"
,
addr
,
target
);
LOG_WARNING
(
Kernel_SVC
,
"(STUBBED) called, address=0x%llx, target=0x%08x"
,
addr
,
target
);
...
@@ -522,7 +570,7 @@ static const FunctionDef SVC_Table[] = {
...
@@ -522,7 +570,7 @@ static const FunctionDef SVC_Table[] = {
{
0x19
,
nullptr
,
"CancelSynchronization"
},
{
0x19
,
nullptr
,
"CancelSynchronization"
},
{
0x1A
,
SvcWrap
<
LockMutex
>
,
"LockMutex"
},
{
0x1A
,
SvcWrap
<
LockMutex
>
,
"LockMutex"
},
{
0x1B
,
SvcWrap
<
UnlockMutex
>
,
"UnlockMutex"
},
{
0x1B
,
SvcWrap
<
UnlockMutex
>
,
"UnlockMutex"
},
{
0x1C
,
nullptr
,
"WaitProcessWideKeyAtomic"
},
{
0x1C
,
SvcWrap
<
WaitProcessWideKeyAtomic
>
,
"WaitProcessWideKeyAtomic"
},
{
0x1D
,
SvcWrap
<
SignalProcessWideKey
>
,
"SignalProcessWideKey"
},
{
0x1D
,
SvcWrap
<
SignalProcessWideKey
>
,
"SignalProcessWideKey"
},
{
0x1E
,
nullptr
,
"GetSystemTick"
},
{
0x1E
,
nullptr
,
"GetSystemTick"
},
{
0x1F
,
SvcWrap
<
ConnectToPort
>
,
"ConnectToPort"
},
{
0x1F
,
SvcWrap
<
ConnectToPort
>
,
"ConnectToPort"
},
...
...
This diff is collapsed.
Click to expand it.
src/core/hle/kernel/svc_wrap.h
+
5
−
0
View file @
5017038c
...
@@ -85,6 +85,11 @@ void SvcWrap() {
...
@@ -85,6 +85,11 @@ void SvcWrap() {
FuncReturn
(
func
(
PARAM
(
1
),
PARAM
(
2
),
(
s64
)
PARAM
(
3
)).
raw
);
FuncReturn
(
func
(
PARAM
(
1
),
PARAM
(
2
),
(
s64
)
PARAM
(
3
)).
raw
);
}
}
template
<
ResultCode
func
(
u64
,
u64
,
u32
,
s64
)>
void
SvcWrap
()
{
FuncReturn
(
func
(
PARAM
(
0
),
PARAM
(
1
),
(
u32
)
PARAM
(
2
),
(
s64
)
PARAM
(
3
)).
raw
);
}
template
<
ResultCode
func
(
u64
*
,
u64
,
u64
,
u64
)>
template
<
ResultCode
func
(
u64
*
,
u64
,
u64
,
u64
)>
void
SvcWrap
()
{
void
SvcWrap
()
{
u64
param_1
=
0
;
u64
param_1
=
0
;
...
...
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