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
487f8bc0
There was an error fetching the commit references. Please try again later.
Commit
487f8bc0
authored
7 years ago
by
shinyquagsire23
Browse files
Options
Downloads
Patches
Plain Diff
loader: Check error on NPDM load, use TID for CodeSet
parent
fd3806fd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/loader/deconstructed_rom_directory.cpp
+6
-2
6 additions, 2 deletions
src/core/loader/deconstructed_rom_directory.cpp
src/core/loader/nso.cpp
+3
-3
3 additions, 3 deletions
src/core/loader/nso.cpp
src/core/loader/nso.h
+1
-1
1 addition, 1 deletion
src/core/loader/nso.h
with
10 additions
and
6 deletions
src/core/loader/deconstructed_rom_directory.cpp
+
6
−
2
View file @
487f8bc0
...
@@ -114,7 +114,11 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
...
@@ -114,7 +114,11 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
const
std
::
string
directory
=
filepath
.
substr
(
0
,
filepath
.
find_last_of
(
"/
\\
"
))
+
DIR_SEP
;
const
std
::
string
directory
=
filepath
.
substr
(
0
,
filepath
.
find_last_of
(
"/
\\
"
))
+
DIR_SEP
;
const
std
::
string
npdm_path
=
directory
+
DIR_SEP
+
"main.npdm"
;
const
std
::
string
npdm_path
=
directory
+
DIR_SEP
+
"main.npdm"
;
metadata
.
Load
(
npdm_path
);
ResultStatus
result
=
metadata
.
Load
(
npdm_path
);
if
(
result
!=
ResultStatus
::
Success
)
{
return
result
;
}
metadata
.
Print
();
metadata
.
Print
();
// Load NSO modules
// Load NSO modules
...
@@ -123,7 +127,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
...
@@ -123,7 +127,7 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
"subsdk4"
,
"subsdk5"
,
"subsdk6"
,
"subsdk7"
,
"sdk"
})
{
"subsdk4"
,
"subsdk5"
,
"subsdk6"
,
"subsdk7"
,
"sdk"
})
{
const
std
::
string
path
=
directory
+
DIR_SEP
+
module
;
const
std
::
string
path
=
directory
+
DIR_SEP
+
module
;
const
VAddr
load_addr
=
next_load_addr
;
const
VAddr
load_addr
=
next_load_addr
;
next_load_addr
=
AppLoader_NSO
::
LoadModule
(
path
,
load_addr
);
next_load_addr
=
AppLoader_NSO
::
LoadModule
(
path
,
load_addr
,
metadata
.
GetTitleID
()
);
if
(
next_load_addr
)
{
if
(
next_load_addr
)
{
LOG_DEBUG
(
Loader
,
"loaded module %s @ 0x%"
PRIx64
,
module
,
load_addr
);
LOG_DEBUG
(
Loader
,
"loaded module %s @ 0x%"
PRIx64
,
module
,
load_addr
);
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/core/loader/nso.cpp
+
3
−
3
View file @
487f8bc0
...
@@ -92,7 +92,7 @@ static constexpr u32 PageAlignSize(u32 size) {
...
@@ -92,7 +92,7 @@ static constexpr u32 PageAlignSize(u32 size) {
return
(
size
+
Memory
::
PAGE_MASK
)
&
~
Memory
::
PAGE_MASK
;
return
(
size
+
Memory
::
PAGE_MASK
)
&
~
Memory
::
PAGE_MASK
;
}
}
VAddr
AppLoader_NSO
::
LoadModule
(
const
std
::
string
&
path
,
VAddr
load_base
)
{
VAddr
AppLoader_NSO
::
LoadModule
(
const
std
::
string
&
path
,
VAddr
load_base
,
u64
tid
)
{
FileUtil
::
IOFile
file
(
path
,
"rb"
);
FileUtil
::
IOFile
file
(
path
,
"rb"
);
if
(
!
file
.
IsOpen
())
{
if
(
!
file
.
IsOpen
())
{
return
{};
return
{};
...
@@ -109,7 +109,7 @@ VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base) {
...
@@ -109,7 +109,7 @@ VAddr AppLoader_NSO::LoadModule(const std::string& path, VAddr load_base) {
}
}
// Build program image
// Build program image
Kernel
::
SharedPtr
<
Kernel
::
CodeSet
>
codeset
=
Kernel
::
CodeSet
::
Create
(
""
,
0
);
Kernel
::
SharedPtr
<
Kernel
::
CodeSet
>
codeset
=
Kernel
::
CodeSet
::
Create
(
""
,
tid
);
std
::
vector
<
u8
>
program_image
;
std
::
vector
<
u8
>
program_image
;
for
(
int
i
=
0
;
i
<
nso_header
.
segments
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
nso_header
.
segments
.
size
();
++
i
)
{
std
::
vector
<
u8
>
data
=
std
::
vector
<
u8
>
data
=
...
@@ -158,7 +158,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
...
@@ -158,7 +158,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
process
=
Kernel
::
Process
::
Create
(
"main"
);
process
=
Kernel
::
Process
::
Create
(
"main"
);
// Load module
// Load module
LoadModule
(
filepath
,
Memory
::
PROCESS_IMAGE_VADDR
);
LoadModule
(
filepath
,
Memory
::
PROCESS_IMAGE_VADDR
,
0
);
LOG_DEBUG
(
Loader
,
"loaded module %s @ 0x%"
PRIx64
,
filepath
.
c_str
(),
LOG_DEBUG
(
Loader
,
"loaded module %s @ 0x%"
PRIx64
,
filepath
.
c_str
(),
Memory
::
PROCESS_IMAGE_VADDR
);
Memory
::
PROCESS_IMAGE_VADDR
);
...
...
This diff is collapsed.
Click to expand it.
src/core/loader/nso.h
+
1
−
1
View file @
487f8bc0
...
@@ -29,7 +29,7 @@ public:
...
@@ -29,7 +29,7 @@ public:
return
IdentifyType
(
file
,
filepath
);
return
IdentifyType
(
file
,
filepath
);
}
}
static
VAddr
LoadModule
(
const
std
::
string
&
path
,
VAddr
load_base
);
static
VAddr
LoadModule
(
const
std
::
string
&
path
,
VAddr
load_base
,
u64
tid
);
ResultStatus
Load
(
Kernel
::
SharedPtr
<
Kernel
::
Process
>&
process
)
override
;
ResultStatus
Load
(
Kernel
::
SharedPtr
<
Kernel
::
Process
>&
process
)
override
;
...
...
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