Compare commits
385 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90a38ca30e | ||
|
|
66c410e696 | ||
|
|
c72614f768 | ||
|
|
232203f4c0 | ||
|
|
13bfeed2d5 | ||
|
|
492a9e1849 | ||
|
|
17b6bcfd37 | ||
|
|
0e289461bb | ||
|
|
8e75a4169d | ||
|
|
85cd2c97a0 | ||
|
|
3e6031b8f4 | ||
|
|
9ddc6e596b | ||
|
|
b56f9966b7 | ||
|
|
3bc7c52ade | ||
|
|
e819f3dbce | ||
|
|
4d78b834cb | ||
|
|
f670949ca9 | ||
|
|
72f1e85aba | ||
|
|
491ba8fdcf | ||
|
|
67b91cfa13 | ||
|
|
7361fa25a9 | ||
|
|
793bde256c | ||
|
|
234c83522a | ||
|
|
0bfbc6e6eb | ||
|
|
2dfe5b192e | ||
|
|
aca2992c68 | ||
|
|
39f5933600 | ||
|
|
52c89a76b2 | ||
|
|
faaef5eff5 | ||
|
|
a9cc74da34 | ||
|
|
93e855a293 | ||
|
|
a61fdc8d65 | ||
|
|
9622912059 | ||
|
|
59ea93e9cd | ||
|
|
57ac153671 | ||
|
|
71d266f867 | ||
|
|
970b85bf9a | ||
|
|
7bc0250cea | ||
|
|
524da78b0e | ||
|
|
7458879555 | ||
|
|
1d40a08ef9 | ||
|
|
be07035954 | ||
|
|
b7c4dae899 | ||
|
|
94d0d06660 | ||
|
|
2e4e59dbda | ||
|
|
0fb528836c | ||
|
|
4a01ae8b9d | ||
|
|
5bec9395b1 | ||
|
|
3bc2d79384 | ||
|
|
6ac1ff6f24 | ||
|
|
93e0c9194d | ||
|
|
6ad0f0e7f2 | ||
|
|
4f50f57bb7 | ||
|
|
97cba5e881 | ||
|
|
6eb77e69c4 | ||
|
|
90d754f920 | ||
|
|
b39b6f0d5b | ||
|
|
dcfb3bc9b5 | ||
|
|
b4d003b4b9 | ||
|
|
bc1d3ccc91 | ||
|
|
152a945561 | ||
|
|
3da0cda4ae | ||
|
|
d77fe98203 | ||
|
|
94ec9ae41b | ||
|
|
332dbdd497 | ||
|
|
98cc051387 | ||
|
|
f2944d36ba | ||
|
|
46d79387e8 | ||
|
|
0bb2c0a04f | ||
|
|
eca2b453ae | ||
|
|
e14dc18bd3 | ||
|
|
c7743c6098 | ||
|
|
d81a3bdc36 | ||
|
|
32e5283ac2 | ||
|
|
1d9a4f47fd | ||
|
|
3f5f9b60ea | ||
|
|
08e1b4d116 | ||
|
|
683580861f | ||
|
|
7d30460214 | ||
|
|
d7ba3291ed | ||
|
|
c07f54f370 | ||
|
|
6fe8ada37a | ||
|
|
94b10b5779 | ||
|
|
9b677c81a5 | ||
|
|
a25be61e94 | ||
|
|
116e00c21c | ||
|
|
122b0775f1 | ||
|
|
11f840b1e3 | ||
|
|
36039ddbb7 | ||
|
|
5347f0d583 | ||
|
|
408dde533f | ||
|
|
b15b46a68e | ||
|
|
ba6f298618 | ||
|
|
c6424921a6 | ||
|
|
8547802904 | ||
|
|
353e27b9e2 | ||
|
|
4a38a36036 | ||
|
|
200d2df785 | ||
|
|
73552c86c3 | ||
|
|
dd80e1f463 | ||
|
|
15c929a0e4 | ||
|
|
aa4c79cd9c | ||
|
|
6719abec65 | ||
|
|
79b9e07ee9 | ||
|
|
eca5ac01b8 | ||
|
|
50ea19e7a2 | ||
|
|
823a1f3ea3 | ||
|
|
b73895df0a | ||
|
|
5062329979 | ||
|
|
065485b971 | ||
|
|
6193283f03 | ||
|
|
eb48e7cc59 | ||
|
|
d98490d339 | ||
|
|
b2e86f5a1b | ||
|
|
0e9974e7b3 | ||
|
|
496be5ecd4 | ||
|
|
50a91b1d6e | ||
|
|
f872be67eb | ||
|
|
e04679f05a | ||
|
|
8d1ada2a1b | ||
|
|
a50d6a2696 | ||
|
|
76d72fa946 | ||
|
|
8b19fdfd51 | ||
|
|
612d846132 | ||
|
|
816ce605d3 | ||
|
|
07c95662b1 | ||
|
|
2b930d21fd | ||
|
|
0b52596087 | ||
|
|
e9134d8044 | ||
|
|
33d6dfb6b3 | ||
|
|
6096fa0e45 | ||
|
|
058f265bd6 | ||
|
|
bd4c608b08 | ||
|
|
7fc1e86bf5 | ||
|
|
87ec045a98 | ||
|
|
7502e2174f | ||
|
|
0545eb18c0 | ||
|
|
0c161a4c1b | ||
|
|
3d518759da | ||
|
|
0af2758fde | ||
|
|
9bb5af9823 | ||
|
|
82eab9c8d0 | ||
|
|
3cca3801ca | ||
|
|
03408f404a | ||
|
|
92e7a3ca08 | ||
|
|
b27c7552d2 | ||
|
|
426257d4ae | ||
|
|
7d34d599bb | ||
|
|
067fe2d10f | ||
|
|
4759c2f92c | ||
|
|
ca26d8ce27 | ||
|
|
6c52cc3e26 | ||
|
|
e42d3a3abf | ||
|
|
884844bc23 | ||
|
|
f556db8c89 | ||
|
|
96d15b28c6 | ||
|
|
37f7afb426 | ||
|
|
7dd4e76c1d | ||
|
|
daa0deb1bf | ||
|
|
43bd733f0a | ||
|
|
70367e3e7c | ||
|
|
45f8343659 | ||
|
|
e8dfe04701 | ||
|
|
95d5375158 | ||
|
|
b735bc53c4 | ||
|
|
b4856a2d07 | ||
|
|
ed4491a24f | ||
|
|
93004be59e | ||
|
|
237b513408 | ||
|
|
4c5e980e07 | ||
|
|
08d9de6907 | ||
|
|
6eee3f5fe7 | ||
|
|
4eb3109c93 | ||
|
|
f7fb689412 | ||
|
|
2181adb82b | ||
|
|
40c6733de3 | ||
|
|
c703be86fc | ||
|
|
f3732c72dc | ||
|
|
c7026b9094 | ||
|
|
f9403201f0 | ||
|
|
fd34e2342a | ||
|
|
0e5ade727c | ||
|
|
c4065c976c | ||
|
|
392c9c3a0b | ||
|
|
4f33afe0ee | ||
|
|
dc1404061c | ||
|
|
8da705d40b | ||
|
|
4f34a38a97 | ||
|
|
799f94958c | ||
|
|
c17b6d0d44 | ||
|
|
5a8aebf74d | ||
|
|
191414c832 | ||
|
|
a429c61f33 | ||
|
|
ad1158b30a | ||
|
|
ba8c77fec6 | ||
|
|
f427c3d7a5 | ||
|
|
05a24b5726 | ||
|
|
8306464758 | ||
|
|
4a30437e80 | ||
|
|
80e1847534 | ||
|
|
8ccac1d18a | ||
|
|
c3656aae30 | ||
|
|
5fa534fb71 | ||
|
|
f3629f863d | ||
|
|
d675aa3414 | ||
|
|
981166783b | ||
|
|
c0f7cd95b9 | ||
|
|
40400aee1f | ||
|
|
9572fb2ce3 | ||
|
|
eb75d54b2b | ||
|
|
081bd0aefc | ||
|
|
fa4a96d021 | ||
|
|
3c5efefb15 | ||
|
|
3e4c962bbb | ||
|
|
34fb48b412 | ||
|
|
40980904f7 | ||
|
|
5055bdb23e | ||
|
|
d2a888d9e8 | ||
|
|
bb3f7c8ab9 | ||
|
|
efae01c165 | ||
|
|
9f9593e05f | ||
|
|
80b115ef57 | ||
|
|
560c340c96 | ||
|
|
aae3c789f2 | ||
|
|
c568788609 | ||
|
|
28ea0b12a8 | ||
|
|
b857153964 | ||
|
|
d9c3908caf | ||
|
|
b99bcbc619 | ||
|
|
905ce0eeea | ||
|
|
0534ddd37a | ||
|
|
30b3825f5c | ||
|
|
05a3e95834 | ||
|
|
fba8fb539d | ||
|
|
772e1f1c4f | ||
|
|
154422562a | ||
|
|
25b0baae59 | ||
|
|
92521eed2a | ||
|
|
cbc73f4407 | ||
|
|
30d6b359f9 | ||
|
|
2c496e94d5 | ||
|
|
20b5268e90 | ||
|
|
11f70759ce | ||
|
|
b3e6571586 | ||
|
|
5b98426171 | ||
|
|
c91386b0fa | ||
|
|
19e6d2e1c0 | ||
|
|
ea0011d572 | ||
|
|
364b04b68a | ||
|
|
8c93eb5712 | ||
|
|
c6d1579265 | ||
|
|
34bb800440 | ||
|
|
ef3da6cb51 | ||
|
|
3bcc4adb5c | ||
|
|
3c78bc4dbf | ||
|
|
fdd7b1db15 | ||
|
|
50b8189e7f | ||
|
|
3284656aad | ||
|
|
1d65352167 | ||
|
|
d8e94996ad | ||
|
|
5dae43b192 | ||
|
|
4b6b06fcaa | ||
|
|
919b8124dc | ||
|
|
e330b6187f | ||
|
|
1224ed8abe | ||
|
|
e9e949ec36 | ||
|
|
8cfffc69d5 | ||
|
|
cb6af379d8 | ||
|
|
d9e6771e63 | ||
|
|
f7d3d50f33 | ||
|
|
9dc7a4dc18 | ||
|
|
1de607c183 | ||
|
|
23f5d77f37 | ||
|
|
5961151a92 | ||
|
|
323858cf96 | ||
|
|
5f857cb079 | ||
|
|
62de3322ff | ||
|
|
1309e93e26 | ||
|
|
c6a736a6f6 | ||
|
|
30e39e60f7 | ||
|
|
108b997ef2 | ||
|
|
877b2cf790 | ||
|
|
5e4307046a | ||
|
|
2355047715 | ||
|
|
57222e8301 | ||
|
|
797c04d19f | ||
|
|
9accbcf8e1 | ||
|
|
86eea62cd8 | ||
|
|
00b093ec62 | ||
|
|
b2b1129cc0 | ||
|
|
d9db723bc8 | ||
|
|
08cb370a45 | ||
|
|
d262ff92cc | ||
|
|
e1adbb6dba | ||
|
|
e25a4ca8d7 | ||
|
|
059c706f19 | ||
|
|
484f132651 | ||
|
|
d5a4c17ee7 | ||
|
|
7d6b16d7fb | ||
|
|
2faf3d33b5 | ||
|
|
bb4ade30e4 | ||
|
|
981bb1f15d | ||
|
|
ad0d2faa6c | ||
|
|
507ab46709 | ||
|
|
7820e5b759 | ||
|
|
7c703903ea | ||
|
|
e7dee2a9fc | ||
|
|
b2e522c0a0 | ||
|
|
875b62f06a | ||
|
|
32fb22e361 | ||
|
|
b3bfd6c4c9 | ||
|
|
866771fdae | ||
|
|
308ddecc9c | ||
|
|
24d41ce55e | ||
|
|
bce7133128 | ||
|
|
3982afdd6b | ||
|
|
6ee305464a | ||
|
|
6ecf04c3b7 | ||
|
|
471bc7cc92 | ||
|
|
9df7f0aada | ||
|
|
3a91a6b786 | ||
|
|
7806766a59 | ||
|
|
11d4e74620 | ||
|
|
9068e2071c | ||
|
|
769a57526c | ||
|
|
0751db5d12 | ||
|
|
d1fbd64235 | ||
|
|
da59334c5e | ||
|
|
f3fa680d5d | ||
|
|
5b1060b30e | ||
|
|
d5458960d5 | ||
|
|
4d5cde3f7b | ||
|
|
8528248d2b | ||
|
|
814c9d1cfb | ||
|
|
9d7b548ce0 | ||
|
|
d779eea009 | ||
|
|
3038612774 | ||
|
|
59be817bb8 | ||
|
|
b965e3f335 | ||
|
|
43c0e39c34 | ||
|
|
0d8bde6079 | ||
|
|
38f942adf5 | ||
|
|
145ee8fcc8 | ||
|
|
48772307bf | ||
|
|
2619ccad0c | ||
|
|
6d5d97cfcd | ||
|
|
846f610fff | ||
|
|
2e8f06ef44 | ||
|
|
5fbd728962 | ||
|
|
11ec6a6912 | ||
|
|
b89f0e45ec | ||
|
|
18d998034d | ||
|
|
27994bb306 | ||
|
|
3e2ec256ab | ||
|
|
bf5bbfbcef | ||
|
|
d10621e832 | ||
|
|
d3b697fd1d | ||
|
|
daa7f5db79 | ||
|
|
4adc0e4096 | ||
|
|
8e3c34ea89 | ||
|
|
a85e20bcea | ||
|
|
879f8a5147 | ||
|
|
f78653d815 | ||
|
|
3c7c1fbd8a | ||
|
|
8efdd04fcd | ||
|
|
623b5f4eb9 | ||
|
|
af352e4f7f | ||
|
|
2866cb5fe6 | ||
|
|
b5becba8ff | ||
|
|
36c47a0014 | ||
|
|
0b0fdc5c58 | ||
|
|
5a15d62b8b | ||
|
|
d0404f3cc9 | ||
|
|
2ae298de24 | ||
|
|
a2d2b1b346 | ||
|
|
06e4b94674 | ||
|
|
f1a9dd8a98 | ||
|
|
0a18c63f24 | ||
|
|
f9a199557c | ||
|
|
0fdbdb1f4d | ||
|
|
e734b23f11 | ||
|
|
de1e6c9705 | ||
|
|
71b220a4e9 | ||
|
|
5448332009 | ||
|
|
d3bafc5b3b |
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: ReSwitched Discord
|
||||||
|
url: https://discordapp.com/invite/DThbZ7z
|
||||||
|
about: Please ask questions here, instead of making GitHub issues.
|
||||||
7
.github/ISSUE_TEMPLATE/question.md
vendored
7
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
name: Question
|
|
||||||
about: Please ask questions in the ReSwitched discord, instead of making issues.
|
|
||||||
---
|
|
||||||
We would like to use GitHub to keep track of problems/feature requests.
|
|
||||||
If you have a question, please join the ReSwitched discord for help.
|
|
||||||
- Discord link: https://discordapp.com/invite/DThbZ7z
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -64,6 +64,7 @@ dkms.conf
|
|||||||
# Distribution files
|
# Distribution files
|
||||||
*.tgz
|
*.tgz
|
||||||
*.zip
|
*.zip
|
||||||
|
*.bz2
|
||||||
|
|
||||||
# IDA binaries
|
# IDA binaries
|
||||||
*.id0
|
*.id0
|
||||||
|
|||||||
59
Makefile
59
Makefile
@@ -1,4 +1,4 @@
|
|||||||
TOPTARGETS := all clean dist
|
TOPTARGETS := all clean dist-no-debug dist
|
||||||
AMSBRANCH := $(shell git symbolic-ref --short HEAD)
|
AMSBRANCH := $(shell git symbolic-ref --short HEAD)
|
||||||
AMSHASH := $(shell git rev-parse --short HEAD)
|
AMSHASH := $(shell git rev-parse --short HEAD)
|
||||||
AMSREV := $(AMSBRANCH)-$(AMSHASH)
|
AMSREV := $(AMSBRANCH)-$(AMSHASH)
|
||||||
@@ -7,7 +7,7 @@ ifneq (, $(strip $(shell git status --porcelain 2>/dev/null)))
|
|||||||
AMSREV := $(AMSREV)-dirty
|
AMSREV := $(AMSREV)-dirty
|
||||||
endif
|
endif
|
||||||
|
|
||||||
COMPONENTS := fusee stratosphere exosphere thermosphere troposphere libraries
|
COMPONENTS := fusee stratosphere mesosphere exosphere thermosphere troposphere libraries
|
||||||
|
|
||||||
all: $(COMPONENTS)
|
all: $(COMPONENTS)
|
||||||
|
|
||||||
@@ -20,13 +20,16 @@ exosphere: thermosphere
|
|||||||
stratosphere: exosphere libraries
|
stratosphere: exosphere libraries
|
||||||
$(MAKE) -C stratosphere all
|
$(MAKE) -C stratosphere all
|
||||||
|
|
||||||
|
mesosphere: exosphere libraries
|
||||||
|
$(MAKE) -C mesosphere all
|
||||||
|
|
||||||
troposphere: stratosphere
|
troposphere: stratosphere
|
||||||
$(MAKE) -C troposphere all
|
$(MAKE) -C troposphere all
|
||||||
|
|
||||||
sept: exosphere
|
sept: exosphere
|
||||||
$(MAKE) -C sept all
|
$(MAKE) -C sept all
|
||||||
|
|
||||||
fusee: exosphere stratosphere sept
|
fusee: exosphere mesosphere stratosphere sept
|
||||||
$(MAKE) -C $@ all
|
$(MAKE) -C $@ all
|
||||||
|
|
||||||
libraries:
|
libraries:
|
||||||
@@ -36,7 +39,7 @@ clean:
|
|||||||
$(MAKE) -C fusee clean
|
$(MAKE) -C fusee clean
|
||||||
rm -rf out
|
rm -rf out
|
||||||
|
|
||||||
dist: all
|
dist-no-debug: all
|
||||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||||
| tr -s [:blank:] \
|
| tr -s [:blank:] \
|
||||||
| cut -d' ' -f3))
|
| cut -d' ' -f3))
|
||||||
@@ -55,10 +58,12 @@ dist: all
|
|||||||
mkdir atmosphere-$(AMSVER)/switch
|
mkdir atmosphere-$(AMSVER)/switch
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/010000000000000D
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/010000000000000D
|
||||||
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/010000000000002B
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000034
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000034
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037
|
||||||
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/010000000000003C
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/fatal_errors
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/fatal_errors
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config_templates
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/config_templates
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/config
|
||||||
@@ -70,6 +75,8 @@ dist: all
|
|||||||
cp sept/sept-secondary/sept-secondary.bin atmosphere-$(AMSVER)/sept/sept-secondary.bin
|
cp sept/sept-secondary/sept-secondary.bin atmosphere-$(AMSVER)/sept/sept-secondary.bin
|
||||||
cp sept/sept-secondary/sept-secondary_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_00.enc
|
cp sept/sept-secondary/sept-secondary_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_00.enc
|
||||||
cp sept/sept-secondary/sept-secondary_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc
|
cp sept/sept-secondary/sept-secondary_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_01.enc
|
||||||
|
cp sept/sept-secondary/sept-secondary_dev_00.enc atmosphere-$(AMSVER)/sept/sept-secondary_dev_00.enc
|
||||||
|
cp sept/sept-secondary/sept-secondary_dev_01.enc atmosphere-$(AMSVER)/sept/sept-secondary_dev_01.enc
|
||||||
cp config_templates/BCT.ini atmosphere-$(AMSVER)/atmosphere/config/BCT.ini
|
cp config_templates/BCT.ini atmosphere-$(AMSVER)/atmosphere/config/BCT.ini
|
||||||
cp config_templates/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.ini
|
cp config_templates/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.ini
|
||||||
cp config_templates/system_settings.ini atmosphere-$(AMSVER)/atmosphere/config_templates/system_settings.ini
|
cp config_templates/system_settings.ini atmosphere-$(AMSVER)/atmosphere/config_templates/system_settings.ini
|
||||||
@@ -77,10 +84,12 @@ dist: all
|
|||||||
cp -r config_templates/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html
|
cp -r config_templates/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html
|
||||||
cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008/exefs.nsp
|
cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000008/exefs.nsp
|
||||||
cp stratosphere/dmnt/dmnt.nsp atmosphere-$(AMSVER)/atmosphere/contents/010000000000000D/exefs.nsp
|
cp stratosphere/dmnt/dmnt.nsp atmosphere-$(AMSVER)/atmosphere/contents/010000000000000D/exefs.nsp
|
||||||
|
cp stratosphere/erpt/erpt.nsp atmosphere-$(AMSVER)/atmosphere/contents/010000000000002B/exefs.nsp
|
||||||
cp stratosphere/eclct.stub/eclct.stub.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032/exefs.nsp
|
cp stratosphere/eclct.stub/eclct.stub.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032/exefs.nsp
|
||||||
cp stratosphere/fatal/fatal.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000034/exefs.nsp
|
cp stratosphere/fatal/fatal.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000034/exefs.nsp
|
||||||
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036/exefs.nsp
|
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000036/exefs.nsp
|
||||||
cp stratosphere/ro/ro.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037/exefs.nsp
|
cp stratosphere/ro/ro.nsp atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037/exefs.nsp
|
||||||
|
cp stratosphere/jpegdec/jpegdec.nsp atmosphere-$(AMSVER)/atmosphere/contents/010000000000003C/exefs.nsp
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032/flags
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032/flags
|
||||||
touch atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032/flags/boot2.flag
|
touch atmosphere-$(AMSVER)/atmosphere/contents/0100000000000032/flags/boot2.flag
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037/flags
|
mkdir -p atmosphere-$(AMSVER)/atmosphere/contents/0100000000000037/flags
|
||||||
@@ -92,5 +101,47 @@ dist: all
|
|||||||
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip
|
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip
|
||||||
cp fusee/fusee-primary/fusee-primary.bin out/fusee-primary.bin
|
cp fusee/fusee-primary/fusee-primary.bin out/fusee-primary.bin
|
||||||
|
|
||||||
|
dist: dist-no-debug
|
||||||
|
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||||
|
| tr -s [:blank:] \
|
||||||
|
| cut -d' ' -f3))
|
||||||
|
$(eval MINORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||||
|
| tr -s [:blank:] \
|
||||||
|
| cut -d' ' -f3))
|
||||||
|
$(eval MICROVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
||||||
|
| tr -s [:blank:] \
|
||||||
|
| cut -d' ' -f3))
|
||||||
|
$(eval AMSVER = $(MAJORVER).$(MINORVER).$(MICROVER)-$(AMSREV))
|
||||||
|
rm -rf atmosphere-$(AMSVER)-debug
|
||||||
|
mkdir atmosphere-$(AMSVER)-debug
|
||||||
|
cp fusee/fusee-primary/fusee-primary.elf atmosphere-$(AMSVER)-debug/fusee-primary.elf
|
||||||
|
cp fusee/fusee-mtc/fusee-mtc.elf atmosphere-$(AMSVER)-debug/fusee-mtc.elf
|
||||||
|
cp fusee/fusee-secondary/fusee-secondary.elf atmosphere-$(AMSVER)-debug/fusee-secondary.elf
|
||||||
|
cp sept/sept-primary/sept-primary.elf atmosphere-$(AMSVER)-debug/sept-primary.elf
|
||||||
|
cp sept/sept-secondary/sept-secondary.elf atmosphere-$(AMSVER)-debug/sept-secondary.elf
|
||||||
|
cp sept/sept-secondary/key_derivation/key_derivation.elf atmosphere-$(AMSVER)-debug/sept-secondary-key-derivation.elf
|
||||||
|
cp exosphere/exosphere.elf atmosphere-$(AMSVER)-debug/exosphere.elf
|
||||||
|
cp exosphere/lp0fw/lp0fw.elf atmosphere-$(AMSVER)-debug/lp0fw.elf
|
||||||
|
cp exosphere/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/sc7fw.elf
|
||||||
|
cp exosphere/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/rebootstub.elf
|
||||||
|
cp mesosphere/kernel_ldr/kernel_ldr.elf atmosphere-$(AMSVER)-debug/kernel_ldr.elf
|
||||||
|
cp stratosphere/ams_mitm/ams_mitm.elf atmosphere-$(AMSVER)-debug/ams_mitm.elf
|
||||||
|
cp stratosphere/boot/boot.elf atmosphere-$(AMSVER)-debug/boot.elf
|
||||||
|
cp stratosphere/boot2/boot2.elf atmosphere-$(AMSVER)-debug/boot2.elf
|
||||||
|
cp stratosphere/creport/creport.elf atmosphere-$(AMSVER)-debug/creport.elf
|
||||||
|
cp stratosphere/dmnt/dmnt.elf atmosphere-$(AMSVER)-debug/dmnt.elf
|
||||||
|
cp stratosphere/eclct.stub/eclct.stub.elf atmosphere-$(AMSVER)-debug/eclct.stub.elf
|
||||||
|
cp stratosphere/fatal/fatal.elf atmosphere-$(AMSVER)-debug/fatal.elf
|
||||||
|
cp stratosphere/loader/loader.elf atmosphere-$(AMSVER)-debug/loader.elf
|
||||||
|
cp stratosphere/pm/pm.elf atmosphere-$(AMSVER)-debug/pm.elf
|
||||||
|
cp stratosphere/ro/ro.elf atmosphere-$(AMSVER)-debug/ro.elf
|
||||||
|
cp stratosphere/sm/sm.elf atmosphere-$(AMSVER)-debug/sm.elf
|
||||||
|
cp stratosphere/spl/spl.elf atmosphere-$(AMSVER)-debug/spl.elf
|
||||||
|
cp stratosphere/erpt/erpt.elf atmosphere-$(AMSVER)-debug/erpt.elf
|
||||||
|
cp stratosphere/jpegdec/jpegdec.elf atmosphere-$(AMSVER)-debug/jpegdec.elf
|
||||||
|
cd atmosphere-$(AMSVER)-debug; zip -r ../atmosphere-$(AMSVER)-debug.zip ./*; cd ../;
|
||||||
|
rm -r atmosphere-$(AMSVER)-debug
|
||||||
|
mv atmosphere-$(AMSVER)-debug.zip out/atmosphere-$(AMSVER)-debug.zip
|
||||||
|
|
||||||
|
|
||||||
.PHONY: $(TOPTARGETS) $(COMPONENTS)
|
.PHONY: $(TOPTARGETS) $(COMPONENTS)
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ This software is licensed under the terms of the GPLv2, with exemptions for spec
|
|||||||
You can find a copy of the license in the [LICENSE file](LICENSE).
|
You can find a copy of the license in the [LICENSE file](LICENSE).
|
||||||
|
|
||||||
Exemptions:
|
Exemptions:
|
||||||
* The [yuzu emulator project](https://github.com/yuzu-emu/yuzu) is exempt from GPLv2 licensing and may (at its option) instead license any source code authored for the Atmosphère project as GPLv2 or later.
|
* The [yuzu Nintendo Switch emulator](https://github.com/yuzu-emu/yuzu) and the [Ryujinx Team and Contributors](https://github.com/orgs/Ryujinx) are exempt from GPLv2 licensing. They are permitted, each at their individual discretion, to instead license any source code authored for the Atmosphère project as either GPLv2 or later or the [MIT license](https://github.com/Atmosphere-NX/Atmosphere/blob/master/docs/licensing_exemptions/MIT_LICENSE). In doing so, they may alter, supplement, or entirely remove the copyright notice for each file they choose to relicense. Neither the Atmosphère project nor its individual contributors shall assert their moral rights against any of the aforementioned projects.
|
||||||
|
* [Nintendo](https://github.com/Nintendo) is exempt from GPLv2 licensing and may (at its option) instead license any source code authored for the Atmosphère project under the Zero-Clause BSD license.
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
=====
|
=====
|
||||||
|
|||||||
@@ -5,16 +5,8 @@ stage2_mtc_path = atmosphere/fusee-mtc.bin
|
|||||||
stage2_addr = 0xF0000000
|
stage2_addr = 0xF0000000
|
||||||
stage2_entrypoint = 0xF0000000
|
stage2_entrypoint = 0xF0000000
|
||||||
|
|
||||||
[exosphere]
|
|
||||||
; Note: Disabling debugmode will cause parts of ams.tma to not work, in the future.
|
|
||||||
debugmode = 1
|
|
||||||
debugmode_user = 0
|
|
||||||
; Note: Disabling usermode exception handlers will cause atmosphere to not fail gracefully under error conditions.
|
|
||||||
; Support will not be provided to users who disable these. If you do not know what you are doing, leave them on.
|
|
||||||
disable_user_exception_handlers = 0
|
|
||||||
; Note: It's currently unknown what effects enabling the usermode PMU register access may have on official code.
|
|
||||||
enable_user_pmu_access = 0
|
|
||||||
|
|
||||||
[stratosphere]
|
[stratosphere]
|
||||||
; To force-enable nogc, add nogc = 1
|
; To force-enable nogc, add nogc = 1
|
||||||
; To force-disable nogc, add nogc = 0
|
; To force-disable nogc, add nogc = 0
|
||||||
|
|
||||||
|
; To opt in to using Atmosphere's NCM reimplementation, add enable_ncm = 1
|
||||||
|
|||||||
45
config_templates/exosphere.ini
Normal file
45
config_templates/exosphere.ini
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Key: debugmode, default: 1.
|
||||||
|
# Desc: Controls whether kernel is debug mode.
|
||||||
|
# Disabling this may break Atmosphere's debugger in a future release.
|
||||||
|
|
||||||
|
# Key: debugmode_user, default: 0.
|
||||||
|
# Desc: Controls whether userland is debug mode.
|
||||||
|
|
||||||
|
# Key: disable_user_exception_handlers, default: 0.
|
||||||
|
# Desc: Controls whether user exception handlers are executed on error.
|
||||||
|
# NOTE: This will cause atmosphere to not fail gracefully.
|
||||||
|
# Support may not be provided to users tho disable these.
|
||||||
|
# If you do not know what you are doing, leave them on.
|
||||||
|
|
||||||
|
# Key: enable_user_pmu_access, default: 0.
|
||||||
|
# Desc: Controls whether userland has access to the PMU registers.
|
||||||
|
# NOTE: It is unknown what effects this has on official code.
|
||||||
|
|
||||||
|
# Key: blank_prodinfo_sysmmc, default: 0.
|
||||||
|
# Desc: Controls whether PRODINFO should be blanked in sysmmc.
|
||||||
|
# This will cause the system to see dummied out keys and
|
||||||
|
# serial number information.
|
||||||
|
# NOTE: This is not known to be safe, as data may be
|
||||||
|
# cached elsewhere in the system. Usage is not encouraged.
|
||||||
|
|
||||||
|
# Key: blank_prodinfo_emummc, default: 0.
|
||||||
|
# Desc: Controls whether PRODINFO should be blanked in emummc.
|
||||||
|
# NOTE: This is not known to be safe, as data may be
|
||||||
|
# cached elsewhere in the system. Usage is not encouraged.
|
||||||
|
|
||||||
|
# Key: allow_writing_to_cal_sysmmc, default: 0.
|
||||||
|
# Desc: Controls whether PRODINFO can be written by homebrew in sysmmc.
|
||||||
|
# NOTE: Usage of this setting is strongly discouraged without
|
||||||
|
# a safe backup elsewhere. Turning this on will also cause Atmosphere
|
||||||
|
# to ensure a safe backup of calibration data is stored in unused
|
||||||
|
# mmc space, encrypted to prevent detection. This backup can be used
|
||||||
|
# to prevent unrecoverable edits in emergencies.
|
||||||
|
|
||||||
|
[exosphere]
|
||||||
|
debugmode=1
|
||||||
|
debugmode_user=0
|
||||||
|
disable_user_exception_handlers=0
|
||||||
|
enable_user_pmu_access=0
|
||||||
|
blank_prodinfo_sysmmc=0
|
||||||
|
blank_prodinfo_emummc=0
|
||||||
|
allow_writing_to_cal_sysmmc=0
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,18 @@
|
|||||||
[hbl_config]
|
[hbl_config]
|
||||||
; program_id=010000000000100D
|
; Program Specific Config
|
||||||
|
; Up to 8 program-specific configurations can be set.
|
||||||
|
; These use `program_id_#` and `override_key_#`
|
||||||
|
; where # is in range [0,7].
|
||||||
|
; program_id_0=010000000000100D
|
||||||
|
; override_key_0=!R
|
||||||
|
|
||||||
|
; Any Application Config
|
||||||
|
; Note that this will only apply to program IDs that
|
||||||
|
; are both applications and not specified above
|
||||||
|
; by a program specific config.
|
||||||
; override_any_app=true
|
; override_any_app=true
|
||||||
; path=atmosphere/hbl.nsp
|
|
||||||
; override_key=!R
|
|
||||||
; override_any_app_key=R
|
; override_any_app_key=R
|
||||||
|
; path=atmosphere/hbl.nsp
|
||||||
|
|
||||||
[default_config]
|
[default_config]
|
||||||
; override_key=!L
|
; override_key=!L
|
||||||
|
|||||||
@@ -32,6 +32,12 @@
|
|||||||
; NOTE: EXPERIMENTAL
|
; NOTE: EXPERIMENTAL
|
||||||
; If you do not know what you are doing, do not touch this yet.
|
; If you do not know what you are doing, do not touch this yet.
|
||||||
; fsmitm_redirect_saves_to_sd = u8!0x0
|
; fsmitm_redirect_saves_to_sd = u8!0x0
|
||||||
|
; Controls whether to enable the deprecated hid mitm
|
||||||
|
; to fix compatibility with old homebrew.
|
||||||
|
; 0 = Do not enable, 1 = Enable.
|
||||||
|
; Please note this setting may be removed in a
|
||||||
|
; future release of Atmosphere.
|
||||||
|
; enable_deprecated_hid_mitm = u8!0x0
|
||||||
[hbloader]
|
[hbloader]
|
||||||
; Controls the size of the homebrew heap when running as applet.
|
; Controls the size of the homebrew heap when running as applet.
|
||||||
; If set to zero, all available applet memory is used as heap.
|
; If set to zero, all available applet memory is used as heap.
|
||||||
|
|||||||
@@ -1,8 +1,27 @@
|
|||||||
# Building Atmosphère
|
# Building Atmosphère
|
||||||
The process for building Atmosphère is similar to building Fusée Gelée payloads and other Switch apps.
|
Building Atmosphère is a very straightforward process that relies almost exclusively on tools provided by the [devkitPro](https://devkitpro.org) organization.
|
||||||
|
|
||||||
In order to build Atmosphère you must have devkitARM and devkitA64 installed on your computer. You can find instructions on how to install and setup devkitARM and devkitA64 on various OSes [here](https://devkitpro.org/wiki/Getting_Started). You'll need to install the following packages via (dkp-)pacman: switch-dev switch-freetype devkitARM devkitarm-rules
|
## Dependencies
|
||||||
|
+ [devkitA64](https://devkitpro.org)
|
||||||
|
+ [devkitARM](https://devkitpro.org)
|
||||||
|
+ [Python 2 or 3](https://www.python.org) (optional)
|
||||||
|
+ [PyCryptodome](https://pypi.org/project/pycryptodome) (optional)
|
||||||
|
|
||||||
sept requires you have python installed with the pycryptodome PyPi packages (`pip install pycryptodome`). You may also want to install the zip package from your package manager of choice to support the `make dist` recipe.
|
## Instructions
|
||||||
|
1. Follow the guide located [here](https://devkitpro.org/wiki/Getting_Started) to install and configure all the tools necessary for the build process.
|
||||||
|
|
||||||
Once you have finished installing the devkitPro-provided toolchain/libraries, python, and the dependencies, simply clone the Atmosphère repo (clone with the -r flag), change your directory to it and run `make`.
|
2. Install the following packages via (dkp-)pacman:
|
||||||
|
+ `switch-dev`
|
||||||
|
+ `switch-libjpeg-turbo`
|
||||||
|
+ `devkitARM`
|
||||||
|
+ `devkitarm-rules`
|
||||||
|
|
||||||
|
3. (Optional) In order to build [sept](components/sept.md) the pycryptodome PyPi package is required, which can be installed by running `pip install pycryptodome` under the installed Python environment of your choice or by installing the complete zip package to support the `make dist` recipe. This is an optional step included for advanced users who have the ability to provide the necessary encryption/signing keys themselves.
|
||||||
|
|
||||||
|
4. It is, instead, possible to build [sept](components/sept.md) by providing previously encrypted/signed binaries distributed by official Atmosphère release packages. In order to do so, export the following variables in your current environment:
|
||||||
|
+ `SEPT_00_ENC_PATH` (must point to the `sept-secondary_00.enc` file)
|
||||||
|
+ `SEPT_01_ENC_PATH` (must point to the `sept-secondary_01.enc` file)
|
||||||
|
+ `SEPT_DEV_00_ENC_PATH` (must point to the `sept-secondary_dev_00.enc` file)
|
||||||
|
+ `SEPT_DEV_01_ENC_PATH` (must point to the `sept-secondary_dev_01.enc` file)
|
||||||
|
|
||||||
|
5. Finally, clone the Atmosphère repository and run `make` under its root directory.
|
||||||
|
|||||||
@@ -1,4 +1,172 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.12.0
|
||||||
|
+ Configuration for exosphere was moved to sd:/exosphere.ini.
|
||||||
|
+ This is to facilitate BIS protection changes described below.
|
||||||
|
+ Hopefully having this outside of the Atmosphere folder will prevent accidental deletion, since this now contains important settings.
|
||||||
|
+ Atmosphere's bis protection policy for the PRODINFO partition was substantially reworked.
|
||||||
|
+ Support was added for "automatically" performing a "blanking" operation to PRODINFO without actually modifying NAND.
|
||||||
|
+ This is equivalent to using the "incognito" homebrew tool, but NAND is never actually modified.
|
||||||
|
+ This can be turned on in sysmmc by setting `blank_prodinfo_sysmmc=1` in exosphere.ini, and in emummc by setting `blank_prodinfo_emummc=1` in exosphere.ini.
|
||||||
|
+ **Please note**: This is not known to be safe. There is a lack of research on whether the information blanked out is cached elsewhere in the system.
|
||||||
|
+ Usage of this option is not encouraged for this reason.
|
||||||
|
+ Support was added for writing to the PRODINFO partition, if a verified encrypted backup has been made.
|
||||||
|
+ PRODINFO is the only system data that cannot be recovered if not backed up, and thus Atmosphere has backed it up to the SD card on boot for some time now.
|
||||||
|
+ Users who wish to modify their calibration data may now do so unconditionally in emummc, and in sysmmc if `allow_writing_to_cal_sysmmc=1` is set in exosphere.ini.
|
||||||
|
+ **Please note**: This is heavily discouraged, and the typical user will almost never want to do this.
|
||||||
|
+ Setting this option will cause Atmosphere to attempt to verify (or create) an encrypted backup of the PRODINFO data to an unused region in the partition.
|
||||||
|
+ The backup is encrypted with per-console keys that Atmosphere's developers do not know.
|
||||||
|
+ If the backup is not verified or created, writes will not work. Users who have corrupted their PRODINFO in the past are encouraged to flash a good backup to allow use of this setting.
|
||||||
|
+ Reads and writes to the region used for the securely encrypted backup will appear to succeed, but will actually read/write from a buffer filled with garbage in memory.
|
||||||
|
+ Support will be investigated in the future for supporting booting with fully blanked calibration.
|
||||||
|
+ This is desirable to allow boot to succeed for users who lost their calibration data due to bricking homebrew before bis protection was implemented.
|
||||||
|
+ `creport` has been updated to use the new screenshot APIs added in 9.0.0+.
|
||||||
|
+ On 10.0.0+, if a crash occurs in an application (not applet or sysmodule) a screenshot will now be automatically saved to the SD card.
|
||||||
|
+ If the user applies a patch to vi on 9.0.0 (as the command this uses was previously for dev-units only), this can also work on 9.0.0.
|
||||||
|
+ The new sysmodule `pgl` added in 10.0.0 was reimplemented.
|
||||||
|
+ `pgl` ("Program Launcher", probably) is responsible for managing launched user-processes, previously this was handled by NS.
|
||||||
|
+ The most exciting thing about pgl is that it finally provides an API for multiple clients to subscribe to process events.
|
||||||
|
+ Using these new APIs, system modules / other homebrew can subscribe to be notified whenever a process event occurs.
|
||||||
|
+ This means action can be taken on process launch, process exit, process crash, etc.
|
||||||
|
+ A slight concern with Nintendo's implementation is that each subscriber object uses 0x448 bytes of memory, and N only reserves 8KB for all allocations in pgl.
|
||||||
|
+ Atmosphere's implementation uses a 32KB heap, which should not be exhaustible.
|
||||||
|
+ Atmosphere's implementation has a total memory footprint roughly 0x28000 bytes smaller than Nintendo's.
|
||||||
|
+ A reimplementation was added for the `jpegdec` system module (thanks @HookedBehemoth)!
|
||||||
|
+ This allows two sessions instead of 1, so homebrew can now use it for software jpeg decoding in addition to the OS itself.
|
||||||
|
+ As usual the implementation has a very slightly smaller memory footprint than Nintendo's.
|
||||||
|
+ `dmnt`'s Cheat VM was extended to add three new opcodes.
|
||||||
|
+ The first new opcode, "ReadWriteStaticRegister", allows for cheats to read from a bank of 128 read-only static registers, and write to a bank of 128 write-only static registers.
|
||||||
|
+ This can be used in concert with new IPC commands that allow a cheat manager to read or write the value of these static registers to have "dynamic" cheats.
|
||||||
|
+ As an example, a cheat manager could write a value to a static register that a cheat to control how many of an item to give in a game.
|
||||||
|
+ As another example, a cheat manager could read a static register that a cheat writes to to learn how many items a player has.
|
||||||
|
+ The second and third opcodes are a pair, "PauseProcess" and "ResumeProcess".
|
||||||
|
+ Executing pause process in a cheat will pause the game (it will be frozen) until a resume process opcode is used.
|
||||||
|
+ These are also available over IPC, for cheat managers or system modules that want to pause or resume the attached cheat process.
|
||||||
|
+ This allows a cheat to know that the game won't modify or access data the cheat is accessing.
|
||||||
|
+ For example, this can be used to prevent Pokemon from seeing a pokemon a cheat is in the middle of injecting and turning it into a bad egg.
|
||||||
|
+ A bug was fixed that would cause the console to crash when connected to Wi-Fi on versions between 3.0.0 and 4.1.0 inclusive.
|
||||||
|
+ A bug was fixed that could cause boot to fail sporadically due to cache/tlb mismanagement when doing physical ASLR of the kernel.
|
||||||
|
+ A number of other minor issues were addressed (and more of Atmosphere was updated to reflect other changes in 10.0.x).
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
|
## 0.11.1
|
||||||
|
+ A bug was fixed that could cause owls to flicker under certain circumstances.
|
||||||
|
+ For those interested in technical details, in 10.0.0 kernelldr/kernel no longer set cpuactlr_el1, assuming that it was set correctly by the secure monitor.
|
||||||
|
+ However, exosphere did not set cpuactlr_el1. This meant that the register held the reset value going into boot.
|
||||||
|
+ This caused a variety of highly erratic symptoms, including causing basically any game to crash seemingly randomly.
|
||||||
|
+ A number of other major inaccuracies in exosphere were corrected.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
|
## 0.11.0
|
||||||
|
+ Support was added for 10.0.0.
|
||||||
|
+ Exosphere has been updated to reflect the new key import semantics in 10.0.0.
|
||||||
|
+ kernel_ldr now implements physical ASLR for the kernel's backing pages.
|
||||||
|
+ Loader, NCM, and PM have been updated to reflect the changes Nintendo made in 10.0.0.
|
||||||
|
+ Creport was updated to use the new `pgl` service to terminate processes instead of `ns:dev`.
|
||||||
|
+ A reimplementation of the `erpt` (error reports) system module was added.
|
||||||
|
+ In previous versions of Atmosphere, a majority of error reports were prevented via a combination of custom creport, fatal, and stubbed eclct.
|
||||||
|
+ However, error reports were still generated via some system actions.
|
||||||
|
+ Most notably, any time the error applet appeared, an error report was generated.
|
||||||
|
+ By default, atmosphere disabled the *uploading* of error reports, but going online in OFW after an error report occurred in Atmosphere could lead to undesirable telemetry.
|
||||||
|
+ Atmosphere's `erpt` reimplementation allows the system to interact with existing error reports as expected.
|
||||||
|
+ However, all new error reports are instead saved to the sd card (`/atmosphere/erpt_reports`), and are not committed to the system savegame.
|
||||||
|
+ Users curious about what kind of telemetry is being prevented can view the reports as they're generated in there.
|
||||||
|
+ Reports are saved as msgpack (as this is what Nintendo uses).
|
||||||
|
+ Please note, not all telemetry is disabled. Play reports and System reports will continue to function unmodified.
|
||||||
|
+ With atmosphere's `erpt` implementation, homebrew can now use the native error applet to display errors without worrying about generating undesirable telemetry.
|
||||||
|
+ libstratosphere and libvapours received a number of improvements.
|
||||||
|
+ With thanks to @Adubbz for his work, the NCM namespace now has client code.
|
||||||
|
+ This lays the groundwork for first-class system update/downgrade homebrew support in the near future.
|
||||||
|
+ In particular, code implementing the os namespace is significantly more accurate.
|
||||||
|
+ In addition, Nintendo's allocators were implemented, allowing for identical memory efficiency versus Nintendo's implementations.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
|
## 0.10.5
|
||||||
|
+ Changes were made to the way fs.mitm builds images when providing a layeredfs romfs.
|
||||||
|
+ Building romfs metadata previously had a memory cost of about ~4-5x the file table size.
|
||||||
|
+ This caused games that have particularly enormous file metadata tables (> 4 MB) to exhaust fs.mitm's 16 MB memory pool.
|
||||||
|
+ The code that creates romfs images was thus changed to be significantly more memory efficient, again.
|
||||||
|
+ Memory requirements have been lowered from ~4x file table size to ~2x file table size + 0.5 MB.
|
||||||
|
+ There is a slight speed penalty to this, but testing on Football Manager 2020 only took an extra ~1.5 seconds for the game to boot with many modded files.
|
||||||
|
+ This shouldn't be noticeable thanks to the async changes made in 0.10.2.
|
||||||
|
+ If you encounter a game that exhausts ams.mitm's memory (crashing it) when loading layeredfs mods, please contact SciresM.
|
||||||
|
+ Romfs building can be made even more memory efficient, but unless games show up with even more absurdly huge file tables it seems not worth the speed trade-off.
|
||||||
|
+ A bug was fixed that caused Atmosphere's fatal error context to not dump TLS for certain processes.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
|
## 0.10.4
|
||||||
|
+ With major thanks to @Adubbz for his work, the NCM system module has now been re-implemented.
|
||||||
|
+ This was a major stepping stone towards the goal of having implementations everything in the Switch's package1/package2 firmware.
|
||||||
|
+ This also lays the groundwork for libstratosphere providing bindings for changing the installed version of the Switch's OS.
|
||||||
|
+ **Please Note**: The NCM implementation will initially be opt-in.
|
||||||
|
+ The Atmosphere team is confident in our NCM implementation (and we have tested it on every firmware version).
|
||||||
|
+ That said, this is our first system module that manages NAND savegames -- and caution is a habit.
|
||||||
|
+ We do not anticipate any issues that didn't come up in testing, so this is just our being particularly careful.
|
||||||
|
+ Users interested in opting in to using our implementation should set `stratosphere!ncm_enabled = 1` in BCT.ini.
|
||||||
|
+ In the unlikely event that any issues are encountered, please report them to @SciresM.
|
||||||
|
+ The NCM implementation will stop being opt-in in a future update, after thorough testing has been done in practice.
|
||||||
|
+ A bug was fixed in emummc that caused Nintendo path to be corrupted on 1.0.0.
|
||||||
|
+ This manifested as the emummc folder being created inside the virtual NAND instead of the SD card.
|
||||||
|
+ It's unlikely there are any negative consequences to this in practice.
|
||||||
|
+ If you want to be truly sure, you can re-clone sysmmc before updating a 1.0.0 emummc to latest firmware.
|
||||||
|
+ Stratosphere system modules now use new Nintendo-style FS bindings instead of stdio.
|
||||||
|
+ This saves a modest amount of memory due to leaner code, and greatly increases the accuracy of several components.
|
||||||
|
+ These bindings will make it easier for other system modules using libstratosphere to interact with the filesystem.
|
||||||
|
+ This also lays the groundwork for changes necessary to support per-emummc Atmosphere folders in a future update.
|
||||||
|
+ Atmosphere's fatal error context now dumps 0x100 of TLS.
|
||||||
|
+ This will make it much easier to fix bugs when an error report is dumped for whatever caused the crash.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
|
## 0.10.3
|
||||||
|
+ Support was added for 9.2.0.
|
||||||
|
+ Support was added for redirecting manual html content for games.
|
||||||
|
+ This works like normal layeredfs, replacing content placed in `/atmosphere/contents/<program id>/manual_html/`.
|
||||||
|
+ This allows for game mods/translations to provide custom manual content, if they so choose.
|
||||||
|
+ A number of improvements were made to Atmosphere's memory usage, including:
|
||||||
|
+ `fatal` now uses STB instead of freetype for rendering.
|
||||||
|
+ This saves around 1 MB of memory, and makes our fatal substantially leaner than Nintendo's.
|
||||||
|
+ `sm` no longer wastes 2 MiB unnecessarily.
|
||||||
|
+ fusee/sept's sdmmc access now better matches official behavior.
|
||||||
|
+ This improves compatibility with some SD cards.
|
||||||
|
+ `ro` has been updated to reflect changes made in 9.1.0.
|
||||||
|
+ The temporary auto-migration added in 0.10.0 has been removed, since the transitionary period is well over.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
|
## 0.10.2
|
||||||
|
+ hbl configuration was made more flexible.
|
||||||
|
+ Up to eight specific program ids can now be specified to have their own override keys.
|
||||||
|
+ This allows designating both the album applet and a specific game as hbl by default as desired.
|
||||||
|
+ Configuration targeting a specific program is now mutually exclusive with override-any-app for that program.
|
||||||
|
+ This fixes unintuitive behavior when override key differed for an application specific program.
|
||||||
|
+ Loader's external content fileystem support was fixed (thanks @misson20000!).
|
||||||
|
+ KernelLdr was reimplemented.
|
||||||
|
+ This is the first step towards developing mesosphere, Atmosphere's planned reimplementation of the Switch's Kernel.
|
||||||
|
+ The typical user won't notice anything different, as there are no extensions, but a lot of groundwork was laid for future development.
|
||||||
|
+ Improvements were made to the way Atmosphere's buildsystem detects source code files.
|
||||||
|
+ This significantly reduces compilation time (saving >30 seconds) on the machine that builds official releases.
|
||||||
|
+ Certain device code was cleaned up and made more correct in fusee/sept/exosphere (thanks @hexkyz!).
|
||||||
|
+ A number of changes were made to the way fs.mitm builds images when providing a layeredfs romfs.
|
||||||
|
+ Some games (Resident Evil 6, Football Manager 2020 Touch, possibly others) have enormous numbers of files.
|
||||||
|
+ Attempting to create a layeredfs mod for these games actually caused fs.mitm to run out of memory, causing a fatal error.
|
||||||
|
+ The code that creates these images was changed to be significantly more memory efficient.
|
||||||
|
+ However, these changes also cause a significant slowdown in the romfs building code (~2-5x).
|
||||||
|
+ This introduced a noticeable stutter when launching a game, because the UI thread would block on the romfs creation.
|
||||||
|
+ To solve this, fs.mitm now lazily initializes the image in a background thread.
|
||||||
|
+ This fixes stutter issues, however some games may be slightly slower (~1-2s in the worst cases) to transition from the "loading" GIF to gameplay now.
|
||||||
|
+ Please note: the slowdown is not noticeable in the common case where games don't have tons of files (typical is ~0.1-0.2 seconds).
|
||||||
|
+ Once the image has been built, there is no further speed penalty at runtime -- only when the game is launched.
|
||||||
|
+ A number of other bugs were fixed, including:
|
||||||
|
+ Several minor logic inversions that could have caused fatal errors when modding games.
|
||||||
|
+ Atmosphere's new-ipc code did not handle "automatic" recvlist buffers correctly, so some non-libnx homebrew could crash.
|
||||||
|
+ fs.mitm now correctly mitms sdb, which makes redirection of certain system data archives work again.
|
||||||
|
+ In 0.10.0/0.10.1, changing the system font/language did not work correctly due to this.
|
||||||
|
+ A bug was fixed in process cleanup that caused the system to hang on < 5.0.0.
|
||||||
|
+ The temporary hid-mitm added in Atmosphere 0.9.0 was disabled by default.
|
||||||
|
+ Please ensure your homebrew is updated.
|
||||||
|
+ For now, users may re-enable this mitm by use of a custom setting (`atmosphere!enable_deprecated_hid_mitm`) to ease the transition process some.
|
||||||
|
+ Please note: support for this setting may be removed to save memory in a future atmosphere release.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.10.1
|
## 0.10.1
|
||||||
+ A bug was fixed that caused memory reallocation to the system pool to work improperly on firmware 5.0.0 and above.
|
+ A bug was fixed that caused memory reallocation to the system pool to work improperly on firmware 5.0.0 and above.
|
||||||
+ Atmosphere was always trying to deallocate memory away from the applet pool and towards the system pool.
|
+ Atmosphere was always trying to deallocate memory away from the applet pool and towards the system pool.
|
||||||
@@ -27,6 +195,7 @@
|
|||||||
+ Please ensure your homebrew is updated.
|
+ Please ensure your homebrew is updated.
|
||||||
+ Random number generation now uses TinyMT instead of XorShift.
|
+ Random number generation now uses TinyMT instead of XorShift.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.10.0
|
## 0.10.0
|
||||||
+ Support was added for 9.1.0
|
+ Support was added for 9.1.0
|
||||||
+ **Please note**: The temporary hid-mitm added in Atmosphere 0.9.0 will be removed in Atmosphere 0.10.1.
|
+ **Please note**: The temporary hid-mitm added in Atmosphere 0.9.0 will be removed in Atmosphere 0.10.1.
|
||||||
@@ -91,6 +260,7 @@
|
|||||||
+ An off-by-one was fixed that could cause memory corruption in server memory management.
|
+ An off-by-one was fixed that could cause memory corruption in server memory management.
|
||||||
+ ... and too many more bugs fixed to reasonably list them all :)
|
+ ... and too many more bugs fixed to reasonably list them all :)
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.9.4
|
## 0.9.4
|
||||||
+ Support was added for 9.0.0.
|
+ Support was added for 9.0.0.
|
||||||
+ **Please note**: 9.0.0 made a number of changes that may cause some issues with homebrew. Details:
|
+ **Please note**: 9.0.0 made a number of changes that may cause some issues with homebrew. Details:
|
||||||
@@ -110,6 +280,7 @@
|
|||||||
+ Newer hardware uses new, per-firmware device key to generate BIS keys instead of the first device key, so previously the wrong keys were generated as backup.
|
+ Newer hardware uses new, per-firmware device key to generate BIS keys instead of the first device key, so previously the wrong keys were generated as backup.
|
||||||
+ This only affects units manufactured after ~5.0.0.
|
+ This only affects units manufactured after ~5.0.0.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.9.3
|
## 0.9.3
|
||||||
+ Thanks to hexkyz, fusee's boot sequence has been greatly optimized.
|
+ Thanks to hexkyz, fusee's boot sequence has been greatly optimized.
|
||||||
+ Memory training is now managed by a separate binary (`fusee-mtc`, loaded by fusee-primary before fusee-secondary).
|
+ Memory training is now managed by a separate binary (`fusee-mtc`, loaded by fusee-primary before fusee-secondary).
|
||||||
@@ -133,6 +304,7 @@
|
|||||||
+ Incorrect display output ("2000-0000") has been fixed. Fatal will now correctly show 2162-0002 when this occurs.
|
+ Incorrect display output ("2000-0000") has been fixed. Fatal will now correctly show 2162-0002 when this occurs.
|
||||||
+ A longstanding bug in how fatal manages the displays has been fixed, and official display init behavior is now matched precisely.
|
+ A longstanding bug in how fatal manages the displays has been fixed, and official display init behavior is now matched precisely.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.9.2
|
## 0.9.2
|
||||||
+ A number of emummc bugfixes were added (all thanks to @m4xw's hard work). The following is a summary of emummc changes:
|
+ A number of emummc bugfixes were added (all thanks to @m4xw's hard work). The following is a summary of emummc changes:
|
||||||
+ Support for file-based emummc instances was fixed.
|
+ Support for file-based emummc instances was fixed.
|
||||||
@@ -156,10 +328,12 @@
|
|||||||
+ The rewritten modules consistently have lower memory footprints, and should be easier to maintain going forwards.
|
+ The rewritten modules consistently have lower memory footprints, and should be easier to maintain going forwards.
|
||||||
+ The `sm`, `boot`, `spl`, `ro`, and `loader` modules have been tackled so far.
|
+ The `sm`, `boot`, `spl`, `ro`, and `loader` modules have been tackled so far.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.9.1
|
## 0.9.1
|
||||||
+ Support was added for 8.1.0.
|
+ Support was added for 8.1.0.
|
||||||
+ Please note, emummc is still considered **beta/experimental** -- this is not the inevitable bugfix update for it, although some number of bugs have been fixed. :)
|
+ Please note, emummc is still considered **beta/experimental** -- this is not the inevitable bugfix update for it, although some number of bugs have been fixed. :)
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
+ Creport output was improved significantly.
|
+ Creport output was improved significantly.
|
||||||
+ Thread names are now dumped on crash in addition to 0x100 of TLS from each thread.
|
+ Thread names are now dumped on crash in addition to 0x100 of TLS from each thread.
|
||||||
@@ -184,6 +358,7 @@
|
|||||||
+ This can be set to any arbitrary directory by setting `emummc!emummc_nintendo_path`.
|
+ This can be set to any arbitrary directory by setting `emummc!emummc_nintendo_path`.
|
||||||
+ To create a backup usable for emummc, users may use tools provided by the [hekate](https://github.com/CTCaer/hekate) project.
|
+ To create a backup usable for emummc, users may use tools provided by the [hekate](https://github.com/CTCaer/hekate) project.
|
||||||
+ If, when using emummc, you encounter a bug, *please be sure to report it* -- that's the only way we can fix it. :)
|
+ If, when using emummc, you encounter a bug, *please be sure to report it* -- that's the only way we can fix it. :)
|
||||||
|
|
||||||
## 0.8.10
|
## 0.8.10
|
||||||
+ A bug was fixed that could cause incorrect system memory allocation on 5.0.0.
|
+ A bug was fixed that could cause incorrect system memory allocation on 5.0.0.
|
||||||
+ 5.0.0 should now correctly have an additional 12 MiB allocated for sysmodules.
|
+ 5.0.0 should now correctly have an additional 12 MiB allocated for sysmodules.
|
||||||
@@ -200,6 +375,7 @@
|
|||||||
+ NAND repair occurs when an unexpected shutdown or error happens during a system update.
|
+ NAND repair occurs when an unexpected shutdown or error happens during a system update.
|
||||||
+ This fixes a final edge case where AutoRCM might be removed by HOS, which could cause a user to burn fuses.
|
+ This fixes a final edge case where AutoRCM might be removed by HOS, which could cause a user to burn fuses.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.9
|
## 0.8.9
|
||||||
+ A number of bugs were fixed, including:
|
+ A number of bugs were fixed, including:
|
||||||
+ A data abort was fixed when mounting certain partitions on NAND.
|
+ A data abort was fixed when mounting certain partitions on NAND.
|
||||||
@@ -225,6 +401,7 @@
|
|||||||
+ `spl` (Secure Platform Services) is responsible for cryptographic operations, including all communications with the secure monitor (exosphère).
|
+ `spl` (Secure Platform Services) is responsible for cryptographic operations, including all communications with the secure monitor (exosphère).
|
||||||
+ In the future, this may be used to provide extensions to the API for interacting with exosphère from userland.
|
+ In the future, this may be used to provide extensions to the API for interacting with exosphère from userland.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.8
|
## 0.8.8
|
||||||
+ Support was added for firmware version 8.0.0.
|
+ Support was added for firmware version 8.0.0.
|
||||||
+ Custom exception handlers were added to stratosphere modules.
|
+ Custom exception handlers were added to stratosphere modules.
|
||||||
@@ -232,6 +409,7 @@
|
|||||||
+ A bug was fixed in creport that caused games to hang when crashing under certain circumstances.
|
+ A bug was fixed in creport that caused games to hang when crashing under certain circumstances.
|
||||||
+ A bug was fixed that prevented maintenance mode from booting on 7.0.0+.
|
+ A bug was fixed that prevented maintenance mode from booting on 7.0.0+.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.7
|
## 0.8.7
|
||||||
+ A few bugs were fixed that could cause fatal to fail to show an error under certain circumstances.
|
+ A few bugs were fixed that could cause fatal to fail to show an error under certain circumstances.
|
||||||
+ A bug was fixed that caused an error when launching certain games (e.g. Hellblade: Senua's Sacrifice).
|
+ A bug was fixed that caused an error when launching certain games (e.g. Hellblade: Senua's Sacrifice).
|
||||||
@@ -247,6 +425,7 @@
|
|||||||
+ Please note, this feature is **experimental**, and may cause problems. Please use at your own risk (and back up your saves before enabling it), as it still needs testing.
|
+ Please note, this feature is **experimental**, and may cause problems. Please use at your own risk (and back up your saves before enabling it), as it still needs testing.
|
||||||
+ This can be enabled by setting `atmosphere!fsmitm_redirect_saves_to_sd` to 1 in `system_settings.ini`.
|
+ This can be enabled by setting `atmosphere!fsmitm_redirect_saves_to_sd` to 1 in `system_settings.ini`.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.6
|
## 0.8.6
|
||||||
+ A number of bugs were fixed, including:
|
+ A number of bugs were fixed, including:
|
||||||
+ A case of inverted logic was fixed in fs.mitm which prevented the flags system from working correctly.
|
+ A case of inverted logic was fixed in fs.mitm which prevented the flags system from working correctly.
|
||||||
@@ -284,6 +463,7 @@
|
|||||||
+ fs.mitm will also now cause requests to mount the HtmlDocument content for HBL's title to open the `sdmc:/atmosphere/hbl_html` folder.
|
+ fs.mitm will also now cause requests to mount the HtmlDocument content for HBL's title to open the `sdmc:/atmosphere/hbl_html` folder.
|
||||||
+ By default, this just contains a URL whitelist.
|
+ By default, this just contains a URL whitelist.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.5
|
## 0.8.5
|
||||||
+ Support was added for overriding content on a per-title basis, separate from HBL override.
|
+ Support was added for overriding content on a per-title basis, separate from HBL override.
|
||||||
+ This allows for using mods on the same title that one uses to launch HBL.
|
+ This allows for using mods on the same title that one uses to launch HBL.
|
||||||
@@ -305,6 +485,7 @@
|
|||||||
+ A bug was fixed that would cause Atmosphère's fatal screen to not show on 1.0.0-2.3.0.
|
+ A bug was fixed that would cause Atmosphère's fatal screen to not show on 1.0.0-2.3.0.
|
||||||
+ A bug was fixed that caused Atmosphère's automatic ProdInfo backups to be corrupt.
|
+ A bug was fixed that caused Atmosphère's automatic ProdInfo backups to be corrupt.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.4
|
## 0.8.4
|
||||||
+ Support for 7.0.0/7.0.1 was added.
|
+ Support for 7.0.0/7.0.1 was added.
|
||||||
+ This is facilitated through a new payload, `sept`, which can be signed, encrypted, and then loaded by Nintendo's TSEC firmware.
|
+ This is facilitated through a new payload, `sept`, which can be signed, encrypted, and then loaded by Nintendo's TSEC firmware.
|
||||||
@@ -320,6 +501,7 @@
|
|||||||
+ Performing a reboot from the reboot menu now reboots to atmosphere. This can be configured via `system_settings.ini`.
|
+ Performing a reboot from the reboot menu now reboots to atmosphere. This can be configured via `system_settings.ini`.
|
||||||
+ Performing a shutdown from the reboot menu now works properly with AutoRCM, and does a real shutdown.
|
+ Performing a shutdown from the reboot menu now works properly with AutoRCM, and does a real shutdown.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.3
|
## 0.8.3
|
||||||
+ A custom warmboot firmware was implemented, which does not perform anti-downgrade fuse checks.
|
+ A custom warmboot firmware was implemented, which does not perform anti-downgrade fuse checks.
|
||||||
+ This fixes sleep mode when using a downgraded NAND.
|
+ This fixes sleep mode when using a downgraded NAND.
|
||||||
@@ -340,6 +522,7 @@
|
|||||||
+ Fatal will now use this to reboot to sdmc:/atmosphere/reboot_payload.bin if present, when a vol button is pressed.
|
+ Fatal will now use this to reboot to sdmc:/atmosphere/reboot_payload.bin if present, when a vol button is pressed.
|
||||||
+ An example homebrew ("reboot_to_payload") was also written and is now included with Atmosphère.
|
+ An example homebrew ("reboot_to_payload") was also written and is now included with Atmosphère.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.2
|
## 0.8.2
|
||||||
+ A number of bugs were fixed causing users to sometimes see `Key Derivation Failed!`.
|
+ A number of bugs were fixed causing users to sometimes see `Key Derivation Failed!`.
|
||||||
+ KFUSE clock enable timings have been adjusted to allow time to stabilize before TSEC is granted access.
|
+ KFUSE clock enable timings have been adjusted to allow time to stabilize before TSEC is granted access.
|
||||||
@@ -349,6 +532,7 @@
|
|||||||
+ A bug was fixed causing sleep mode to not work with debugmode enabled.
|
+ A bug was fixed causing sleep mode to not work with debugmode enabled.
|
||||||
+ As a result, debugmode is now enabled in the default BCT.ini.
|
+ As a result, debugmode is now enabled in the default BCT.ini.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.1
|
## 0.8.1
|
||||||
+ A bug was fixed causing users to see `Failed to enable SMMU!` if fusee had previously rebooted.
|
+ A bug was fixed causing users to see `Failed to enable SMMU!` if fusee had previously rebooted.
|
||||||
+ This message will still occur sporadically if fusee is not launched from coldboot, but it can never happen twice in a row.
|
+ This message will still occur sporadically if fusee is not launched from coldboot, but it can never happen twice in a row.
|
||||||
@@ -370,6 +554,7 @@
|
|||||||
+ On fatal error, the user can now choose to perform a standard reboot via the power button, or a reboot into RCM via either volume button.
|
+ On fatal error, the user can now choose to perform a standard reboot via the power button, or a reboot into RCM via either volume button.
|
||||||
+ A custom message was added to `fatal` for when an Atmosphère API version mismatch is detected (2495-1623).
|
+ A custom message was added to `fatal` for when an Atmosphère API version mismatch is detected (2495-1623).
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.8.0
|
## 0.8.0
|
||||||
+ A custom `fatal` system module was added.
|
+ A custom `fatal` system module was added.
|
||||||
+ This re-implements and extends Nintendo's fatal module, with the following features:
|
+ This re-implements and extends Nintendo's fatal module, with the following features:
|
||||||
@@ -403,6 +588,7 @@
|
|||||||
+ By default, new keys will automatically be derived without user input.
|
+ By default, new keys will automatically be derived without user input.
|
||||||
+ Support is also present for loading new keys from `atmosphere/prod.keys` or `atmosphere/dev.keys`
|
+ Support is also present for loading new keys from `atmosphere/prod.keys` or `atmosphere/dev.keys`
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.7.5
|
## 0.7.5
|
||||||
+ DRAM training was added to fusee-secondary, courtesy @hexkyz.
|
+ DRAM training was added to fusee-secondary, courtesy @hexkyz.
|
||||||
+ This greatly improves the speed of memory accesses during boot, resulting in a boot time that is ~200-400% faster.
|
+ This greatly improves the speed of memory accesses during boot, resulting in a boot time that is ~200-400% faster.
|
||||||
@@ -411,6 +597,7 @@
|
|||||||
+ This matches the improvement Nintendo added to official creport in 6.1.0.
|
+ This matches the improvement Nintendo added to official creport in 6.1.0.
|
||||||
+ The code region detection heuristic was further improved by checking whether an address points to .rodata or .rwdata, instead of just .text.
|
+ The code region detection heuristic was further improved by checking whether an address points to .rodata or .rwdata, instead of just .text.
|
||||||
+ This means that a crash appears in a loaded NRO (or otherwise discontiguous) code region, creport will be able to detect all active code regions, and not just that one.
|
+ This means that a crash appears in a loaded NRO (or otherwise discontiguous) code region, creport will be able to detect all active code regions, and not just that one.
|
||||||
|
|
||||||
## 0.7.4
|
## 0.7.4
|
||||||
+ [libstratosphere](https://github.com/Atmosphere-NX/libstratosphere) has been completely refactored/rewritten, and split into its own, separate submodule.
|
+ [libstratosphere](https://github.com/Atmosphere-NX/libstratosphere) has been completely refactored/rewritten, and split into its own, separate submodule.
|
||||||
+ While this is mostly "under the hood" for end-users, the refactor is faster (improving both boot-time and runtime performance), more accurate (many of the internal IPC structures are now bug-for-bug compatible with Nintendo's implementations), and significantly more stable (it fixes a large number of bugs present in the old library).
|
+ While this is mostly "under the hood" for end-users, the refactor is faster (improving both boot-time and runtime performance), more accurate (many of the internal IPC structures are now bug-for-bug compatible with Nintendo's implementations), and significantly more stable (it fixes a large number of bugs present in the old library).
|
||||||
@@ -431,11 +618,13 @@
|
|||||||
+ PM now only gives full FS permissions to the active KIPs. This fixes a potential crash where new processes might be unable to be registered with FS.
|
+ PM now only gives full FS permissions to the active KIPs. This fixes a potential crash where new processes might be unable to be registered with FS.
|
||||||
+ The `make dist` target now includes the branch in the generated zip name.
|
+ The `make dist` target now includes the branch in the generated zip name.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.7.3
|
## 0.7.3
|
||||||
+ Loader and fs.mitm now try to reload loader.ini before reading it. This allows for changing the override button combination/HBL title id at runtime.
|
+ Loader and fs.mitm now try to reload loader.ini before reading it. This allows for changing the override button combination/HBL title id at runtime.
|
||||||
+ Added a MitM between set:sys and qlaunch, used to override the system version string displayed in system settings.
|
+ Added a MitM between set:sys and qlaunch, used to override the system version string displayed in system settings.
|
||||||
+ The displayed system version will now display `<Actual version> (AMS <x>.<y>.<z>)`.
|
+ The displayed system version will now display `<Actual version> (AMS <x>.<y>.<z>)`.
|
||||||
+ General system stability improvements to enhance the user's experience.
|
+ General system stability improvements to enhance the user's experience.
|
||||||
|
|
||||||
## 0.7.2
|
## 0.7.2
|
||||||
+ Fixed a bug in fs.mitm's LayeredFS read implementation that caused some games to crash when trying to read files.
|
+ Fixed a bug in fs.mitm's LayeredFS read implementation that caused some games to crash when trying to read files.
|
||||||
+ Fixed a bug affecting 1.0.0 that caused games to crash with fatal error 2001-0106 on boot.
|
+ Fixed a bug affecting 1.0.0 that caused games to crash with fatal error 2001-0106 on boot.
|
||||||
|
|||||||
4
docs/components/emummc.md
Normal file
4
docs/components/emummc.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# emummc
|
||||||
|
emummc is a collaborative project that provides eMMC storage emulation.
|
||||||
|
|
||||||
|
Please refer to the project's repository [here](https://github.com/m4xw/emuMMC) for detailed instructions and documentation.
|
||||||
@@ -1,10 +1,76 @@
|
|||||||
# Exosphère
|
# exosphère
|
||||||
Exosphère is a reimplementation of Arm's TrustZone (TZ), also known as Secure Monitor (Secure_Monitor.bin). It has the highest privilege mode available on the Switch’s processor, and has access to everything on the console.
|
exosphère is a customized reimplementation of the Horizon OS's Secure Monitor.
|
||||||
|
The Secure Monitor follows the same design principle as Arm's TrustZone and both terms can be used interchangeably in this context. It runs at the highest privilege mode (EL3) available to the main processor and is responsible for all the sensitive cryptographic operations needed by the system as well as power management for each CPU.
|
||||||
Exosphère will potentially play a big role in Jamais Vu and Déja Vu, which are upcoming software exploits for the Switch, allowing one to launch Atmosphère on a Fusée-Gélee patched (ipatched) Switch console, and will also enable one to launch into CFW directly from the Switch itself without the use of any sort of external device, such as a computer or RCM jig, provided they are on a low enough system firmware.
|
|
||||||
|
|
||||||
## TrustZone/Secure Monitor
|
|
||||||
TrustZone is responsible for all the cryptographic operations on the Switch. The idea behind the way it operates is that all the keys stay in the TrustZone, and userspace only gets "handles" to them. This would make sure that keydata never leaks and is kept secure. It also has a few more responsibilities, such as power management, providing a source of random numbers, and providing access to various pieces of information that are stored in the fuses.
|
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
Exosphère currently only contains one extension, an SMC allowing homebrew to find which version of Atmosphère is currently running, in order to find out what extensions are allowed to be used.
|
exosphère expands the original Secure Monitor design by providing custom SMCs (Secure Monitor Calls) necessary to the homebrew ecosystem. Currently, these are:
|
||||||
|
```
|
||||||
|
uint32_t smc_ams_iram_copy(smc_args_t *args);
|
||||||
|
uint32_t smc_ams_write_address(smc_args_t *args);
|
||||||
|
uint32_t smc_ams_get_emummc_config(smc_args_t *args);
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, exosphère expands the functionality of two SMCs provided by the Horizon OS for getting/setting configuration items. The following custom configuration items are provided by exosphère:
|
||||||
|
```
|
||||||
|
CONFIGITEM_EXOSPHERE_VERSION = 65000,
|
||||||
|
CONFIGITEM_NEEDS_REBOOT = 65001,
|
||||||
|
CONFIGITEM_NEEDS_SHUTDOWN = 65002,
|
||||||
|
CONFIGITEM_EXOSPHERE_VERHASH = 65003,
|
||||||
|
CONFIGITEM_HAS_RCM_BUG_PATCH = 65004,
|
||||||
|
CONFIGITEM_SHOULD_BLANK_PRODINFO = 65005,
|
||||||
|
CONFIGITEM_ALLOW_CAL_WRITES = 65006,
|
||||||
|
```
|
||||||
|
|
||||||
|
### smc_ams_iram_copy
|
||||||
|
This function implements a copy of up to one page between DRAM and IRAM. Its arguments are:
|
||||||
|
```
|
||||||
|
args->X[1] = DRAM address (translated by kernel), must be 4-byte aligned.
|
||||||
|
args->X[2] = IRAM address, must be 4-byte aligned.
|
||||||
|
args->X[3] = Size (must be <= 0x1000 and 4-byte aligned).
|
||||||
|
args->X[4] = 0 for read, 1 for write.
|
||||||
|
```
|
||||||
|
|
||||||
|
### smc_ams_write_address
|
||||||
|
This function implements a write to a DRAM page. Its arguments are:
|
||||||
|
```
|
||||||
|
args->X[1] = Virtual address, must be size-bytes aligned and readable by EL0.
|
||||||
|
args->X[2] = Value.
|
||||||
|
args->X[3] = Size (must be 1, 2, 4, or 8).
|
||||||
|
```
|
||||||
|
|
||||||
|
### smc_ams_get_emummc_config
|
||||||
|
This function retrieves configuration for the current [emummc](emummc.md) context. Its arguments are:
|
||||||
|
```
|
||||||
|
args->X[1] = MMC id, must be size-bytes aligned and readable by EL0.
|
||||||
|
args->X[2] = Pointer to output (for paths for filebased + nintendo dir), must be at least 0x100 bytes.
|
||||||
|
```
|
||||||
|
|
||||||
|
### CONFIGITEM_EXOSPHERE_VERSION
|
||||||
|
This custom configuration item gets information about the current exosphere version.
|
||||||
|
|
||||||
|
### CONFIGITEM_NEEDS_REBOOT
|
||||||
|
This custom configuration item is used to issue a system reboot into RCM or into a warmboot payload leveraging a secondary vulnerability to achieve code execution from warm booting.
|
||||||
|
|
||||||
|
### CONFIGITEM_NEEDS_SHUTDOWN
|
||||||
|
This custom configuration item is used to issue a system shutdown with a warmboot payload leveraging a secondary vulnerability to achieve code execution from warm booting.
|
||||||
|
|
||||||
|
### CONFIGITEM_EXOSPHERE_VERHASH
|
||||||
|
This custom configuration item gets information about the current exosphere git commit hash.
|
||||||
|
|
||||||
|
### CONFIGITEM_HAS_RCM_BUG_PATCH
|
||||||
|
This custom configuration item gets whether the unit has the CVE-2018-6242 vulnerability patched.
|
||||||
|
|
||||||
|
### CONFIGITEM_SHOULD_BLANK_PRODINFO
|
||||||
|
This custom configuration item gets whether the unit should simulate a "blanked" PRODINFO. See [here](../features/configurations.md) for more information.
|
||||||
|
|
||||||
|
### CONFIGITEM_ALLOW_CAL_WRITES
|
||||||
|
This custom configuration item gets whether the unit should allow writing to the calibration partition.
|
||||||
|
|
||||||
|
## lp0fw
|
||||||
|
This is a small, built-in payload that is responsible for waking up the system during a warm boot.
|
||||||
|
|
||||||
|
## sc7fw
|
||||||
|
This is a small, built-in payload that is responsible for putting the system to sleep during a warm boot.
|
||||||
|
|
||||||
|
## rebootstub
|
||||||
|
This is a small, built-in payload that provides functionality to reboot the system into any payload of choice.
|
||||||
|
|||||||
22
docs/components/fusee.md
Normal file
22
docs/components/fusee.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# fusée
|
||||||
|
fusée is a custom bootloader used to start the Atmosphère environment.
|
||||||
|
It is divided into three sub-components: fusée-primary, fusée-mtc and fusée-secondary.
|
||||||
|
|
||||||
|
fusée is also capable of chainloading other payloads (e.g.: Android).
|
||||||
|
|
||||||
|
fusée's behavior can be configured via the [BCT.ini](../features/configurations.md) file located on the SD card.
|
||||||
|
|
||||||
|
## fusée-primary
|
||||||
|
fusée-primary is the first piece of Atmosphère's code that runs on the hardware.
|
||||||
|
It is distributed as a standalone payload designed to be launched via RCM by abusing the CVE-2018-6242 vulnerability.
|
||||||
|
|
||||||
|
This payload is responsible for all the low-level hardware initialization required by the Nintendo Switch, plus the extra task of initializing the SD card and reading the next fusée sub-components from it.
|
||||||
|
|
||||||
|
## fusée-mtc
|
||||||
|
fusée-mtc is an optional, but heavily recommended sub-component that performs DRAM memory training.
|
||||||
|
This ensures a proper environment for running the final fusée sub-component.
|
||||||
|
|
||||||
|
## fusée-secondary
|
||||||
|
fusée-secondary is the last fusée sub-component that runs on the system.
|
||||||
|
It is responsible for configuring and bootstrapping the Atmosphère environment by mimicking the Horizon OS's design.
|
||||||
|
This includes setting up the cryptosystem, mounting or emulating the eMMC, injecting or patching system modules and launching the exosphère component.
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
# BCT.ini
|
|
||||||
BCT.ini is the configuration file used by fusée-primary and fusée-secondary. It is read by fusee-primary.bin to setup and boot fusee-secondary.bin and is also read by fusee-secondary.bin to configure Exosphère, specify the environment it should boot, or configure other miscellaneous options such as setting a custom boot splashscreen.
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
This file is located in the `atmosphere` folder on your SD card. The default configuration file will look similar to this.
|
|
||||||
```
|
|
||||||
BCT0
|
|
||||||
[stage1]
|
|
||||||
stage2_path = atmosphere/fusee-secondary.bin
|
|
||||||
stage2_addr = 0xF0000000
|
|
||||||
stage2_entrypoint = 0xF0000000
|
|
||||||
|
|
||||||
[exosphere]
|
|
||||||
; Note: Disabling debugmode will cause parts of ams.tma to not work, in the future.
|
|
||||||
debugmode = 1
|
|
||||||
debugmode_user = 0
|
|
||||||
|
|
||||||
[stratosphere]
|
|
||||||
; To force-enable nogc, add nogc = 1
|
|
||||||
; To force-disable nogc, add nogc = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Adding a Custom Boot Splashscreen
|
|
||||||
Add the following lines to BCT.ini and change the value of `custom_splash` to the actual path and filename of your boot splashscreen.
|
|
||||||
```
|
|
||||||
[stage2]
|
|
||||||
custom_splash = /path/to/your/bootlogo.bmp
|
|
||||||
```
|
|
||||||
|
|
||||||
The boot splashscreen must be a BMP file, it must be 720x1280 (1280x720 rotated 90 degrees left/counterclockwise/anti-clockwise) resolution, and be in 32-bit ARGB format. You can use image editing software such as GIMP or Photoshop to export the image in this format.
|
|
||||||
|
|
||||||
## Configuring "nogc" Protection
|
|
||||||
Nogc is a feature provided by fusée-secondary which disables the Nintendo Switch's Game Card reader. Its purpose is to prevent the reader from being updated when the console has been updated without burning fuses from a firmware lower than 4.0.0, to a newer firmware that is at least 4.0.0 or higher. By default, Atmosphère will protect the Game Card reader automatically, but you are free to change it.
|
|
||||||
|
|
||||||
To change its functionality, add the following line to the `stratosphere` section and change the value of `X` according to the following list.
|
|
||||||
```
|
|
||||||
nogc = X
|
|
||||||
```
|
|
||||||
```
|
|
||||||
1 = force-enable nogc, so Atmosphère will always disable the Game Card reader.
|
|
||||||
0 = force-disable nogc, so Atmosphère will always enable the Game Card reader.
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Changing Target Firmware
|
|
||||||
Add the following line to the `exosphere` section and replace the `X` according to the following list if you have trouble booting past the firmware version detection.
|
|
||||||
`target_firmware` is the OFW major version.
|
|
||||||
```
|
|
||||||
target_firmware = X
|
|
||||||
```
|
|
||||||
```
|
|
||||||
1.0.0 = 1
|
|
||||||
2.X.X = 2
|
|
||||||
3.X.X = 3
|
|
||||||
4.X.X = 4
|
|
||||||
5.X.X = 5
|
|
||||||
6.X.X = 6
|
|
||||||
6.2.0 = 7
|
|
||||||
7.X.X = 8
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that 6.X.X indicates 6.0.0 through 6.1.0.
|
|
||||||
|
|
||||||
## Configuring Debugging Modes
|
|
||||||
By default, Atmosphère signals to the Horizon kernel that debugging is enabled while leaving usermode debugging disabled, since this can cause undesirable side-effects. If you wish to change these behaviours, go to the `exosphere` section and change the value of `X` according to the following list.
|
|
||||||
```
|
|
||||||
debugmode = X
|
|
||||||
debugmode_user = X
|
|
||||||
```
|
|
||||||
```
|
|
||||||
1 = enable
|
|
||||||
0 = disable
|
|
||||||
```
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Fusée
|
|
||||||
Fusée (not to be confused with Fusée Gelée) is a custom bootloader needed to start Atmosphère and replaces Nintendo's Package1loader/bootloader. It currently utilizes the [Tegra X1 RCM Vulnerability](https://nvidia.custhelp.com/app/answers/detail/a_id/4660/~/security-notice%3A-nvidia-tegra-rcm-vulnerability) in order to function.
|
|
||||||
|
|
||||||
Fusée is split into two separate parts: fusée-primary and fusée-secondary. This is due to the RCM Vulnerability only allowing payloads of a limited filesize to be sent to the device.
|
|
||||||
|
|
||||||
As of June 2018, there are new Switch systems being sold that prevent Fusée (or any payload that requires the Fusée Gelée exploit) from working due to having an ipatched bootrom. All ipatched systems share the HAC-S-JXE-C3 product code. While Fusée cannot work on these ipatched units, they still come on firmware 4.1.0, which is vulnerable to the upcoming Déja Vu software exploit. Note that if you update past 4.1.0 on one of these ipatched units, your odds of being able to install Atmosphère or run any homebrew become practically non-existent.
|
|
||||||
|
|
||||||
Additionally, a hardware revision of the Switch known as “Mariko” is believed to be in development. No such units have been seen in stores yet, but it is expected Nintendo will roll them out silently. The Mariko units will most likely patch the bootrom vulnerability Fusée Gelée, which is currently used to access CFW, and will likely have their own proprietary bootloader.
|
|
||||||
|
|
||||||
## Fusée-Primary
|
|
||||||
Fusée-primary is the payload file (fusee-primary.bin) sent to the Switch from an external device. Once sent, fusée-primary makes initial preparations before loading fusée-secondary from the Switch’s SD Card.
|
|
||||||
|
|
||||||
Fusée-primary can be configured via the [BCT.ini](../fusee/BCT.md) file located on the Switch’s SD card.
|
|
||||||
|
|
||||||
## Fusée-Secondary
|
|
||||||
Fusée-secondary is a payload file that stays on the root of the Switch’s SD Card (fusee-secondary.bin). It is automatically launched once fusée-primary has finished, and is responsible for preparing the Switch’s hardware for future running environments, such as the homebrew menu. Fusée-secondary is also responsible for validating and launching Exosphère.
|
|
||||||
|
|
||||||
Fusée-secondary contains various [.kip modules](/docs/main.md#modules). These modules modify existing features in the OS, and can also add new ones.
|
|
||||||
|
|
||||||
Fusée is also capable of chainloading other payloads such as Linux.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# sept
|
|
||||||
Sept is a payload that facilitates booting Atmosphère when targeting firmware version 7.0.0+.
|
|
||||||
|
|
||||||
It consists of a primary and a secondary payload.
|
|
||||||
|
|
||||||
## Sept-Primary
|
|
||||||
Sept-primary is essentially a stand-in for Nintendo's package1ldr, on 7.0.0+. To use it, the caller (normally Fusée-secondary) loads the sept-primary binary to `0x4003F000`,
|
|
||||||
loads the 7.0.0+ TSEC firmware to `0x40010F00`, and loads a signed, encrypted payload to `0x40016FE0`.
|
|
||||||
|
|
||||||
This signed, encrypted payload is normally Sept-secondary.
|
|
||||||
|
|
||||||
## Sept-Secondary
|
|
||||||
Sept-secondary is a payload that performs 7.0.0+ key derivation, and then chainloads to `sept/payload.bin`.
|
|
||||||
|
|
||||||
It is normally stored encrypted/signed; if one wishes to build sept-secondary instead of using release builds, one must bring his/her own keys.
|
|
||||||
11
docs/components/libraries.md
Normal file
11
docs/components/libraries.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# libraries
|
||||||
|
This is a collection of libraries for doing operating system development for the Nintendo Switch.
|
||||||
|
|
||||||
|
## libmesosphere
|
||||||
|
libmesosphere is a work-in-progress C++ library implementing functionality for the Horizon Kernel.
|
||||||
|
|
||||||
|
## libstratosphere
|
||||||
|
libstratosphere is a work-in-progress C++ library for development of system modules for the Nintendo Switch.
|
||||||
|
|
||||||
|
## libvapours
|
||||||
|
Common boilerplate code for various purposes.
|
||||||
3
docs/components/mesosphere.md
Normal file
3
docs/components/mesosphere.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# mesosphère
|
||||||
|
mesosphère is a work in progress customized kernel reimplementation.
|
||||||
|
The Horizon OS's kernel follows microkernel design principles and runs at the EL1 level. It is currently subdivided into a loader (kernel_ldr) and the main kernel code.
|
||||||
35
docs/components/modules/ams_mitm.md
Normal file
35
docs/components/modules/ams_mitm.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# ams_mitm
|
||||||
|
This module provides methods to intercept services provided by other system modules. It is further sub-divided according to the service it targets.
|
||||||
|
|
||||||
|
## bpc_mitm
|
||||||
|
bpc_mitm enables intercepting requests to power control services. It currently intercepts:
|
||||||
|
+ `am` system module (to intercept the Reboot/Power buttons in the overlay menu)
|
||||||
|
+ `fatal` system module (to simplify payload reboot logic significantly)
|
||||||
|
+ [nx-hbloader](https://github.com/switchbrew/nx-hbloader) (to allow homebrew to take advantage of the feature)
|
||||||
|
|
||||||
|
## fs_mitm
|
||||||
|
fs_mitm enables intercepting file system operations. It can deny, delay, replace, or redirect any request made to the file system. It enables LayeredFS to function, which allows for replacement of game assets.
|
||||||
|
|
||||||
|
## hid_mitm
|
||||||
|
hid_mitm enables intercepting requests to controller device services. It is currently disabled by default. If enabled, it intercepts:
|
||||||
|
+ [nx-hbloader](https://github.com/switchbrew/nx-hbloader) (to help homebrew not need to be recompiled due to a breaking change introduced in the past)
|
||||||
|
|
||||||
|
Note that hid_mitm is currently deprecated and might be removed entirely in the future.
|
||||||
|
|
||||||
|
## ns_mitm
|
||||||
|
ns_mitm enables intercepting requests to application control services. It currently intercepts:
|
||||||
|
+ Web Applets (to facilitate nx-hbloader web browser launching)
|
||||||
|
|
||||||
|
## set_mitm
|
||||||
|
set_mitm enables intercepting requests to the system settings service. It currently intercepts:
|
||||||
|
+ `ns` system module and games (to allow for overriding game locales)
|
||||||
|
+ All firmware debug settings requests (to allow modification of system settings not directly exposed to the user)
|
||||||
|
|
||||||
|
### Firmware Version
|
||||||
|
set_mitm intercepts the `GetFirmwareVersion` command, if the requester is `qlaunch` or `maintenance`.
|
||||||
|
It modifies the `display_version` field of the returned system version, causing the version to display
|
||||||
|
in settings as `#.#.#|AMS #.#.#|?` with `? = S` when running under system eMMC or `? = E` when running under emulated eMMC. This allows users to easily verify what version of Atmosphère and what eMMC environment they are running.
|
||||||
|
|
||||||
|
### System Settings
|
||||||
|
set_mitm intercepts the `GetSettingsItemValueSize` and `GetSettingsItemValue` commands for all requesters.
|
||||||
|
It does so in order to enable user configuration of system settings, which are parsed from `/atmosphere/system_settings.ini` on boot. See [here](../../features/configurations.md) for more information on the system settings format.
|
||||||
4
docs/components/modules/boot.md
Normal file
4
docs/components/modules/boot.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# boot
|
||||||
|
This module is a reimplementation of the Horizon OS's `boot` system module, which is responsible for initializing and configuring hardware.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation displays its own black and white splash screen and battery icons as replacements for the original assets used during display initialization.
|
||||||
4
docs/components/modules/boot2.md
Normal file
4
docs/components/modules/boot2.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# boot2
|
||||||
|
This module is a reimplementation of the Horizon OS's `boot2` system module, which is responsible for launching all the other necessary system modules.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation allows launching user provided system modules from the SD card. See [here](../../features/configurations.md) for more information.
|
||||||
4
docs/components/modules/creport.md
Normal file
4
docs/components/modules/creport.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# creport
|
||||||
|
This module is a reimplementation of the Horizon OS's `creport` system module, which is responsible for managing crash reports.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation redirects writing of generated crash reports to the SD card under the folder `/atmosphere/crash_reports/`. It also prevents the automatic uploading of said crash reports.
|
||||||
42
docs/components/modules/dmnt.md
Normal file
42
docs/components/modules/dmnt.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# dmnt
|
||||||
|
This module is a reimplementation of the Horizon OS's `dmnt` system module, which provides a debug monitor.
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
Atmosphère implements an extension to provide cheat code functionality.
|
||||||
|
|
||||||
|
### Cheat Service
|
||||||
|
A HIPC service API is provided for interacting with the cheat code manager through the service `dmnt:cht`. See [here](../../features/cheats.md) for more information on the cheat code format.
|
||||||
|
|
||||||
|
The SwIPC definition for `dmnt:cht` follows:
|
||||||
|
```
|
||||||
|
interface ams::dmnt::cheat::CheatService is dmnt:cht {
|
||||||
|
[65000] HasCheatProcess() -> sf::Out<bool> out;
|
||||||
|
[65001] GetCheatProcessEvent() -> sf::OutCopyHandle out_event;
|
||||||
|
[65002] GetCheatProcessMetadata() -> sf::Out<CheatProcessMetadata> out_metadata;
|
||||||
|
[65003] ForceOpenCheatProcess();
|
||||||
|
[65004] PauseCheatProcess();
|
||||||
|
[65005] ResumeCheatProcess();
|
||||||
|
|
||||||
|
[65100] GetCheatProcessMappingCount() -> sf::Out<u64> out_count;
|
||||||
|
[65101] GetCheatProcessMappings(u64 offset) -> sf::OutArray<MemoryInfo> &mappings, sf::Out<u64> out_count;
|
||||||
|
[65102] ReadCheatProcessMemory(u64 address, u64 out_size) -> sf::OutBuffer &buffer;
|
||||||
|
[65103] WriteCheatProcessMemory(sf::InBuffer &buffer, u64 address, u64 in_size);
|
||||||
|
[65104] QueryCheatProcessMemory(u64 address) -> sf::Out<MemoryInfo> mapping;
|
||||||
|
|
||||||
|
[65200] GetCheatCount() -> sf::Out<u64> out_count;
|
||||||
|
[65201] GetCheats(u64 offset) -> sf::OutArray<CheatEntry> &cheats, sf::Out<u64> out_count;
|
||||||
|
[65202] GetCheatById(u32 cheat_id) -> sf::Out<CheatEntry> cheat;
|
||||||
|
[65203] ToggleCheat(u32 cheat_id);
|
||||||
|
[65204] AddCheat(CheatDefinition &cheat, bool enabled) -> sf::Out<u32> out_cheat_id;
|
||||||
|
[65205] RemoveCheat(u32 cheat_id);
|
||||||
|
[65206] ReadStaticRegister(u8 which) -> sf::Out<u64> out;
|
||||||
|
[65207] WriteStaticRegister(u8 which, u64 value);
|
||||||
|
[65208] ResetStaticRegisters();
|
||||||
|
|
||||||
|
[65300] GetFrozenAddressCount() -> sf::Out<u64> out_count;
|
||||||
|
[65301] GetFrozenAddresses(u64 offset) ->sf::OutArray<FrozenAddressEntry> &addresses, sf::Out<u64> out_count;
|
||||||
|
[65302] GetFrozenAddress(u64 address) -> sf::Out<FrozenAddressEntry> entry;
|
||||||
|
[65303] EnableFrozenAddress(u64 address, u64 width) -> sf::Out<u64> out_value;
|
||||||
|
[65304] DisableFrozenAddress(u64 address);
|
||||||
|
}
|
||||||
|
```
|
||||||
4
docs/components/modules/eclct.stub.md
Normal file
4
docs/components/modules/eclct.stub.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# eclct.stub
|
||||||
|
This module is a reimplementation of the Horizon OS's `eclct` system module, which collects error reports.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation is a stub to remove any and all functionality pertaining to error report collection.
|
||||||
4
docs/components/modules/erpt.md
Normal file
4
docs/components/modules/erpt.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# erpt
|
||||||
|
This module is a reimplementation of the Horizon OS's `erpt` system module, which is responsible for managing error reports.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation redirects writing of generated error reports to the SD card under the folder `/atmosphere/erpt_reports/`.
|
||||||
4
docs/components/modules/fatal.md
Normal file
4
docs/components/modules/fatal.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# fatal
|
||||||
|
This module is a reimplementation of the Horizon OS's `fatal` system module, which is responsible for managing fatal reports.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation prevents error report creation and draws a custom error screen, showing registers and a backtrace. It also attempts to gather debugging info for any and all crashes and tries to save reports to the SD card under the folder `/atmosphere/fatal_reports/`.
|
||||||
4
docs/components/modules/jpegdec.md
Normal file
4
docs/components/modules/jpegdec.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# jpegdec
|
||||||
|
This module is a reimplementation of the Horizon OS's `jpegdec` system module, which is responsible for JPEG format decoding.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation allows two sessions instead of 1, so homebrew can use it for software JPEG decoding in addition to the OS itself.
|
||||||
106
docs/components/modules/loader.md
Normal file
106
docs/components/modules/loader.md
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# loader
|
||||||
|
This module is a reimplementation of the Horizon OS's `ldr` system module, which is responsible for creating processes from executable NSO images and registering their access control.
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
Atmosphère extends this module to allow executables to be replaced or patched by files stored on the SD card. Note that a few services are required for SD card access and therefore cannot be replaced or patched in this manner.
|
||||||
|
|
||||||
|
### Exefs Replacement
|
||||||
|
Atmosphère's reimplementation allows replacing executable files in the file system.
|
||||||
|
|
||||||
|
#### Partition Replacement
|
||||||
|
It is possible to replace the full exefs partition at once with a PFS0 file. In that case, Atmosphère will load the following file:
|
||||||
|
```
|
||||||
|
/atmosphere/contents/<program id>/exefs.nsp
|
||||||
|
```
|
||||||
|
|
||||||
|
#### File Replacement
|
||||||
|
When a process is created, loader will search for several NSO filenames in the program's exefs directory.
|
||||||
|
These filenames are, in this order:
|
||||||
|
- rtld
|
||||||
|
- main
|
||||||
|
- subsdk0
|
||||||
|
- subsdk1
|
||||||
|
- ...
|
||||||
|
- subsdk9
|
||||||
|
- sdk
|
||||||
|
|
||||||
|
Each NSO that is found will be loaded into the process contiguously. The process's entrypoint is at the first NSO to be loaded, usually `rtld` or `main`.
|
||||||
|
|
||||||
|
Additionally, when a process is loaded, loader will search for a `main.npdm` file in the exefs directory specifying the program's permissions.
|
||||||
|
|
||||||
|
Atmosphère extends this functionality by also searching for these files on the SD card. When searching for a file, loader will first check if it exists on the SD card. If it does, that file will be used instead. Otherwise, it will use the copy located in the exefs, if that is present. The following directory will be searched:
|
||||||
|
```
|
||||||
|
/atmosphere/contents/<program id>/exefs/
|
||||||
|
```
|
||||||
|
|
||||||
|
This allows the replacement of applets, system modules, or even games with homebrew versions.
|
||||||
|
|
||||||
|
##### File Stubbing
|
||||||
|
In order to prevent an NSO from being loaded even if it exists in the exefs, loader will also check if a stub file exists. If such a file exists, the NSO will not be loaded. The files should be named like `rtld.stub`, `main.stub`, etc. and may be empty.
|
||||||
|
|
||||||
|
##### Technical Semantics
|
||||||
|
|
||||||
|
loader's semantics for content override can (as you may observe from reading the above) be complicated to understand. The following is an abbreviated description of the very technical semantics by which loader decides what content to read when trying to read a file for a program id.
|
||||||
|
|
||||||
|
* If an external content filesystem exists for the program id, the external content filesystem is used directly with no further redirection.
|
||||||
|
* Otherwise, if the program ID is being overridden with [nx-hbloader](https://github.com/switchbrew/nx-hbloader/releases) (see Homebrew Support below), the nsp filesystem for hbl is used directly with no further redirection.
|
||||||
|
* Otherwise, if content redirection is enabled for the program ID (controlled by a configurable button combination) and a loose file exists on the SD card, the loose file is used.
|
||||||
|
* Otherwise, if a stub file exists, a "Not Found" error is returned.
|
||||||
|
* Otherwise, if an SD card executable filesystem ("exefs.nsp") exists, it is used without further redirection.
|
||||||
|
* Finally, the "real"/base code file system is used without further redirection.
|
||||||
|
|
||||||
|
In addition, there are a few other technical details relevant to Atmosphere's redirection:
|
||||||
|
* When overriding with nx-hbloader, the real code filesystem must exist. When "main.npdm" (a program capabilities descriptor file) is read, the content from the real code filesystem is read in order to determine whether an applet or an application is being overridden. This allows nx-hbloader to automatically support both applet and application environments.
|
||||||
|
* When overriding applications, the real code filesystem must exist and contain valid content. This is required to perform accurate-to-Nintendo content verification procedures.
|
||||||
|
* When programs are launched, both a program id and a "storage id" are specified by the launch requester. When the storage id specified is "none" (normally always invalid), Atmosphere assumes that a custom system module is attempting to be launched. This removes the aforementioned requirement on base content validity; the above procedure is still used to determine how to redirect content, however reads to the "real"/base code file system may return "Not Found" errors if the real/base code file system does not exist.
|
||||||
|
|
||||||
|
### NSO Patching
|
||||||
|
When an NSO is loaded, Atmosphère's reimplementation will search for IPS patch files on the SD card in the following locations.
|
||||||
|
```
|
||||||
|
/atmosphere/exefs_patches/<patchset name>/<nso build id>.ips
|
||||||
|
```
|
||||||
|
|
||||||
|
This organization allows patch sets affecting multiple NSOs to be distributed as a single directory and also allows patches from multiple patch sets to be stacked. Patches will be searched for in each patch set directory. The name of each patch file should match the hexadecimal build ID of the NSO to affect, except that trailing zero bytes may be left off. Because the NSO build ID is unique for every NSO, this means patches will only apply to the files they are meant to apply to.
|
||||||
|
|
||||||
|
Patch files are accepted in either IPS format or IPS32 format.
|
||||||
|
|
||||||
|
Because NSO files are compressed, patch files are not made between the original version of a compressed NSO and the modified version of such an NSO. Instead, they are made between the uncompressed version of an NSO and the modified (and still uncompressed) version of that NSO. This also means that a patch file cannot be manually applied to the compressed version of an NSO; it must be applied to the uncompressed version. Atmosphère's reimplementation will correctly apply these patches while loading the process regardless of whether the NSO it finds is compressed or not.
|
||||||
|
|
||||||
|
When authoring patches, [hactool](https://github.com/SciresM/hactool) can be used to find an NSO's build ID and to uncompress NSOs. Recent versions of the [ReSwitched IDA loaders](https://github.com/reswitched/loaders) can be used to load uncompressed NSOs into IDA in such a way that you can [apply patches to the input file](https://www.hex-rays.com/products/ida/support/idadoc/1618.shtml). From there, any IPS tool can be used to create the patch between the original NSO and the patched NSO. Note that if the NSO you are patching is larger than 16 MiB, you will have to use a tool that supports IPS32.
|
||||||
|
|
||||||
|
### Homebrew Support
|
||||||
|
Atmosphère provides first class support for [nx-hbloader](https://github.com/switchbrew/nx-hbloader/releases) and [nx-hbmenu](https://github.com/switchbrew/nx-hbmenu/releases).
|
||||||
|
|
||||||
|
Launching of the nx-hbloader process is controlled by configurable button inputs. See [here](../../features/configurations.md) for more detailed information.
|
||||||
|
|
||||||
|
In addition, loader has extensions to enable homebrew to launch web applets. This normally requires the application launching the applet to have HTML Manual content inside an installed NCA. Atmosphère's reimplementation will automatically ensure that the commands used to check this succeed, and will redirect the relevant file system to the `/atmosphere/hbl_html/` subdirectory.
|
||||||
|
|
||||||
|
### IPC Commands
|
||||||
|
Atmosphère's reimplementation extends the HIPC loader services' API with several custom commands.
|
||||||
|
|
||||||
|
The SwIPC definition for the `ldr:pm` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::ldr::pm::ProcessManagerInterface is ldr:pm {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereHasLaunchedProgram(ncm::ProgramId program_id) -> sf::Out<bool> out;
|
||||||
|
[65001] AtmosphereGetProgramInfo(ncm::ProgramLocation &loc) -> sf::Out<ProgramInfo> out_program_info, sf::Out<cfg::OverrideStatus> out_status;
|
||||||
|
[65002] AtmospherePinProgram(ncm::ProgramLocation &loc, cfg::OverrideStatus &override_status) -> sf::Out<PinId> out_id;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The SwIPC definition for the `ldr:dmnt` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::ldr::dmnt::DebugMonitorInterface is ldr:dmnt {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereHasLaunchedProgram(ncm::ProgramId program_id) -> sf::Out<bool> out;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The SwIPC definition for the `ldr:shel` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::ldr::shell::ShellInterface is ldr:shel {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereRegisterExternalCode(ncm::ProgramId program_id) -> sf::OutMoveHandle out;
|
||||||
|
[65001] AtmosphereUnregisterExternalCode(ncm::ProgramId program_id);
|
||||||
|
}
|
||||||
|
```
|
||||||
4
docs/components/modules/ncm.md
Normal file
4
docs/components/modules/ncm.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# ncm
|
||||||
|
This module is a reimplementation of the Horizon OS's `ncm` system module, which is responsible for content management.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation is currently opt-in only. See [here](../../features/configurations.md) for more information.
|
||||||
4
docs/components/modules/pgl.md
Normal file
4
docs/components/modules/pgl.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# pgl
|
||||||
|
This module is a reimplementation of the Horizon OS's `pgl` system module, which is responsible for launching programs and was introduced by firmware version `10.0.0`.
|
||||||
|
|
||||||
|
Currently, Atmosphère's reimplementation doesn't backport this module's functionalities to firmware versions lower than `10.0.0`.
|
||||||
30
docs/components/modules/pm.md
Normal file
30
docs/components/modules/pm.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# pm
|
||||||
|
This module is a reimplementation of the Horizon OS's `pm` system module, which is responsible for tracking running processes on the system, and managing resource limits.
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
Atmosphère extends this module with extra IPC commands and memory restriction changes.
|
||||||
|
|
||||||
|
### IPC Commands
|
||||||
|
Atmosphère's reimplementation extends the HIPC loader services' API with several custom commands.
|
||||||
|
|
||||||
|
The SwIPC definition for the `pm:dmnt` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::pm::dmnt::DebugMonitorServiceBase is pm:dmnt {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::OutCopyHandle out_process_handle, sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status;
|
||||||
|
[65001] AtmosphereGetCurrentLimitInfo(u32 group, u32 resource) -> sf::Out<s64> out_cur_val, sf::Out<s64> out_lim_val;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The SwIPC definition for the `pm:info` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::pm::info::InformationService is pm:info {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereGetProcessId(ncm::ProgramId program_id) -> sf::Out<os::ProcessId> out;
|
||||||
|
[65001] AtmosphereHasLaunchedProgram(ncm::ProgramId program_id) -> sf::Out<bool> out;
|
||||||
|
[65002] AtmosphereGetProcessInfo(os::ProcessId process_id) -> sf::Out<ncm::ProgramLocation> out_loc, sf::Out<cfg::OverrideStatus> out_status;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Extra System Memory
|
||||||
|
Atmosphère's reimplementation shrinks the APPLET memory pool by 24 MiB by default, giving this memory to the SYSTEM pool. This allows custom system modules to use more memory without hitting the SYSTEM memory limit.
|
||||||
16
docs/components/modules/ro.md
Normal file
16
docs/components/modules/ro.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# ro
|
||||||
|
This module is a reimplementation of the Horizon OS's `ro` system module, which is responsible for loading dynamic libraries and was introduced by firmware version `3.0.0`.
|
||||||
|
|
||||||
|
Atmosphère's reimplementation backports this module's functionalities to firmware versions lower than `3.0.0` where said functionalities were provided by the `ldr` system module instead.
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
Atmosphère extends this module to allow libraries to be patched by files stored on the SD card.
|
||||||
|
|
||||||
|
### NRO Patching
|
||||||
|
When an NRO is loaded, Atmosphère's reimplementation will search for IPS patch files on the SD card in the following locations.
|
||||||
|
```
|
||||||
|
/atmosphere/nro_patches/<patchset name>/<nro build id>.ips
|
||||||
|
```
|
||||||
|
This organization allows patch sets affecting multiple NROs to be distributed as a single directory. Patches will be searched for in each patch set directory. The name of each patch file should match the hexadecimal build ID of the NRO to affect, except that trailing zero bytes may be left off. Because the NRO build ID is unique for every NRO, this means patches will only apply to the files they are meant to apply to.
|
||||||
|
|
||||||
|
Patch files are accepted in either IPS format or IPS32 format.
|
||||||
47
docs/components/modules/sm.md
Normal file
47
docs/components/modules/sm.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# sm
|
||||||
|
This module is a reimplementation of the Horizon OS's `sm` system module, which is responsible for service management.
|
||||||
|
|
||||||
|
## Extensions
|
||||||
|
Atmosphère extends this module with extra IPC commands and new services.
|
||||||
|
|
||||||
|
### Debug Monitor
|
||||||
|
Atmosphère's reimplementation provides an interface `sm:dmnt` to allow a debug monitor to query the service manager's state.
|
||||||
|
|
||||||
|
The SwIPC definition for `sm:dmnt` follows:
|
||||||
|
```
|
||||||
|
interface ams::sm::DmntService is sm:dmnt {
|
||||||
|
[65000] AtmosphereGetRecord(ServiceName service) -> sf::Out<ServiceRecord> record;
|
||||||
|
[65001] AtmosphereListRecords(u64 offset) -> sf::OutArray<ServiceRecord> &records, sf::Out<u64> out_count;
|
||||||
|
[65002] AtmosphereGetRecordSize() -> sf::Out<u64> record_size;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### IPC Commands
|
||||||
|
Atmosphère's reimplementation extends the HIPC loader services' API with several custom commands.
|
||||||
|
|
||||||
|
The SwIPC definition for the `sm:` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::sm::UserService is sm: {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereInstallMitm(ServiceName service) -> sf::OutMoveHandle srv_h, sf::OutMoveHandle qry_h;
|
||||||
|
[65001] AtmosphereUninstallMitm(ServiceName service);
|
||||||
|
[65002] Deprecated_AtmosphereAssociatePidTidForMitm();
|
||||||
|
[65003] AtmosphereAcknowledgeMitmSession(ServiceName service) -> sf::Out<MitmProcessInfo> client_info, sf::OutMoveHandle fwd_h;
|
||||||
|
[65004] AtmosphereHasMitm(ServiceName service) -> sf::Out<bool> out;
|
||||||
|
[65005] AtmosphereWaitMitm(ServiceName service);
|
||||||
|
[65006] AtmosphereDeclareFutureMitm(ServiceName service);
|
||||||
|
|
||||||
|
[65100] AtmosphereHasService(ServiceName service) -> sf::Out<bool> out;
|
||||||
|
[65101] AtmosphereWaitService(ServiceName service);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The SwIPC definition for the `sm:m` extension commands follows:
|
||||||
|
```
|
||||||
|
interface ams::sm::ManagerService is sm:m {
|
||||||
|
...
|
||||||
|
[65000] AtmosphereEndInitDefers(os::ProcessId process_id, sf::InBuffer &acid_sac, sf::InBuffer &aci_sac);
|
||||||
|
[65001] AtmosphereHasMitm(ServiceName service) -> sf::Out<bool> out;
|
||||||
|
[65002] AtmosphereRegisterProcess(os::ProcessId process_id, ncm::ProgramId program_id, cfg::OverrideStatus override_status, sf::InBuffer &acid_sac, sf::InBuffer &aci_sac);
|
||||||
|
}
|
||||||
|
```
|
||||||
2
docs/components/modules/spl.md
Normal file
2
docs/components/modules/spl.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# spl
|
||||||
|
This module is a reimplementation of the Horizon OS's `spl` system module, which is responsible for providing secure platform services such as cryptographic operations.
|
||||||
14
docs/components/sept.md
Normal file
14
docs/components/sept.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# sept
|
||||||
|
Sept is a payload that facilitates booting Atmosphère when targeting firmware version 7.0.0+.
|
||||||
|
|
||||||
|
It consists of a primary and a secondary payload.
|
||||||
|
|
||||||
|
## sept-primary
|
||||||
|
sept-primary is essentially a stand-in for Nintendo's package1ldr, on 7.0.0+. To use it, the caller (normally fusée-secondary) loads the sept-primary binary to `0x4003F000`, loads the 7.0.0+ TSEC firmware to `0x40010F00`, and loads a signed, encrypted payload to `0x40016FE0`.
|
||||||
|
|
||||||
|
This signed, encrypted payload is normally sept-secondary.
|
||||||
|
|
||||||
|
## sept-secondary
|
||||||
|
sept-secondary is a payload that performs 7.0.0+ key derivation, and then chainloads to `sept/payload.bin`.
|
||||||
|
|
||||||
|
It is normally stored encrypted/signed. Therefore, if one wishes to build sept-secondary instead of using release builds, one must bring their own keys.
|
||||||
@@ -1,10 +1,21 @@
|
|||||||
# Stratosphère
|
# stratosphère
|
||||||
Stratosphère allows customization of the Horizon OS and Switch kernel. It includes custom sysmodules that extend the kernel and provide new features. It also includes a reimplementation of the loader sysmodules to hook important system actions.
|
stratosphère provides customization of the Horizon OS at the system level. This includes a reimplementation of several system modules and additional, custom system modules that extend or add a variety of features.
|
||||||
|
|
||||||
The sysmodules that Stratosphère includes are:
|
## Modules
|
||||||
+ [boot](../modules/boot.md): This module boots the system and initalizes hardware.
|
The modules currently provided by stratosphère are:
|
||||||
+ [creport](../modules/creport.md): Reimplementation of Nintendo’s crash report system. Dumps all error logs to the SD card instead of saving them to the NAND and sending them to Nintendo.
|
+ [ams_mitm](modules/ams_mitm.md)
|
||||||
+ [fs_mitm](../modules/fs_mitm.md): This module can log, deny, delay, replace, and redirect any request made to the File System.
|
+ [boot](modules/boot.md)
|
||||||
+ [loader](../modules/loader.md): Enables modifying the code of binaries that are not stored inside the kernel.
|
+ [boot2](modules/boot2.md)
|
||||||
+ [pm](../modules/pm.md): Reimplementation of Nintendo’s Process Manager.
|
+ [creport](modules/creport.md)
|
||||||
+ [sm](../modules/sm.md): Reimplementation of Nintendo’s Service Manager.
|
+ [dmnt](modules/dmnt.md)
|
||||||
|
+ [eclct.stub](modules/eclct.stub.md)
|
||||||
|
+ [erpt](modules/erpt.md)
|
||||||
|
+ [fatal](modules/fatal.md)
|
||||||
|
+ [jpegdec](modules/jpegdec.md)
|
||||||
|
+ [loader](modules/loader.md)
|
||||||
|
+ [ncm](modules/ncm.md)
|
||||||
|
+ [pgl](modules/pgl.md)
|
||||||
|
+ [pm](modules/pm.md)
|
||||||
|
+ [ro](modules/ro.md)
|
||||||
|
+ [sm](modules/sm.md)
|
||||||
|
+ [spl](modules/spl.md)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Thermosphère
|
# thermosphère
|
||||||
Thermosphère is a hypervisor based implementation of emuNAND.
|
thermosphère is a work in progress hypervisor implementation.
|
||||||
|
This aims to provide functionality at the EL2 level which remains unused by the Horizon OS.
|
||||||
Thermosphère is currently planned to be included in a future release of Atmosphère.
|
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
# Troposphère
|
# troposphère
|
||||||
Troposphère contains various application-level modifications to the OS, such as launching homebrew directly from the homemenu or executing cheat/gameshark codes, similar to Luma3DS. Troposphère is not yet implemented in Atmosphère.
|
troposphère provides customization of the Horizon OS at the application level.
|
||||||
|
|
||||||
|
## reboot_to_payload
|
||||||
|
Sample application to perform a system reboot into a payload of choice.
|
||||||
|
|||||||
@@ -6,25 +6,24 @@ By default, Atmosphère will do the following when deciding whether to attach to
|
|||||||
|
|
||||||
+ Retrieve information about the new application process from `pm` and `loader`.
|
+ Retrieve information about the new application process from `pm` and `loader`.
|
||||||
+ Check whether a user-defined key combination is held, and stop if not.
|
+ Check whether a user-defined key combination is held, and stop if not.
|
||||||
+ This defaults to "L is not held", and can be configured the same way as `fs.mitm` override keys.
|
+ This defaults to "L is not held", but can be configured with override keys.
|
||||||
+ The ini key to configure this is `cheat_enable_key`.
|
+ The ini key to configure this is `cheat_enable_key`.
|
||||||
+ Check whether the process is a real application, and stop if not.
|
+ Check whether the process is a real application, and stop if not.
|
||||||
+ This guards against applying cheat codes to the homebrew loader.
|
+ This guards against applying cheat codes to the Homebrew Loader.
|
||||||
+ Attempt to load cheats from `atmosphere/titles/<title_id>/cheats/<build_id>.txt`, where `build_id` is the hexadecimal representation of the first 8 bytes of the application's main executable's build id.
|
+ Attempt to load cheats from `/atmosphere/contents/<program_id>/cheats/<build_id>.txt`, where `build_id` is the hexadecimal representation of the first 8 bytes of the application's main executable's build id.
|
||||||
+ If no cheats are found, then the cheat manager will stop.
|
+ If no cheats are found, then the cheat manager will stop.
|
||||||
+ Open a kernel debug session for the new application process.
|
+ Open a kernel debug session for the new application process.
|
||||||
+ Signal to a system event that a new cheat process has been attached to.
|
+ Signal to a system event that a new cheat process has been attached to.
|
||||||
|
|
||||||
This behavior ensures that cheat codes are only loaded when the user would want them to.
|
This behavior ensures that cheat codes are only loaded when the user would want them to.
|
||||||
|
|
||||||
In cases where dmnt has not activated the cheat manager, but the user wants to make it do so anyway, the cheat manager's service API provides a `ForceOpenCheatProcess` command that homebrew can use. This command will cause the cheat manager to try to force itself to attach to the process.
|
In cases where `dmnt` has not activated the cheat manager, but the user wants to make it do so anyway, the cheat manager's service API provides a `ForceOpenCheatProcess` command that homebrew can use. This command will cause the cheat manager to try to force itself to attach to the process.
|
||||||
|
|
||||||
By default, all cheat codes listed in the loaded .txt file will be toggled on. This is configurable by the user, and the default can be set to toggled off by editing the `atmosphere!dmnt_cheats_enabled_by_default` entry to 0 instead of 1.
|
By default, all cheat codes listed in the loaded .txt file will be toggled on. This is configurable by the user by editing the `atmosphere!dmnt_cheats_enabled_by_default` [system setting](configurations.md).
|
||||||
|
|
||||||
Users may use homebrew programs to toggle cheats on and off at runtime via the cheat manager's service API.
|
Users may use homebrew programs to toggle cheats on and off at runtime via the cheat manager's service API.
|
||||||
|
|
||||||
## Cheat Code Compatibility
|
## Cheat Code Compatibility
|
||||||
|
|
||||||
Atmosphère manages cheat code through the execution of a small, custom virtual machine. Care has been taken to ensure that Atmosphère's cheat code format is fully backwards compatible with the pre-existing cheat code format, though new features have been added and bugs in the pre-existing cheat code applier have been fixed. Here is a short summary of the changes from the pre-existing format:
|
Atmosphère manages cheat code through the execution of a small, custom virtual machine. Care has been taken to ensure that Atmosphère's cheat code format is fully backwards compatible with the pre-existing cheat code format, though new features have been added and bugs in the pre-existing cheat code applier have been fixed. Here is a short summary of the changes from the pre-existing format:
|
||||||
|
|
||||||
+ A number of bugs were fixed in the processing of conditional instructions.
|
+ A number of bugs were fixed in the processing of conditional instructions.
|
||||||
@@ -37,21 +36,18 @@ Atmosphère manages cheat code through the execution of a small, custom virtual
|
|||||||
+ The pre-existing implementation did not correctly synchronize with the application process, and thus would cause heavy lag under certain circumstances (especially around loading screens). This has been fixed in Atmosphère's implementation.
|
+ The pre-existing implementation did not correctly synchronize with the application process, and thus would cause heavy lag under certain circumstances (especially around loading screens). This has been fixed in Atmosphère's implementation.
|
||||||
|
|
||||||
## Cheat Code Format
|
## Cheat Code Format
|
||||||
|
|
||||||
The following provides documentation of the instruction format for the virtual machine used to manage cheat codes.
|
The following provides documentation of the instruction format for the virtual machine used to manage cheat codes.
|
||||||
|
|
||||||
Typically, instruction type is encoded in the upper nybble of the first instruction u32.
|
Typically, instruction type is encoded in the upper nybble of the first instruction u32.
|
||||||
|
|
||||||
### Code Type 0: Store Static Value to Memory
|
### Code Type 0: Store Static Value to Memory
|
||||||
|
|
||||||
Code type 0 allows writing a static value to a memory address.
|
Code type 0 allows writing a static value to a memory address.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`0TMR00AA AAAAAAAA VVVVVVVV (VVVVVVVV)`
|
`0TMR00AA AAAAAAAA VVVVVVVV (VVVVVVVV)`
|
||||||
|
|
||||||
+ T: width of memory write (1, 2, 4, or 8 bytes)
|
+ T: Width of memory write (1, 2, 4, or 8 bytes).
|
||||||
+ M: memory region to write to (0 = Main NSO, 1 = Heap)
|
+ M: Memory region to write to (0 = Main NSO, 1 = Heap).
|
||||||
+ R: Register to use as an offset from memory region base.
|
+ R: Register to use as an offset from memory region base.
|
||||||
+ A: Immediate offset to use from memory region base.
|
+ A: Immediate offset to use from memory region base.
|
||||||
+ V: Value to write.
|
+ V: Value to write.
|
||||||
@@ -59,23 +55,20 @@ Code type 0 allows writing a static value to a memory address.
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 1: Begin Conditional Block
|
### Code Type 1: Begin Conditional Block
|
||||||
|
|
||||||
Code type 1 performs a comparison of the contents of memory to a static value.
|
Code type 1 performs a comparison of the contents of memory to a static value.
|
||||||
|
|
||||||
If the condition is not met, all instructions until the appropriate conditional block terminator are skipped.
|
If the condition is not met, all instructions until the appropriate conditional block terminator are skipped.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`1TMC00AA AAAAAAAA VVVVVVVV (VVVVVVVV)`
|
`1TMC00AA AAAAAAAA VVVVVVVV (VVVVVVVV)`
|
||||||
|
|
||||||
+ T: width of memory write (1, 2, 4, or 8 bytes)
|
+ T: Width of memory write (1, 2, 4, or 8 bytes).
|
||||||
+ M: memory region to write to (0 = Main NSO, 1 = Heap)
|
+ M: Memory region to write to (0 = Main NSO, 1 = Heap).
|
||||||
+ C: Condition to use, see below.
|
+ C: Condition to use, see below.
|
||||||
+ A: Immediate offset to use from memory region base.
|
+ A: Immediate offset to use from memory region base.
|
||||||
+ V: Value to compare to.
|
+ V: Value to compare to.
|
||||||
|
|
||||||
#### Conditions
|
#### Conditions
|
||||||
|
|
||||||
+ 1: >
|
+ 1: >
|
||||||
+ 2: >=
|
+ 2: >=
|
||||||
+ 3: <
|
+ 3: <
|
||||||
@@ -86,28 +79,23 @@ If the condition is not met, all instructions until the appropriate conditional
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 2: End Conditional Block
|
### Code Type 2: End Conditional Block
|
||||||
|
|
||||||
Code type 2 marks the end of a conditional block (started by Code Type 1 or Code Type 8).
|
Code type 2 marks the end of a conditional block (started by Code Type 1 or Code Type 8).
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`20000000`
|
`20000000`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 3: Start/End Loop
|
### Code Type 3: Start/End Loop
|
||||||
|
|
||||||
Code type 3 allows for iterating in a loop a fixed number of times.
|
Code type 3 allows for iterating in a loop a fixed number of times.
|
||||||
|
|
||||||
#### Start Loop Encoding
|
#### Start Loop Encoding
|
||||||
|
|
||||||
`300R0000 VVVVVVVV`
|
`300R0000 VVVVVVVV`
|
||||||
|
|
||||||
+ R: Register to use as loop counter.
|
+ R: Register to use as loop counter.
|
||||||
+ V: Number of iterations to loop.
|
+ V: Number of iterations to loop.
|
||||||
|
|
||||||
#### End Loop Encoding
|
#### End Loop Encoding
|
||||||
|
|
||||||
`310R0000`
|
`310R0000`
|
||||||
|
|
||||||
+ R: Register to use as loop counter.
|
+ R: Register to use as loop counter.
|
||||||
@@ -115,11 +103,9 @@ Code type 3 allows for iterating in a loop a fixed number of times.
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 4: Load Register with Static Value
|
### Code Type 4: Load Register with Static Value
|
||||||
|
|
||||||
Code type 4 allows setting a register to a constant value.
|
Code type 4 allows setting a register to a constant value.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`400R0000 VVVVVVVV VVVVVVVV`
|
`400R0000 VVVVVVVV VVVVVVVV`
|
||||||
|
|
||||||
+ R: Register to use.
|
+ R: Register to use.
|
||||||
@@ -128,38 +114,33 @@ Code type 4 allows setting a register to a constant value.
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 5: Load Register with Memory Value
|
### Code Type 5: Load Register with Memory Value
|
||||||
|
|
||||||
Code type 5 allows loading a value from memory into a register, either using a fixed address or by dereferencing the destination register.
|
Code type 5 allows loading a value from memory into a register, either using a fixed address or by dereferencing the destination register.
|
||||||
|
|
||||||
#### Load From Fixed Address Encoding
|
#### Load From Fixed Address Encoding
|
||||||
|
|
||||||
`5TMR00AA AAAAAAAA`
|
`5TMR00AA AAAAAAAA`
|
||||||
|
|
||||||
+ T: width of memory read (1, 2, 4, or 8 bytes)
|
+ T: Width of memory read (1, 2, 4, or 8 bytes).
|
||||||
+ M: memory region to write to (0 = Main NSO, 1 = Heap)
|
+ M: Memory region to write to (0 = Main NSO, 1 = Heap).
|
||||||
+ R: Register to load value into.
|
+ R: Register to load value into.
|
||||||
+ A: Immediate offset to use from memory region base.
|
+ A: Immediate offset to use from memory region base.
|
||||||
|
|
||||||
#### Load from Register Address Encoding
|
#### Load from Register Address Encoding
|
||||||
|
|
||||||
`5TMR10AA AAAAAAAA`
|
`5TMR10AA AAAAAAAA`
|
||||||
|
|
||||||
+ T: width of memory read (1, 2, 4, or 8 bytes)
|
+ T: Width of memory read (1, 2, 4, or 8 bytes).
|
||||||
+ M: memory region to write to (0 = Main NSO, 1 = Heap)
|
+ M: Memory region to write to (0 = Main NSO, 1 = Heap).
|
||||||
+ R: Register to load value into.
|
+ R: Register to load value into.
|
||||||
+ A: Immediate offset to use from register R.
|
+ A: Immediate offset to use from register R.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 6: Store Static Value to Register Memory Address
|
### Code Type 6: Store Static Value to Register Memory Address
|
||||||
|
|
||||||
Code type 6 allows writing a fixed value to a memory address specified by a register.
|
Code type 6 allows writing a fixed value to a memory address specified by a register.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`6T0RIor0 VVVVVVVV VVVVVVVV`
|
`6T0RIor0 VVVVVVVV VVVVVVVV`
|
||||||
|
|
||||||
+ T: width of memory write (1, 2, 4, or 8 bytes)
|
+ T: Width of memory write (1, 2, 4, or 8 bytes).
|
||||||
+ R: Register used as base memory address.
|
+ R: Register used as base memory address.
|
||||||
+ I: Increment register flag (0 = do not increment R, 1 = increment R by T).
|
+ I: Increment register flag (0 = do not increment R, 1 = increment R by T).
|
||||||
+ o: Offset register enable flag (0 = do not add r to address, 1 = add r to address).
|
+ o: Offset register enable flag (0 = do not add r to address, 1 = add r to address).
|
||||||
@@ -169,22 +150,19 @@ Code type 6 allows writing a fixed value to a memory address specified by a regi
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 7: Legacy Arithmetic
|
### Code Type 7: Legacy Arithmetic
|
||||||
|
|
||||||
Code type 7 allows performing arithmetic on registers.
|
Code type 7 allows performing arithmetic on registers.
|
||||||
|
|
||||||
However, it has been deprecated by Code type 9, and is only kept for backwards compatibility.
|
However, it has been deprecated by Code type 9, and is only kept for backwards compatibility.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`7T0RC000 VVVVVVVV`
|
`7T0RC000 VVVVVVVV`
|
||||||
|
|
||||||
+ T: width of arithmetic operation (1, 2, 4, or 8 bytes)
|
+ T: Width of arithmetic operation (1, 2, 4, or 8 bytes).
|
||||||
+ R: Register to apply arithmetic to.
|
+ R: Register to apply arithmetic to.
|
||||||
+ C: Arithmetic operation to apply, see below.
|
+ C: Arithmetic operation to apply, see below.
|
||||||
+ V: Value to use for arithmetic operation.
|
+ V: Value to use for arithmetic operation.
|
||||||
|
|
||||||
#### Arithmetic Types
|
#### Arithmetic Types
|
||||||
|
|
||||||
+ 0: Addition
|
+ 0: Addition
|
||||||
+ 1: Subtraction
|
+ 1: Subtraction
|
||||||
+ 2: Multiplication
|
+ 2: Multiplication
|
||||||
@@ -194,11 +172,9 @@ However, it has been deprecated by Code type 9, and is only kept for backwards c
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 8: Begin Keypress Conditional Block
|
### Code Type 8: Begin Keypress Conditional Block
|
||||||
|
|
||||||
Code type 8 enters or skips a conditional block based on whether a key combination is pressed.
|
Code type 8 enters or skips a conditional block based on whether a key combination is pressed.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`8kkkkkkk`
|
`8kkkkkkk`
|
||||||
|
|
||||||
+ k: Keypad mask to check against, see below.
|
+ k: Keypad mask to check against, see below.
|
||||||
@@ -206,7 +182,6 @@ Code type 8 enters or skips a conditional block based on whether a key combinati
|
|||||||
Note that for multiple button combinations, the bitmasks should be ORd together.
|
Note that for multiple button combinations, the bitmasks should be ORd together.
|
||||||
|
|
||||||
#### Keypad Values
|
#### Keypad Values
|
||||||
|
|
||||||
Note: This is the direct output of `hidKeysDown()`.
|
Note: This is the direct output of `hidKeysDown()`.
|
||||||
|
|
||||||
+ 0000001: A
|
+ 0000001: A
|
||||||
@@ -239,31 +214,27 @@ Note: This is the direct output of `hidKeysDown()`.
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 9: Perform Arithmetic
|
### Code Type 9: Perform Arithmetic
|
||||||
|
|
||||||
Code type 9 allows performing arithmetic on registers.
|
Code type 9 allows performing arithmetic on registers.
|
||||||
|
|
||||||
#### Register Arithmetic Encoding
|
#### Register Arithmetic Encoding
|
||||||
|
|
||||||
`9TCRS0s0`
|
`9TCRS0s0`
|
||||||
|
|
||||||
+ T: width of arithmetic operation (1, 2, 4, or 8 bytes)
|
+ T: Width of arithmetic operation (1, 2, 4, or 8 bytes).
|
||||||
+ C: Arithmetic operation to apply, see below.
|
+ C: Arithmetic operation to apply, see below.
|
||||||
+ R: Register to store result in.
|
+ R: Register to store result in.
|
||||||
+ S: Register to use as left-hand operand.
|
+ S: Register to use as left-hand operand.
|
||||||
+ s: Register to use as right-hand operand.
|
+ s: Register to use as right-hand operand.
|
||||||
|
|
||||||
#### Immediate Value Arithmetic Encoding
|
#### Immediate Value Arithmetic Encoding
|
||||||
|
|
||||||
`9TCRS100 VVVVVVVV (VVVVVVVV)`
|
`9TCRS100 VVVVVVVV (VVVVVVVV)`
|
||||||
|
|
||||||
+ T: width of arithmetic operation (1, 2, 4, or 8 bytes)
|
+ T: Width of arithmetic operation (1, 2, 4, or 8 bytes).
|
||||||
+ C: Arithmetic operation to apply, see below.
|
+ C: Arithmetic operation to apply, see below.
|
||||||
+ R: Register to store result in.
|
+ R: Register to store result in.
|
||||||
+ S: Register to use as left-hand operand.
|
+ S: Register to use as left-hand operand.
|
||||||
+ V: Value to use as right-hand operand.
|
+ V: Value to use as right-hand operand.
|
||||||
|
|
||||||
#### Arithmetic Types
|
#### Arithmetic Types
|
||||||
|
|
||||||
+ 0: Addition
|
+ 0: Addition
|
||||||
+ 1: Subtraction
|
+ 1: Subtraction
|
||||||
+ 2: Multiplication
|
+ 2: Multiplication
|
||||||
@@ -278,14 +249,12 @@ Code type 9 allows performing arithmetic on registers.
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 10: Store Register to Memory Address
|
### Code Type 10: Store Register to Memory Address
|
||||||
|
|
||||||
Code type 10 allows writing a register to memory.
|
Code type 10 allows writing a register to memory.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
`ATSRIOxa (aaaaaaaa)`
|
`ATSRIOxa (aaaaaaaa)`
|
||||||
|
|
||||||
+ T: width of memory write (1, 2, 4, or 8 bytes)
|
+ T: Width of memory write (1, 2, 4, or 8 bytes).
|
||||||
+ S: Register to write to memory.
|
+ S: Register to write to memory.
|
||||||
+ R: Register to use as base address.
|
+ R: Register to use as base address.
|
||||||
+ I: Increment register flag (0 = do not increment R, 1 = increment R by T).
|
+ I: Increment register flag (0 = do not increment R, 1 = increment R by T).
|
||||||
@@ -294,23 +263,21 @@ Code type 10 allows writing a register to memory.
|
|||||||
+ a: Value used as offset when O is 2, 4 or 5.
|
+ a: Value used as offset when O is 2, 4 or 5.
|
||||||
|
|
||||||
#### Offset Types
|
#### Offset Types
|
||||||
|
|
||||||
+ 0: No Offset
|
+ 0: No Offset
|
||||||
+ 1: Use Offset Register
|
+ 1: Use Offset Register
|
||||||
+ 2: Use Fixed Offset
|
+ 2: Use Fixed Offset
|
||||||
+ 3: Memory Region + Base Register
|
+ 3: Memory Region + Base Register
|
||||||
+ 4: Memory Region + Relative Address (ignore address register)
|
+ 4: Memory Region + Relative Address (ignore address register)
|
||||||
+ 5: Memory Region + Relative Address + Offset Register
|
+ 5: Memory Region + Relative Address + Offset Register
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 11: Reserved
|
### Code Type 11: Reserved
|
||||||
|
|
||||||
Code Type 11 is currently reserved for future use.
|
Code Type 11 is currently reserved for future use.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 12-15: Extended-Width Instruction
|
### Code Type 12-15: Extended-Width Instruction
|
||||||
|
|
||||||
Code Types 12-15 signal to the VM to treat the upper two nybbles of the first dword as instruction type, instead of just the upper nybble.
|
Code Types 12-15 signal to the VM to treat the upper two nybbles of the first dword as instruction type, instead of just the upper nybble.
|
||||||
|
|
||||||
This reserves an additional 64 opcodes for future use.
|
This reserves an additional 64 opcodes for future use.
|
||||||
@@ -318,13 +285,11 @@ This reserves an additional 64 opcodes for future use.
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Code Type 0xC0: Begin Register Conditional Block
|
### Code Type 0xC0: Begin Register Conditional Block
|
||||||
|
|
||||||
Code type 0xC0 performs a comparison of the contents of a register and another value. This code support multiple operand types, see below.
|
Code type 0xC0 performs a comparison of the contents of a register and another value. This code support multiple operand types, see below.
|
||||||
|
|
||||||
If the condition is not met, all instructions until the appropriate conditional block terminator are skipped.
|
If the condition is not met, all instructions until the appropriate conditional block terminator are skipped.
|
||||||
|
|
||||||
#### Encoding
|
#### Encoding
|
||||||
|
|
||||||
```
|
```
|
||||||
C0TcSX##
|
C0TcSX##
|
||||||
C0TcS0Ma aaaaaaaa
|
C0TcS0Ma aaaaaaaa
|
||||||
@@ -335,19 +300,18 @@ C0TcS400 VVVVVVVV (VVVVVVVV)
|
|||||||
C0TcS5X0
|
C0TcS5X0
|
||||||
```
|
```
|
||||||
|
|
||||||
+ T: width of memory write (1, 2, 4, or 8 bytes)
|
+ T: Width of memory write (1, 2, 4, or 8 bytes).
|
||||||
+ c: Condition to use, see below.
|
+ c: Condition to use, see below.
|
||||||
+ S: Source Register
|
+ S: Source Register.
|
||||||
+ X: Operand Type, see below.
|
+ X: Operand Type, see below.
|
||||||
+ M: Memory Type (operand types 0 and 1)
|
+ M: Memory Type (operand types 0 and 1).
|
||||||
+ R: Address Register (operand types 2 and 3)
|
+ R: Address Register (operand types 2 and 3).
|
||||||
+ a: Relative Address (operand types 0 and 2)
|
+ a: Relative Address (operand types 0 and 2).
|
||||||
+ r: Offset Register (operand types 1 and 3)
|
+ r: Offset Register (operand types 1 and 3).
|
||||||
+ X: Other Register (used for operand type 5)
|
+ X: Other Register (operand type 5).
|
||||||
+ V: Value to compare to (operand type 4)
|
+ V: Value to compare to (operand type 4).
|
||||||
|
|
||||||
#### Operand Type
|
#### Operand Type
|
||||||
|
|
||||||
+ 0: Memory Base + Relative Offset
|
+ 0: Memory Base + Relative Offset
|
||||||
+ 1: Memory Base + Offset Register
|
+ 1: Memory Base + Offset Register
|
||||||
+ 2: Register + Relative Offset
|
+ 2: Register + Relative Offset
|
||||||
@@ -356,10 +320,109 @@ C0TcS5X0
|
|||||||
+ 5: Other Register
|
+ 5: Other Register
|
||||||
|
|
||||||
#### Conditions
|
#### Conditions
|
||||||
|
|
||||||
+ 1: >
|
+ 1: >
|
||||||
+ 2: >=
|
+ 2: >=
|
||||||
+ 3: <
|
+ 3: <
|
||||||
+ 4: <=
|
+ 4: <=
|
||||||
+ 5: ==
|
+ 5: ==
|
||||||
+ 6: !=
|
+ 6: !=
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xC1: Save or Restore Register
|
||||||
|
Code type 0xC1 performs saving or restoring of registers.
|
||||||
|
|
||||||
|
#### Encoding
|
||||||
|
`C10D0Sx0`
|
||||||
|
|
||||||
|
+ D: Destination index.
|
||||||
|
+ S: Source index.
|
||||||
|
+ x: Operand Type, see below.
|
||||||
|
|
||||||
|
#### Operand Type
|
||||||
|
+ 0: Restore register
|
||||||
|
+ 1: Save register
|
||||||
|
+ 2: Clear saved value
|
||||||
|
+ 3: Clear register
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xC2: Save or Restore Register with Mask
|
||||||
|
Code type 0xC2 performs saving or restoring of multiple registers using a bitmask.
|
||||||
|
|
||||||
|
#### Encoding
|
||||||
|
`C2x0XXXX`
|
||||||
|
|
||||||
|
+ x: Operand Type, see below.
|
||||||
|
+ X: 16-bit bitmask, bit i == save or restore register i.
|
||||||
|
|
||||||
|
#### Operand Type
|
||||||
|
+ 0: Restore register
|
||||||
|
+ 1: Save register
|
||||||
|
+ 2: Clear saved value
|
||||||
|
+ 3: Clear register
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xC3: Read or Write Static Register
|
||||||
|
Code type 0xC3 reads or writes a static register with a given register.
|
||||||
|
|
||||||
|
#### Encoding
|
||||||
|
`C3000XXx`
|
||||||
|
|
||||||
|
+ XX: Static register index, 0x00 to 0x7F for reading or 0x80 to 0xFF for writing.
|
||||||
|
+ x: Register index.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xF0: Double Extended-Width Instruction
|
||||||
|
Code Type 0xF0 signals to the VM to treat the upper three nybbles of the first dword as instruction type, instead of just the upper nybble.
|
||||||
|
|
||||||
|
This reserves an additional 16 opcodes for future use.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xFF0: Pause Process
|
||||||
|
Code type 0xFF0 pauses the current process.
|
||||||
|
|
||||||
|
#### Encoding
|
||||||
|
`FF0?????`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xFF1: Resume Process
|
||||||
|
Code type 0xFF1 resumes the current process.
|
||||||
|
|
||||||
|
#### Encoding
|
||||||
|
`FF1?????`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Code Type 0xFFF: Debug Log
|
||||||
|
Code type 0xFFF writes a debug log to the SD card under the folder `/atmosphere/cheat_vm_logs/`.
|
||||||
|
|
||||||
|
#### Encoding
|
||||||
|
```
|
||||||
|
FFFTIX##
|
||||||
|
FFFTI0Ma aaaaaaaa
|
||||||
|
FFFTI1Mr
|
||||||
|
FFFTI2Ra aaaaaaaa
|
||||||
|
FFFTI3Rr
|
||||||
|
FFFTI4X0
|
||||||
|
```
|
||||||
|
|
||||||
|
+ T: Width of memory write (1, 2, 4, or 8 bytes).
|
||||||
|
+ I: Log id.
|
||||||
|
+ X: Operand Type, see below.
|
||||||
|
+ M: Memory Type (operand types 0 and 1).
|
||||||
|
+ R: Address Register (operand types 2 and 3).
|
||||||
|
+ a: Relative Address (operand types 0 and 2).
|
||||||
|
+ r: Offset Register (operand types 1 and 3).
|
||||||
|
+ X: Value Register (operand type 4).
|
||||||
|
|
||||||
|
#### Operand Type
|
||||||
|
+ 0: Memory Base + Relative Offset
|
||||||
|
+ 1: Memory Base + Offset Register
|
||||||
|
+ 2: Register + Relative Offset
|
||||||
|
+ 3: Register + Offset Register
|
||||||
|
+ 4: Register Value
|
||||||
153
docs/features/configurations.md
Normal file
153
docs/features/configurations.md
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
# Configurations
|
||||||
|
Atmosphère provides a variety of customizable configurations to better adjust to users' needs.
|
||||||
|
|
||||||
|
## BCT.ini
|
||||||
|
This is the configuration file used by fusée.
|
||||||
|
This file is located under the `/atmosphere/config/` folder on your SD card and a default template can be found inside the `/atmosphere/config_templates/` folder.
|
||||||
|
|
||||||
|
### Adding a Custom Boot Splashscreen
|
||||||
|
Atmosphère provides its own default splashscreen which is displayed at boot time. However, this can be replaced at will.
|
||||||
|
|
||||||
|
The boot splashscreen must be a BMP file, it must be 720x1280 (1280x720 rotated 90 degrees left/counterclockwise/anti-clockwise) resolution, and be in 32-bit ARGB format. You can use image editing software such as GIMP or Photoshop to export the image in this format.
|
||||||
|
|
||||||
|
Add the following lines to BCT.ini and change the value of `custom_splash` to the actual path and filename of your boot splashscreen:
|
||||||
|
```
|
||||||
|
[stage2]
|
||||||
|
custom_splash = /path/to/your/bootlogo.bmp
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuring "nogc" Protection
|
||||||
|
"nogc" is a feature provided by fusée-secondary which disables the Nintendo Switch's Game Card reader. Its purpose is to prevent the reader from being updated when the console has been updated, without burning fuses, from a lower firmware version. More specifically, from firmware versions 4.0.0 or 9.0.0 which introduced updates to the Game Card reader's firmware. By default, Atmosphère will protect the Game Card reader automatically, but you are free to change it.
|
||||||
|
|
||||||
|
To change its functionality, add the following line to the `stratosphere` section and change the value of `X` according to the following list:
|
||||||
|
```
|
||||||
|
[stratosphere]
|
||||||
|
nogc = X
|
||||||
|
```
|
||||||
|
```
|
||||||
|
1 = force-enable nogc, so Atmosphère will always disable the Game Card reader.
|
||||||
|
0 = force-disable nogc, so Atmosphère will always enable the Game Card reader.
|
||||||
|
```
|
||||||
|
|
||||||
|
### NCM opt-in
|
||||||
|
Atmosphère provides a reimplementation of the [ncm](../components/modules/ncm.md) system module, but currently this is not enabled by default. If you wish to enable this reimplementation add the following line to the `stratosphere` section:
|
||||||
|
```
|
||||||
|
[stratosphere]
|
||||||
|
enable_ncm = 1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
This is an advanced feature aimed at developers trying to debug boot time issues. It enables logging of the fusée stages to be displayed on screen.
|
||||||
|
|
||||||
|
Add the following lines to BCT.ini and change the value of `X` according to the following list:
|
||||||
|
```
|
||||||
|
[config]
|
||||||
|
log_level = X
|
||||||
|
```
|
||||||
|
```
|
||||||
|
0 = NONE
|
||||||
|
1 = ERROR
|
||||||
|
2 = WARNING
|
||||||
|
3 = MANDATORY
|
||||||
|
4 = INFO
|
||||||
|
5 = DEBUG
|
||||||
|
```
|
||||||
|
|
||||||
|
A special level is also provided to prevent prefix creation. To use it, do a bitwise OR with this mask:
|
||||||
|
`0x100 = NO_PREFIX`
|
||||||
|
|
||||||
|
## emummc.ini
|
||||||
|
This is the configuration file used for the [emummc](../components/emummc.md) component.
|
||||||
|
This file is located under the `/emuMMC/` folder on your SD card.
|
||||||
|
|
||||||
|
Please refer to the project's repository [here](https://github.com/m4xw/emuMMC) for detailed instructions and documentation.
|
||||||
|
|
||||||
|
## exosphere.ini
|
||||||
|
This is the configuration file used by exosphère.
|
||||||
|
This file is located in the root of your SD card and a default template can be found inside the `/atmosphere/config_templates/` folder.
|
||||||
|
|
||||||
|
### Configuring Debugging Modes
|
||||||
|
By default, Atmosphère signals to the Horizon kernel that debugging is enabled while leaving usermode debugging disabled, but this can cause undesirable side-effects. If you wish to change this behavior, go to the `exosphere` section and change the value of `X` according to the following list.
|
||||||
|
```
|
||||||
|
[exosphere]
|
||||||
|
debugmode = X
|
||||||
|
debugmode_user = X
|
||||||
|
```
|
||||||
|
```
|
||||||
|
1 = enable
|
||||||
|
0 = disable
|
||||||
|
```
|
||||||
|
|
||||||
|
### Blanking PRODINFO
|
||||||
|
Atmosphère provides a way for users to blank their factory installed calibration data (known as PRODINFO) in either emulated or system eMMC environments. You can find more detailed information on this inside the respective template file. Usage of this configuration is not encouraged.
|
||||||
|
|
||||||
|
## override_config.ini
|
||||||
|
This file is located under the `/atmosphere/config/` folder on your SD card and a default template can be found inside the `/atmosphere/config_templates/` folder.
|
||||||
|
|
||||||
|
### Overrides Format
|
||||||
|
Overrides are parsed from the `/atmosphere/config/override_config.ini` file during the boot process.
|
||||||
|
|
||||||
|
By default `override_config.ini` is not configured. It can be used to select the behavior of certain buttons and bind them to functionalities such as launching the Homebrew Menu or enabling the cheat code manager.
|
||||||
|
|
||||||
|
You can modify the override_key entries in `override_config.ini` with this list of valid buttons:
|
||||||
|
| Formal Name | .ini Name |
|
||||||
|
| ----------- | --------- |
|
||||||
|
| A Button | A |
|
||||||
|
| B Button | B |
|
||||||
|
| X Button | X |
|
||||||
|
| Y Button | Y |
|
||||||
|
| Left Stick | LS |
|
||||||
|
| Right Stick | RS |
|
||||||
|
| L Button | L |
|
||||||
|
| R Button | R |
|
||||||
|
| ZL Button | ZL |
|
||||||
|
| ZR Button | ZR |
|
||||||
|
| + Button | PLUS |
|
||||||
|
| - Button | MINUS |
|
||||||
|
| Left Dpad | DLEFT |
|
||||||
|
| Up Dpad | DUP |
|
||||||
|
| Right Dpad | DRIGHT |
|
||||||
|
| Down Dpad | DDOWN |
|
||||||
|
| SL Button | SL |
|
||||||
|
| SR Button | SR |
|
||||||
|
|
||||||
|
To invert the behavior of the override key, place an exclamation point in front of whatever button you wish to use. It will launch the actual game while holding down that button, instead of going into the Homebrew Menu. For example, `override_key=!R` will run the game only while holding down R when launching it, otherwise it will boot into the Homebrew Menu. Afterwards you may reinsert your SD card into your Switch and boot into Atmosphère as you normally would. You should now be able to boot into the Homebrew Menu by launching your designated program of choice.
|
||||||
|
|
||||||
|
## system_settings.ini
|
||||||
|
This file is located under the `/atmosphere/config/` folder on your SD card and a default template can be found inside the `/atmosphere/config_templates/` folder.
|
||||||
|
|
||||||
|
### Settings Format
|
||||||
|
Atmosphère provides a way to override the firmware debug settings used by the system. These can be parsed from the `/atmosphere/config/system_settings.ini` file during the boot process. This file is a normal ini file, with some specific interpretations.
|
||||||
|
|
||||||
|
The standard representation of a setting's identifier takes the form `name!key`. This is represented within `system_settings.ini` as a section `name`, with an entry `key`. For example:
|
||||||
|
```
|
||||||
|
[name]
|
||||||
|
key = ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Settings can have variable types (strings, integral values, byte arrays, etc). To accommodate this, `system_settings.ini` must store values as a `type_identifier!value_store` pair. A number of different types are supported, with identifiers detailed below.
|
||||||
|
Please note that a malformed value string will cause a fatal error to occur on boot. A full example of a custom setting is given below (setting `eupld!upload_enabled = 0`), for posterity:
|
||||||
|
```
|
||||||
|
[eupld]
|
||||||
|
upload_enabled = u8!0x0
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supported Types
|
||||||
|
* Strings
|
||||||
|
* Type identifiers: `str`, `string`
|
||||||
|
* The value string is used directly as the setting, with null terminator appended.
|
||||||
|
* Integral types
|
||||||
|
* Type identifiers: `u8`, `u16`, `u32`, `u64`
|
||||||
|
* The value string is parsed via a call to `strtoul(value, NULL, 0)`.
|
||||||
|
* Setting bitwidth is determined by the identifier (8 for 1 byte, 16 for 2 bytes, and so on).
|
||||||
|
* Raw bytes
|
||||||
|
* Type identifiers: `hex`, `bytes`
|
||||||
|
* The value string is parsed as a hexadecimal string.
|
||||||
|
* The value string must be of even length, or a fatal error will be thrown on parse.
|
||||||
|
|
||||||
|
## Content Specific Flags
|
||||||
|
Atmosphère supports customizing CFW behavior based on the presence of `flags` on the SD card.
|
||||||
|
|
||||||
|
The following flags are supported on a per-program basis, by placing `<flag_name>.flag` inside `/atmosphere/contents/<program_id>/flags/`:
|
||||||
|
+ `boot2`, which indicates that the program should be launched during the `boot2` process.
|
||||||
|
+ `redirect_save`, which indicates that the program wants its savedata to be redirected to the SD card.
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# Flags
|
|
||||||
Atmosphère supports customizing CFW behavior based on the presence of `flags` on the SD card.
|
|
||||||
|
|
||||||
The following flags are supported on a per-title basis, by placing `<flag_name>.flag` inside `/atmosphere/titles/<title_id>/flags/`:
|
|
||||||
+ `boot2`, which indicates to PM that the title should be launched during the `boot2` process.
|
|
||||||
+ `fsmitm`, which indicates that `fs.mitm` should override contents for the title even if it otherwise wouldn't.
|
|
||||||
+ `fsmitm_disable`, which indicates that `fs.mitm` should not override contents for the title, even it it otherwise would.
|
|
||||||
+ `bis_write`, which indicates that `fs.mitm` should allow the title to write to BIS partitions.
|
|
||||||
+ `cal_read`, which indicates that `fs.mitm` should allow the title to read the CAL0/PRODINFO partition.
|
|
||||||
|
|
||||||
The following global flags are supported, by placing `<flag name>.flag` inside `/atmosphere/flags/`:
|
|
||||||
+ `hbl_bis_write` and `hbl_cal_read` enable the BIS write and CAL0 read functionality for HBL, without needing to specify its title id.
|
|
||||||
21
docs/licensing_exemptions/MIT_LICENSE
Normal file
21
docs/licensing_exemptions/MIT_LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
45
docs/main.md
45
docs/main.md
@@ -1,29 +1,30 @@
|
|||||||
# Atmosphère
|
# Atmosphère
|
||||||
Atmosphère is a work-in-progress customized firmware for the Nintendo Switch. Atmosphère consists of several different components, each in charge of performing different system functions of the Nintendo Switch.
|
Atmosphère is a work-in-progress customized firmware for the Nintendo Switch. Its design principle consists of a multi-layered approach where each layer replaces/modifies a different component of the Nintendo Switch's system.
|
||||||
|
|
||||||
The components of Atmosphère are:
|
## Components
|
||||||
+ [Fusée](../docs/components/fusee/fusee.md), a custom bootloader.
|
Atmosphère provides six core components, mimicking to some degree the various layers of the Earth's atmosphere:
|
||||||
+ [Exosphère](../docs/components/exosphere.md), a fully-featured custom secure monitor.
|
+ [fusée](components/fusee.md)
|
||||||
+ [Stratosphère](../docs/components/stratosphere.md), a set of custom system modules.
|
+ [exosphère](components/exosphere.md)
|
||||||
+ [Thermosphère](../docs/components/thermosphere.md), a hypervisor-based emuNAND implementation. This component has not been implemented yet.
|
+ [thermosphère](components/thermosphere.md)
|
||||||
+ [Troposphère](../docs/components/troposphere.md), Application-level patches to the Horizon OS. This component has also not been implemented yet.
|
+ [mesosphère](components/mesosphere.md)
|
||||||
|
+ [stratosphère](components/stratosphere.md)
|
||||||
|
+ [troposphère](components/troposphere.md)
|
||||||
|
|
||||||
### Modules
|
Additionally, Atmosphère also provides the following secondary components:
|
||||||
The Stratosphère component of Atmosphère contains various modules. These have a `.kip` extension. They provide custom features, extend existing features, or replace Nintendo sysmodules.
|
+ [emummc](components/emummc.md)
|
||||||
|
+ [sept](components/sept.md)
|
||||||
|
+ [libraries](components/libraries.md)
|
||||||
|
|
||||||
Stratosphère's modules include:
|
## Features
|
||||||
+ [boot](../docs/modules/boot.md)
|
Atmosphère provides several original features which add or expand functionalities for the customized firmware environment:
|
||||||
+ [creport](../docs/modules/creport.md)
|
+ [Cheats](features/cheats.md)
|
||||||
+ [fs_mitm](../docs/modules/fs_mitm.md)
|
+ [Configurations](features/configurations.md)
|
||||||
+ [loader](../docs/modules/loader.md)
|
|
||||||
+ [pm](../docs/modules/pm.md)
|
|
||||||
+ [sm](../docs/modules/sm.md)
|
|
||||||
|
|
||||||
### Building Atmosphère
|
## Building Atmosphère
|
||||||
A guide to building Atmosphère can be found [here](../docs/building.md).
|
A guide to building Atmosphère can be found [here](building.md).
|
||||||
|
|
||||||
### Upcoming Features
|
## Upcoming Features
|
||||||
A list of planned features for Atmosphère can be found [here](../docs/roadmap.md).
|
A list of planned features for Atmosphère can be found [here](roadmap.md).
|
||||||
|
|
||||||
### Release History
|
## Release History
|
||||||
A changelog of previous versions of Atmosphère can be found [here](../docs/changelog.md).
|
A changelog of previous versions of Atmosphère can be found [here](changelog.md).
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# boot
|
|
||||||
The boot module is responsible for booting the system and initalizing hardware. A second boot module known as boot2 is integrated with the [pm (process manager)](../modules/pm.md) sysmodule in Atmosphère, and launches other processes.
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# creport
|
|
||||||
creport is a reimplementation of Nintendo's crash reporter. Atmosphère's creport catches all error logs that would have been saved to the NAND and instead saves them to the SD card for debugging purposes. This is helpful because the errors no longer go to Nintendo and developers of homebrew can still see the errors to help with the debugging process. creport catches system errors, game crashes, and homebrew crashes.
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
# dmnt
|
|
||||||
|
|
||||||
dmnt is a reimplementation of Nintendo's debug monitor. It provides Atmosphère a rich set of debugging functionality, so that users can easily analyze the behaviors of programs. In addition, Atmosphère implements an extension in dmnt to provide cheat code functionality.
|
|
||||||
|
|
||||||
## Atmosphère Cheat Extension
|
|
||||||
|
|
||||||
In addition to the functionality provided by Nintendo's debug monitor, Atmosphère's dmnt has an extension for providing cheat code functionality. A HIPC Service API is provided for interacting with the cheat code manager, through the service `dmnt:cht`.
|
|
||||||
|
|
||||||
Those looking for more information on the cheat code functionality may wish to read `cheats.md`.
|
|
||||||
|
|
||||||
The SwIPC definition for `dmnt:cht` follows.
|
|
||||||
```
|
|
||||||
interface DmntCheatService is dmnt:cht {
|
|
||||||
[65000] HasCheatProcess() -> bool;
|
|
||||||
[65001] GetCheatProcessEvent() -> KObject;
|
|
||||||
[65002] GetCheatProcessMetadata() -> CheatProcessMetadata;
|
|
||||||
[65003] ForceOpenCheatProcess();
|
|
||||||
|
|
||||||
[65100] GetCheatProcessMappingCount() -> u64;
|
|
||||||
[65101] GetCheatProcessMappings(u64 offset) -> buffer<MemoryInfo, 6>, u64 count;
|
|
||||||
[65102] ReadCheatProcessMemory(u64 address, u64 size) -> buffer<u8, 6> data;
|
|
||||||
[65103] WriteCheatProcessMemory(u64 address, u64 size, buffer<u8, 5> data);
|
|
||||||
[65104] QueryCheatProcessMemory(u64 address) -> MemoryInfo;
|
|
||||||
|
|
||||||
[65200] GetCheatCount() -> u64;
|
|
||||||
[65201] GetCheats(u64 offset) -> buffer<CheatEntry, 6>, u64 count;
|
|
||||||
[65202] GetCheatById(u32 cheat_id) -> buffer<CheatEntry, 6> cheat;
|
|
||||||
[65203] ToggleCheat(u32 cheat_id);
|
|
||||||
[65204] AddCheat(buffer<CheatDefinition, 5> cheat, bool enabled) -> u32 cheat_id;
|
|
||||||
[65203] RemoveCheat(u32 cheat_id);
|
|
||||||
|
|
||||||
[65300] GetFrozenAddressCount() -> u64;
|
|
||||||
[65301] GetFrozenAddresses(u64 offset) -> buffer<FrozenAddressEntry, 6>, u64 count;
|
|
||||||
[65302] GetFrozenAddress(u64 address) -> FrozenAddressEntry;
|
|
||||||
[65303] EnableFrozenAddress(u64 address, u64 width) -> u64 value;
|
|
||||||
[65304] DisableFrozenAddress(u64 address);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# fs_mitm
|
|
||||||
fs_mitm is a sysmodule that enables intercepting file system operations. This module can log, deny, delay, replace, or redirect any request made to the filesystem. It enables LayeredFS to function, which allows for replacement of game assets.
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
# loader
|
|
||||||
|
|
||||||
loader is a reimplementation of the loader sysmodule. This module is responsible for creating processes from executable NSO images and registering their access control with the kernel, sm, and fs.
|
|
||||||
|
|
||||||
## Atmosphère Extensions
|
|
||||||
|
|
||||||
Atmosphère extends this module to allow executables to be replaced or patched by files stored on the SD card. Note that a few services are required for SD card access and therefore cannot be replaced or patched in this manner. This includes psc, bus, and pcv.
|
|
||||||
|
|
||||||
### Exefs Replacement
|
|
||||||
|
|
||||||
TODO: details on buttons affecting this.
|
|
||||||
|
|
||||||
When a process is created, loader will search for several NSO filenames in the title's exefs directory.
|
|
||||||
These filenames are, in this order:
|
|
||||||
|
|
||||||
- rtld
|
|
||||||
- main
|
|
||||||
- subsdk0
|
|
||||||
- subsdk1
|
|
||||||
- ...
|
|
||||||
- subsdk9
|
|
||||||
- sdk
|
|
||||||
|
|
||||||
Each NSO that is found will be loaded into the process contiguously. The process's entrypoint is at the first NSO to be loaded, usually `rtld` or `main`.
|
|
||||||
|
|
||||||
Additionally, when a process is loaded, loader will search for a `main.npdm` file in the exefs directory specifying the title's permissions.
|
|
||||||
|
|
||||||
Atmosphère extends this functionality by also searching for these files on the SD card. When searching for a file, loader will first check if it exists on the SD card. If it does, that file will be used instead. Otherwise, it will use the copy located in the exefs, if that is present. The following directory will be searched.
|
|
||||||
|
|
||||||
```
|
|
||||||
sdmc:/atmosphere/titles/<title id>/exefs/
|
|
||||||
```
|
|
||||||
|
|
||||||
This allows the replacement of applets, sysmodules, or even games with homebrew versions.
|
|
||||||
|
|
||||||
In order to prevent an NSO from being loaded even if it exists in the exefs, loader will also check if a stub file exists. If such a file exists, the NSO will not be loaded. The files should be named like `rtld.stub`, `main.stub`, etc. and may be empty.
|
|
||||||
|
|
||||||
### NSO Patching
|
|
||||||
|
|
||||||
TODO: details on buttons affecting this.
|
|
||||||
|
|
||||||
When an NSO is loaded, the stratosphere implementatin of loader will search for IPS patch files on the SD card in the following locations.
|
|
||||||
```
|
|
||||||
sdmc:/atmosphere/exefs_patches/<patchset name>/<nso build id>.ips
|
|
||||||
```
|
|
||||||
This organization allows patchsets affecting multiple NSOs to be distributed as a single directory. Patches will be searched for in each patchset directory. The name of each patch file should match the hexadecimal build ID of the NSO to affect, except that trailing zero bytes may be left off. Because the NSO build ID is unique for every NSO, this means patches will only apply to the files they are meant to apply to.
|
|
||||||
|
|
||||||
Patch files are accepted in either IPS format or IPS32 format.
|
|
||||||
|
|
||||||
Because NSO files are compressed, patch files are not made between the original version of a compressed NSO and the modified version of such an NSO. Instead, they are made between the uncompressed version of an NSO and the modified (and still uncompressed) version of that NSO. This also means that a patch file cannot be manually applied to the compressed version of an NSO; it must be applied to the uncompressed version. The Stratosphere implementation of loader will correctly apply these patches while loading the process regardless of whether the NSO it finds is compressed or not.
|
|
||||||
|
|
||||||
When authoring patches, [hactool](https://github.com/SciresM/hactool) can be used to find an NSO's build ID and to uncompress NSOs. Recent versions of the [ReSwitched IDA loaders](https://github.com/reswitched/loaders) can be used to load uncompressed NSOs into IDA in such a way that you can [apply patches to the input file](https://www.hex-rays.com/products/ida/support/idadoc/1618.shtml). From there, any IPS tool can be used to create the patch between the original NSO and the patched NSO. Note that if the NSO you are patching is larger than 16 MiB, you will have to use a tool that supports IPS32.
|
|
||||||
|
|
||||||
### HBL Support
|
|
||||||
|
|
||||||
Atmosphère can use the loader module in order to turn any game on your Switch's home menu into a launchpoint for the Homebrew Menu, rather than launching it through the album applet. This allows one to launch the Homebrew Menu with access to the ~3.2GB of RAM that the Switch reserves for games and applications, as opposed to the 442MB of RAM we are limited to when launching the Homebrew Menu from the album. This also means that it is no longer necessary to install homebrew as `.nsp` files on your Switch so long as you are using this method, as the only reason to do so is to allow the homebrew to access all of the Switch's available memory.
|
|
||||||
|
|
||||||
In order to setup this method you will need the latest release of [hbmenu](https://github.com/switchbrew/nx-hbmenu/releases), and the latest release of [hbloader](https://github.com/switchbrew/nx-hbloader/releases). Place `hbmenu.nro` on the root of your Switch's SD Card, and place `hbl.nsp` in the atmosphere folder. From there, simply launch any title while holding the button specified in `loader.ini`.
|
|
||||||
|
|
||||||
In addition, loader has extensions to enable homebrew to launch web applets. This normally requires the application launching the applet have HTML Manual content inside an installed NCA; Atmosphère's loader will automatically ensure that the commands used to check this succeed, and will (in tandem with `fs.mitm`) redirect the relevant filesystem to the `sdmc:/atmosphere/hbl_html/` subdirectory.
|
|
||||||
|
|
||||||
### Button Overrides
|
|
||||||
|
|
||||||
By default `loader.ini` is configured to launch the Homebrew Menu when launching any game while holding down the override key (defaults to R). If you wish to change this, you can modify the override_key section of `loader.ini`. Alternatively, if you would like to only allow hbmenu on a specific app, configure `loader.ini` in the atmosphere folder by replacing the Title ID in the ini (title_id in the [hbl_config] section, it is the Title ID for the album by default) with the Title ID of whatever game you wish to use to launch the Homebrew Menu, and set override_any_app to false. A list of Title IDs for Switch Games can be found [here](https://switchbrew.org/wiki/Title_list/Games).
|
|
||||||
|
|
||||||
To invert the behaviour of the override key, place an exclamation point in front of whatever button you wish to use. It will launch the actual game while holding down that button, instead of going into the Homebrew Menu. For example, `override_key=!R` will run the game only while holding down R when launching it, otherwise it will boot into the Homebrew Menu. Afterwards you may reinsert your SD Card into your Switch and boot into Atmosphère as you normally would. You should now be able to boot into the Homebrew Menu by launching your designated title of choice.
|
|
||||||
|
|
||||||
A list of valid buttons can be found here:
|
|
||||||
|
|
||||||
| Formal Name | .ini Name |
|
|
||||||
| ----------- | --------- |
|
|
||||||
| A Button | A |
|
|
||||||
| B Button | B |
|
|
||||||
| X Button | X |
|
|
||||||
| Y Button | Y |
|
|
||||||
| Left Stick | LS |
|
|
||||||
| Right Stick | RS |
|
|
||||||
| L Button | L |
|
|
||||||
| R Button | R |
|
|
||||||
| ZL Button | ZL |
|
|
||||||
| ZR Button | ZR |
|
|
||||||
| + Button | PLUS |
|
|
||||||
| - Button | MINUS |
|
|
||||||
| Left Dpad | DLEFT |
|
|
||||||
| Up Dpad | DUP |
|
|
||||||
| Right Dpad | DRIGHT |
|
|
||||||
| Down Dpad | DDOWN |
|
|
||||||
| SL Button | SL |
|
|
||||||
| SR Button | SR |
|
|
||||||
|
|
||||||
### SM MITM Integration
|
|
||||||
|
|
||||||
When the Stratosphere implementation of loader creates a new process, it notifies [sm](sm.md) through the `AtmosphereAssociatePidTidForMitm` command to notify any MITM services of new processes' identities.
|
|
||||||
|
|
||||||
### IPC: AtmosphereSetExternalContentSource and AtmosphereClearExternalContentSource
|
|
||||||
|
|
||||||
Two additional commands are added to the [`ldr:shel`](https://reswitched.github.io/SwIPC/ifaces.html#nn::ro::detail::ILdrShellInterface) interface, called `AtmosphereSetExternalContentSource` and `AtmosphereClearExternalContentSource`.
|
|
||||||
Their command IDs are `65000` and `65001` on all system firmware versions.
|
|
||||||
|
|
||||||
`AtmosphereSetExternalContentSource` takes a `u64 tid` and returns a server-side session handle.
|
|
||||||
The client is expected to implement the `IFileSystem` interface on the returned handle. The next
|
|
||||||
time the title specified by the given title ID is launched, its ExeFS contents will be loaded from
|
|
||||||
the custom `IFileSystem` instead of from SD card or original ExeFS. NSOs loaded from external
|
|
||||||
content source may still be subject to exefs IPS patches. After the title is launched successfuly,
|
|
||||||
the `IFileSystem` is closed and the external content source override is removed. If
|
|
||||||
`AtmosphereSetExternalContentSource` is called on a title that already has an external content
|
|
||||||
source set for it, the existing one will be removed and replaced with the new one. It is illegal to
|
|
||||||
call `AtmosphereSetExternalContentSource` while the title is being launched.
|
|
||||||
|
|
||||||
If title launching fails, the external content source remains registered. The
|
|
||||||
`AtmosphereClearExternalContentSource` command can be used to clear an external content source if
|
|
||||||
title launch fails.
|
|
||||||
|
|
||||||
The `IFileSystem` only needs to implement `OpenFile` and `GetFileTimeStampRaw`. The paths received
|
|
||||||
by the `IFileSystem`'s `OpenFile` command begin with slashes, as in `/main`, `/rtld`, and `/main.npdm`.
|
|
||||||
A result code of 0x202 should be returned if the file does not exist. `GetFileTimeStampRaw` can just
|
|
||||||
be a stub. The `IFile`s returned from `OpenFile` only need to implement `Read` and `GetSize`.
|
|
||||||
|
|
||||||
The SwIPC definitions for the extension commands follow.
|
|
||||||
```
|
|
||||||
interface nn::ldr::detail::IShellInterface is ldr:shel {
|
|
||||||
...
|
|
||||||
[65000] AtmosphereSetExternalContentSource(u64 tid) -> handle<copy, session_server> ifilesystem_handle;
|
|
||||||
[65001] AtmosphereClearExternalContentSource(u64 tid);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# pm
|
|
||||||
|
|
||||||
pm is a reimplementation of Nintendo's process manager. This module is responsible for tracking running processes on the system, and managing resource limits. pm is also required to create and manage processes for homebrew applications.
|
|
||||||
|
|
||||||
## Atmosphère Extensions
|
|
||||||
|
|
||||||
There are a few ways in which the Stratosphere implementation of pm differs intentionally from the stock pm.
|
|
||||||
|
|
||||||
### IPC: AtmosphereGetProcessHandle
|
|
||||||
|
|
||||||
The Stratosphere implementation of pm adds an additional command to the [`pm:dmnt`](https://reswitched.github.io/SwIPC/ifaces.html#nn::pm::detail::IDebugMonitorInterface) interface, called `AtmosphereGetProcessHandle`. Its command ID is `65000` on all system firmware versions. It takes a `u64 process_id` and returns a process handle for the specified process, if that process is known. Notable exceptions include KIPs, which are not known to pm. If the specified process cannot be found, error code 0x20F is returned.
|
|
||||||
|
|
||||||
The SwIPC definition for this command follows.
|
|
||||||
```
|
|
||||||
interface nn::pm::detail::IDebugMonitorInterface is pm:dmnt {
|
|
||||||
...
|
|
||||||
[65000] AtmosphereGetProcessInfo(u64 pid) -> handle<copy, process> process_handle, u64 title_id, u64 storage_id;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Extra System Memory for Sysmodules
|
|
||||||
|
|
||||||
The Stratosphere implementation of pm shrinks the APPLET memory pool by 24 MiB by default, giving this memory to the SYSTEM pool. This allows custom sysmodules to use more memory without hitting the SYSTEM memory limit.
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
# set_mitm
|
|
||||||
set_mitm is a sysmodule that enables intercepting requests to the system settings service.
|
|
||||||
|
|
||||||
## Atmosphère Extensions
|
|
||||||
|
|
||||||
set_mitm intercepts the `GetFirmwareVersion` command, if the requester is `qlaunch` or `maintenance`.\
|
|
||||||
It modifies the `display_version` field of the returned system version, causing the version to display\
|
|
||||||
in settings as `#.#.# (AMS #.#.#)`. This allows users to easily verify what version of Atmosphère they are running.
|
|
||||||
|
|
||||||
set_mitm also intercepts the `GetSettingsItemValueSize` and `GetSettingsItemValue` commands for all requesters.\
|
|
||||||
It does so in order to enable user configuration of system settings, which are parsed from `atmosphere/system_settings.ini` on boot.\
|
|
||||||
The format for settings is described below.
|
|
||||||
|
|
||||||
### Atmosphère Settings Format
|
|
||||||
|
|
||||||
Settings are parsed from the `atmosphere/system_settings.ini` file during the boot process. This file is a normal ini file,\
|
|
||||||
with some specific interpretations.
|
|
||||||
|
|
||||||
The standard representation of a system setting's identifier takes the form `name!key`. This is represented within\
|
|
||||||
`system_settings.ini` as a section `name`, with an entry `key`. For example:
|
|
||||||
|
|
||||||
```
|
|
||||||
[name]
|
|
||||||
key = ...
|
|
||||||
```
|
|
||||||
|
|
||||||
System settings can have variable types (strings, integral values, byte arrays, etc). To accommodate this, `system_settings.ini`\
|
|
||||||
must store values as a `type_identifier!value_store` pair. A number of different types are supported, with identifiers detailed below.\
|
|
||||||
Please note that a malformed value string will cause a fatal error to occur on boot. A full example of a custom setting is given below\
|
|
||||||
(setting `eupld!upload_enabled = 0`), for posterity:
|
|
||||||
|
|
||||||
```
|
|
||||||
[eupld]
|
|
||||||
upload_enabled = u8!0x0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Supported Types
|
|
||||||
|
|
||||||
* Strings
|
|
||||||
* Type identifiers: `str`, `string`
|
|
||||||
* The value string is used directly as the setting, with null terminator appended.
|
|
||||||
* Integral types
|
|
||||||
* Type identifiers: `u8`, `u16`, `u32`, `u64`
|
|
||||||
* The value string is parsed via a call to `strtoul(value, NULL, 0)`.
|
|
||||||
* Setting bitwidth is determined by the identifier (8 for 1 byte, 16 for 2 bytes, and so on).
|
|
||||||
* Raw bytes
|
|
||||||
* Type identifiers: `hex`, `bytes`
|
|
||||||
* The value string is parsed as a hexadecimal string.
|
|
||||||
* The value string must be of even length, or a fatal error will be thrown on parse.
|
|
||||||
|
|
||||||
### Atmosphère Custom Settings
|
|
||||||
|
|
||||||
At the time of writing, Atmosphère implements two custom settings, found in the `atmosphere` section.\
|
|
||||||
|
|
||||||
While not used for set_mitm, `power_menu_reboot_function` is loaded and controls the reboot behaviour of the console. By default, this value\
|
|
||||||
is "payload", where the console will automatically reboot into the RCM payload stored in `sdmc:/atmosphere/reboot_payload.bin`.\
|
|
||||||
(This payload is also used for fatal, upon a serious crash.) Setting the value to "rcm" reboots directly into RCM, and setting the value\
|
|
||||||
to "normal" skips these behaviours.
|
|
||||||
|
|
||||||
```
|
|
||||||
[atmosphere]
|
|
||||||
power_menu_reboot_function = str!payload
|
|
||||||
```
|
|
||||||
|
|
||||||
`dmnt_cheats_enabled_by_default` controls the behaviour of dmnt's cheat functionality. By default, this value is "0x1", enabling any cheats\
|
|
||||||
defined by the user. Check [cheats](../cheats.md) for more information about Atmosphère's cheat functionality.
|
|
||||||
|
|
||||||
```
|
|
||||||
[atmosphere]
|
|
||||||
dmnt_cheats_enabled_by_default = u8!0x1
|
|
||||||
```
|
|
||||||
|
|
||||||
`dmnt_always_save_cheat_toggles` controls the behaviour of dmnt's cheat toggle functionality. By default, this value is "0x0", causing toggles to\
|
|
||||||
only be saved on game quit if a toggle file existed on game boot. Check [cheats](../cheats.md) for more information about Atmosphère's cheat functionality.
|
|
||||||
|
|
||||||
```
|
|
||||||
[atmosphere]
|
|
||||||
dmnt_always_save_cheat_toggles = u8!0x0
|
|
||||||
```
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
# sm
|
|
||||||
|
|
||||||
sm is a reimplementation of Nintendo's service manager. It allows Atmosphère to add or remove process handle limits, add new services, or intercept service calls. This allows high-level intercepting of Horizon OS functionality.
|
|
||||||
|
|
||||||
## Atmosphère Extensions
|
|
||||||
|
|
||||||
There are a few ways in which the Stratosphere implementation of sm differs intentionally from the stock sm.
|
|
||||||
|
|
||||||
### IPC: MITM Commands
|
|
||||||
|
|
||||||
The Stratosphere implementation of sm adds a few additional commands to the [`sm:`](https://reswitched.github.io/SwIPC/ifaces.html#nn::sm::detail::IUserInterface) port session.
|
|
||||||
|
|
||||||
Their SwIPC definitions follow.
|
|
||||||
```
|
|
||||||
interface nn::sm::detail::IUserInterface is sm: {
|
|
||||||
...
|
|
||||||
[65000] AtmosphereInstallMitm(ServiceName service) -> handle<port, move> service, handle<server_session, move> query;
|
|
||||||
[65001] AtmosphereUninstallMitm(ServiceName service);
|
|
||||||
[65002] AtmosphereAssociatePidTidForMitm(u64 pid, u64 tid);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Additionally, an interface `sm:dmnt` has been created to allow a debug monitor to query sm's state.
|
|
||||||
|
|
||||||
Its SwIPC definition follows.
|
|
||||||
```
|
|
||||||
interface nn::sm::detail::IDebugMonitorInterface is sm:dmnt {
|
|
||||||
[65000] AtmosphereGetServiceRecord(ServiceName name) -> SmServiceRecord;
|
|
||||||
[65001] AtmosphereListServiceRecords(u64 offset) -> buffer<SmServiceRecord, 6>, u64 count;
|
|
||||||
[65002] AtmosphereGetServiceRecordSize() -> u64 record_size;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### AtmosphereInstallMitm
|
|
||||||
|
|
||||||
This command alters the registration for the named service, in order to allow services to intercept communication between client processes and their intended services. It is used by [fs_mitm](fs_mitm.md).
|
|
||||||
|
|
||||||
It takes the name of the service to install an MITM for, and returns two handles. The first is a port handle, similar to those returned from the [RegisterService](https://reswitched.github.io/SwIPC/ifaces.html#nn::sm::detail::IUserInterface(2)) command. The second is the server side of a session, called the query session. This session will used by sm to determine whether or not a new session should be intercepted, and to inform the MITM service of the identity of new processes.
|
|
||||||
|
|
||||||
The query session is expected to implement the following interface.
|
|
||||||
```
|
|
||||||
interface MitmQueryService {
|
|
||||||
[65000] ShouldMitm(u64 pid) -> u64 should_mitm;
|
|
||||||
[65001] AssociatePidTid(u64 pid, u64 tid);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The `ShouldMitm` command is invoked whenever a process attempts to make a new connection to the MITM'd service. It should return `0` if the process's connection should not be intercepted. Any other value will cause the process's connection to be intercepted. If the command returns an error code, the process's connection will not be intercepted.
|
|
||||||
|
|
||||||
The `AssociatePidTid` command is invoked on all MITM query sessions whenever a new process is created, in order to inform those services of the identity of a newly created process before it attempts to connect to any services.
|
|
||||||
|
|
||||||
If the process that installed the MITM attempts to connect to the service, it will always connect to the original service.
|
|
||||||
|
|
||||||
This command requires that the session be initialized, returning error code 0x415 if it is not.\
|
|
||||||
If the given service name is invalid, error code 0xC15 is returned.\
|
|
||||||
If the user does not have service registration permission for the named service, error code 0x1015 is returned.\
|
|
||||||
If the service already has an MITM installed, error code 0x815 is returned.\
|
|
||||||
If the service has not yet been registered, the request will be deferred until the service is registered in the same manner as IUserInterface::GetService.
|
|
||||||
|
|
||||||
#### AtmosphereUninstallMitm
|
|
||||||
|
|
||||||
Removes any installed MITM for the named service.
|
|
||||||
|
|
||||||
This command requires that the session be initialized, returning error code 0x415 if it is not.
|
|
||||||
|
|
||||||
#### AtmosphereAssociatePidTidForMitm
|
|
||||||
|
|
||||||
This command is used internally by the Stratosphere implementation of the [loader](loader.md) sysmodule, when a new process is created. It will call the `AssociatePidTid` command on every registered MITM query session.
|
|
||||||
|
|
||||||
If the given process ID refers to a kernel internal process, error code 0x1015 is returned. This command requires that the session be initialized, returning error code 0x415 if it is not.
|
|
||||||
|
|
||||||
#### AtmosphereGetServiceRecordSize
|
|
||||||
|
|
||||||
Retrieves `sizeof(SmServiceRecord)` for a service. The current format of `SmServiceRecord` structure follows.
|
|
||||||
|
|
||||||
```
|
|
||||||
struct SmServiceRecord {
|
|
||||||
uint64_t service_name;
|
|
||||||
uint64_t owner_pid;
|
|
||||||
uint64_t max_sessions;
|
|
||||||
uint64_t mitm_pid;
|
|
||||||
uint64_t mitm_waiting_ack_pid;
|
|
||||||
bool is_light;
|
|
||||||
bool mitm_waiting_ack;
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
#### AtmosphereGetServiceRecord
|
|
||||||
|
|
||||||
Retrieves a service registration record for a service.
|
|
||||||
|
|
||||||
#### AtmosphereListServiceRecords
|
|
||||||
|
|
||||||
Provides a list of service registrations records.
|
|
||||||
|
|
||||||
The command will return an array of `SmServiceRecord`s, skipping `offset` records. The number of records returned is indicated by `count`.
|
|
||||||
If `count` is less than the size of the buffer divided by `sizeof(SmServiceRecord)` (the buffer was not completely filled), the end of the service registration list has been reached. Otherwise, client code
|
|
||||||
should increment `offset` by `count` and call again. Client code should retrieve a record size using `AtmosphereGetServiceRecordSize`, and either make sure that the size of a record matches what it expects,
|
|
||||||
or should make sure to use the correct size as the stride while iterating over the array of returned records. Example pseudocode is shown below.
|
|
||||||
|
|
||||||
```
|
|
||||||
offset = 0;
|
|
||||||
record_size = AtmosphereGetServiceRecordSize();
|
|
||||||
do {
|
|
||||||
SmServiceRecord records[16];
|
|
||||||
count = AtmosphereListServiceRecords(offset, buffer(records));
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
SmServiceRecord record = {0};
|
|
||||||
memcpy(&record, &records[i], min(record_size, sizeof(SmServiceRecord));
|
|
||||||
/* process record */
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
} while(count == sizeof(records) / record_size);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Minimum Session Limit
|
|
||||||
|
|
||||||
When a service is registered, the sysmodule registering it must specify a limit on the number of sessions that are allowed to be active for that service at a time. This is used to ensure that services like `fs-pr`, `fs-ldr`, and `ldr:pm` can only be connected to once, adding an additional layer of safety over the regular service verification to ensure that those services are only connected to by the highly priveleged process they are intended to be used by.
|
|
||||||
|
|
||||||
By default, the Stratosphere implementation of PM will raise any session limits to at least 8, meaning that for services like `fs-pr` and those mentioned above, up to 8 processes will be able to connect to those sessions, leaving 7 sessions for homebrew to use.
|
|
||||||
|
|
||||||
### Weak Service Verification
|
|
||||||
|
|
||||||
In system firmware versions before 3.0.1, if a process did not call the [Initialize](https://reswitched.github.io/SwIPC/ifaces.html#nn::sm::detail::IUserInterface(0)) command on its `sm:` session, normally used to inform sm of the process's identity, sm would assume that the process was a kernel internal process and skip any service registration or access checks. The Stratosphere implementation of sm does not implement this vulnerability, and initialization is required on all firmware versions.
|
|
||||||
@@ -1,16 +1,49 @@
|
|||||||
# Planned Features
|
# Planned Features
|
||||||
The following features are planned to be added in future versions of Atmosphère:
|
atmosphère has a number of features that are either works-in-progress or planned. Please note that while time-estimates are given, they are loose, and things may be completed sooner or later than advertised.
|
||||||
+ Thermosphère, a hypervisor-based emunand implementation.
|
|
||||||
+ A feature-rich debugging toolset (a component of Stratosphère).
|
The following descriptions were last updated in late April of 2020.
|
||||||
+ A custom debug monitor system module, providing an API for debugging Switch's processes. This may not be a reimplementation of Nintendo's own debug monitor.
|
|
||||||
+ This should include a gdbstub implementation, possibly borrowing from Luma3DS's.
|
## system updater api
|
||||||
+ This API should be additionally usable for RAM Editing/"Cheat Engine" purposes.
|
* **Description**: A planned extension api for stratosphere (tenatively `ams:su`), this will provide an interface for homebrew to safely install system upgrades or downgrades. This will allow for much more easily transitioning safely between different versions of the operating system.
|
||||||
+ A custom shell system module, providing an means for users to perform various RPC (with support for common/interesting functionality) on their Switch remotely. This may not be a reimplementation of Nintendo's own shell.
|
* **Development Status**: Under active development by SciresM
|
||||||
+ This should support client connections over both Wi-Fi and USB.
|
* **Estimated Time**: May 2020
|
||||||
+ A custom logging system module, providing a means for other Atmosphère components (and possibly Nintendo's own system modules) to log debug output.
|
|
||||||
+ This should support logging to the SD card, over Wi-Fi, and over USB.
|
## settings reimplementation
|
||||||
+ An application-level plugin system.
|
* **Description**: A planned reimplementation of the settings system module, and with it a removal of the settings mitm. This will greatly simplify atmosphère's boot process, and will allow much more flexible control over the various system settings.
|
||||||
+ This will, ideally, work somewhat like NTR-CFW's plugin system on the 3DS, allowing users to run their own code in a game's process in their own thread.
|
* **Development Status**: Undergoing research/initial development by Adubbz.
|
||||||
+ An AR Code/Gameshark analog implementation, allowing for easy sharing/development of cheat codes to run on device.
|
* **Estimated Time**: Mid 2020
|
||||||
+ Further extensions to existing Atmosphère components.
|
|
||||||
+ General system stability improvements to enhance the user's experience.
|
## mesosphere
|
||||||
|
* **Description**: mesosphère is a reimplementation of the Horizon operating system's Kernel. It aims to provide an open-source reference for Nintendo's code.
|
||||||
|
* **Development Status**: Under semi-active development by SciresM; temporarily on pause while the System Updater API is completed.
|
||||||
|
* **Estimated Time**: Mid-to-Late 2020
|
||||||
|
|
||||||
|
## exosphere re-write
|
||||||
|
* **Description**: exosphère, atmosphère's reimplementation of Horizon's Secure Monitor, was the first component authored for the project in early 2018. It is written in C, and in a style very different from the rest of atmosphère's code. In addition, exosphère was written to conform to constraints that no longer apply in an environment where it is not launched from the web browser, and where using a custom firmware image to orchestrate wake-from-sleep is possible. exosphère currently uses all but 1 KB of the space available to it, putting it at risk of breaking as future firmware updates are supported. A re-write will solve these issues.
|
||||||
|
* **Development Status**: Planned.
|
||||||
|
* **Estimated Time**: 2020-2021.
|
||||||
|
|
||||||
|
## tma reimplementation
|
||||||
|
* **Description** tma ("target manager agent") is a system module that manages communication between the Switch and a client PC. Atmosphere's implementation will allow homebrew on the switch to communicate with a connected PC to do various operations such as exchanging data or interacting with files. It will also serve as the communicator for Atmosphère's planned debugger. This will also include PC-side software for interacting with the Switch.
|
||||||
|
* **Development Status**: Planned. Switch-side code is fully implemented but needs heavy refactoring/rebasing, as the code was originally authored in 2018.
|
||||||
|
* **Estimated Time**: Late 2020-2021.
|
||||||
|
|
||||||
|
## dmnt.gen2 reimplementation
|
||||||
|
* **Description**: A reimplementation of the Switch's debug monitor, dmnt will provide an interface for debugging applications or system modules running on the Switch. This will include a gdbstub for debugging actively-running system components or applications.
|
||||||
|
* **Development Status**: Planned
|
||||||
|
* **Estimated Time**: 2021
|
||||||
|
|
||||||
|
## fs reimplementation
|
||||||
|
* **Description**: Following mesosphère's completion, atmosphère will have reimplemented all components of the BootImagePackage firmware except for the filesystem services system module. Reimplementing fs will allow for fixing Nintendo bugs (such as corruption when using exFAT filesystems and encoding inconsistencies with UTF-8 and Shift-JIS).
|
||||||
|
* **Development Status**: Planned.
|
||||||
|
* **Estimated Time**: 2021-2022.
|
||||||
|
|
||||||
|
## thermosphère
|
||||||
|
* **Description**: A general-purpose hypervisor, thermosphère will enable the virtualization of the Switch's operating system; this is planned to enable debugging of the Switch's kernel.
|
||||||
|
* **Development Status**: Under semi-active development by TuxSH.
|
||||||
|
* **Estimated Time**: 2020-2021.
|
||||||
|
|
||||||
|
## other planned features
|
||||||
|
* **Description**: General system stability improvements to enhance the user's experience.
|
||||||
|
* **Development Status**: Undergoing active development by all members of the atmosphère team.
|
||||||
|
* **Estimated Time**: June 15th.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
[subrepo]
|
[subrepo]
|
||||||
remote = https://github.com/m4xw/emuMMC
|
remote = https://github.com/m4xw/emuMMC
|
||||||
branch = develop
|
branch = develop
|
||||||
commit = bd81a674a946c30b566e1732a95c18f19b701558
|
commit = 292a8ad42c8e9f4c9a474b46a5a3190398581131
|
||||||
parent = 6ee525201ccef107c61d81ba73c891e3eb5f0215
|
parent = 491ba8fdcfd39a503bedd21b282991fc19aec7d4
|
||||||
method = rebase
|
method = rebase
|
||||||
cmdver = 0.4.0
|
cmdver = 0.4.1
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
# emuMMC
|
# emuMMC
|
||||||
*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw***
|
*A SDMMC driver replacement for Nintendo's Filesystem Services, by **m4xw***
|
||||||
|
|
||||||
### Supported Horizon Versions
|
### Supported Horizon Versions
|
||||||
**1.0.0 - 9.1.0**
|
**1.0.0 - 10.0.0**
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Arbitrary SDMMC backend selection
|
* Arbitrary SDMMC backend selection
|
||||||
**This allows loading eMMC from SD or even SD from eMMC**
|
**This allows loading eMMC from SD or even SD from eMMC**
|
||||||
* On the fly hooking / patching, fully self-infesting
|
* On the fly hooking / patching, fully self-infesting
|
||||||
**Only one payload required for all versions!**
|
**Only one payload required for all versions!**
|
||||||
* File-based SDMMC backend support (from SD)
|
* File-based SDMMC backend support (from SD)
|
||||||
**This allows loading eMMC images from hekate-backups (split or not)**
|
**This allows loading eMMC images from hekate-backups (split or not)**
|
||||||
* SDMMC device based sector offset (*currently eMMC only*)
|
* SDMMC device based sector offset (*currently eMMC only*)
|
||||||
**Raw partition support for eMMC from SD with less performance overhead**
|
**Raw partition support for eMMC from SD with less performance overhead**
|
||||||
* Full support for `/Nintendo` folder redirection to a arbitrary path
|
* Full support for `/Nintendo` folder redirection to a arbitrary path
|
||||||
**No 8 char length restriction!**
|
**No 8 char length restriction!**
|
||||||
* exosphere based context configuration
|
* exosphere based context configuration
|
||||||
**This includes full support for multiple emuMMC images**
|
**This includes full support for multiple emuMMC images**
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|||||||
@@ -117,6 +117,8 @@
|
|||||||
"svcReplyAndReceiveWithUserBuffer": "0x44",
|
"svcReplyAndReceiveWithUserBuffer": "0x44",
|
||||||
"svcCreateEvent": "0x45",
|
"svcCreateEvent": "0x45",
|
||||||
"svcReadWriteRegister": "0x4E",
|
"svcReadWriteRegister": "0x4E",
|
||||||
|
"svcMapTransferMemory": "0x51",
|
||||||
|
"svcUnmapTransferMemory": "0x52",
|
||||||
"svcCreateInterruptEvent": "0x53",
|
"svcCreateInterruptEvent": "0x53",
|
||||||
"svcQueryIoMapping": "0x55",
|
"svcQueryIoMapping": "0x55",
|
||||||
"svcCreateDeviceAddressSpace": "0x56",
|
"svcCreateDeviceAddressSpace": "0x56",
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include "offsets/900_exfat.h"
|
#include "offsets/900_exfat.h"
|
||||||
#include "offsets/910.h"
|
#include "offsets/910.h"
|
||||||
#include "offsets/910_exfat.h"
|
#include "offsets/910_exfat.h"
|
||||||
|
#include "offsets/1000.h"
|
||||||
|
#include "offsets/1000_exfat.h"
|
||||||
#include "../utils/fatal.h"
|
#include "../utils/fatal.h"
|
||||||
|
|
||||||
#define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers
|
#define GET_OFFSET_STRUCT_NAME(vers) g_offsets##vers
|
||||||
@@ -100,6 +102,8 @@ DEFINE_OFFSET_STRUCT(_900);
|
|||||||
DEFINE_OFFSET_STRUCT(_900_EXFAT);
|
DEFINE_OFFSET_STRUCT(_900_EXFAT);
|
||||||
DEFINE_OFFSET_STRUCT(_910);
|
DEFINE_OFFSET_STRUCT(_910);
|
||||||
DEFINE_OFFSET_STRUCT(_910_EXFAT);
|
DEFINE_OFFSET_STRUCT(_910_EXFAT);
|
||||||
|
DEFINE_OFFSET_STRUCT(_1000);
|
||||||
|
DEFINE_OFFSET_STRUCT(_1000_EXFAT);
|
||||||
|
|
||||||
const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
|
const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
@@ -161,6 +165,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
|
|||||||
return &(GET_OFFSET_STRUCT_NAME(_910));
|
return &(GET_OFFSET_STRUCT_NAME(_910));
|
||||||
case FS_VER_9_1_0_EXFAT:
|
case FS_VER_9_1_0_EXFAT:
|
||||||
return &(GET_OFFSET_STRUCT_NAME(_910_EXFAT));
|
return &(GET_OFFSET_STRUCT_NAME(_910_EXFAT));
|
||||||
|
case FS_VER_10_0_0:
|
||||||
|
return &(GET_OFFSET_STRUCT_NAME(_1000));
|
||||||
|
case FS_VER_10_0_0_EXFAT:
|
||||||
|
return &(GET_OFFSET_STRUCT_NAME(_1000_EXFAT));
|
||||||
default:
|
default:
|
||||||
fatal_abort(Fatal_UnknownVersion);
|
fatal_abort(Fatal_UnknownVersion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ enum FS_VER
|
|||||||
FS_VER_9_1_0,
|
FS_VER_9_1_0,
|
||||||
FS_VER_9_1_0_EXFAT,
|
FS_VER_9_1_0_EXFAT,
|
||||||
|
|
||||||
|
FS_VER_10_0_0,
|
||||||
|
FS_VER_10_0_0_EXFAT,
|
||||||
|
|
||||||
FS_VER_MAX,
|
FS_VER_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,8 @@
|
|||||||
// Nintendo Paths
|
// Nintendo Paths
|
||||||
#define FS_OFFSET_100_NINTENDO_PATHS \
|
#define FS_OFFSET_100_NINTENDO_PATHS \
|
||||||
{ \
|
{ \
|
||||||
{.opcode_reg = 9, .adrp_offset = 0x00032C58, .add_rel_offset = 4}, \
|
{.opcode_reg = 8, .adrp_offset = 0x00032C58, .add_rel_offset = 8}, \
|
||||||
{.opcode_reg = 8, .adrp_offset = 0x00032C60, .add_rel_offset = 4}, \
|
{.opcode_reg = 9, .adrp_offset = 0x00032F40, .add_rel_offset = 8}, \
|
||||||
{.opcode_reg = 9, .adrp_offset = 0x00032F3C, .add_rel_offset = 4}, \
|
|
||||||
{.opcode_reg = 8, .adrp_offset = 0x00032F44, .add_rel_offset = 4}, \
|
|
||||||
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
58
emummc/source/FS/offsets/1000.h
Normal file
58
emummc/source/FS/offsets/1000.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||||
|
* Copyright (c) 2019 Atmosphere-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __FS_1000_H__
|
||||||
|
#define __FS_1000_H__
|
||||||
|
|
||||||
|
// Accessor vtable getters
|
||||||
|
#define FS_OFFSET_1000_SDMMC_ACCESSOR_GC 0x14DC90
|
||||||
|
#define FS_OFFSET_1000_SDMMC_ACCESSOR_SD 0x14BDA0
|
||||||
|
#define FS_OFFSET_1000_SDMMC_ACCESSOR_NAND 0x146C20
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
#define FS_OFFSET_1000_SDMMC_WRAPPER_READ 0x142380
|
||||||
|
#define FS_OFFSET_1000_SDMMC_WRAPPER_WRITE 0x142460
|
||||||
|
#define FS_OFFSET_1000_RTLD 0x634
|
||||||
|
#define FS_OFFSET_1000_RTLD_DESTINATION 0x9C
|
||||||
|
|
||||||
|
#define FS_OFFSET_1000_CLKRST_SET_MIN_V_CLK_RATE 0x1415A0
|
||||||
|
|
||||||
|
// Misc funcs
|
||||||
|
#define FS_OFFSET_1000_LOCK_MUTEX 0x28910
|
||||||
|
#define FS_OFFSET_1000_UNLOCK_MUTEX 0x28960
|
||||||
|
|
||||||
|
#define FS_OFFSET_1000_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1422E0
|
||||||
|
|
||||||
|
// Misc Data
|
||||||
|
#define FS_OFFSET_1000_SD_MUTEX 0xE273E8
|
||||||
|
#define FS_OFFSET_1000_NAND_MUTEX 0xE22DA0
|
||||||
|
#define FS_OFFSET_1000_ACTIVE_PARTITION 0xE22DE0
|
||||||
|
#define FS_OFFSET_1000_SDMMC_DAS_HANDLE 0xE0AB90
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
#define FS_OFFSET_1000_SD_DAS_INIT 0x151CEC
|
||||||
|
|
||||||
|
// Nintendo Paths
|
||||||
|
#define FS_OFFSET_1000_NINTENDO_PATHS \
|
||||||
|
{ \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0006BBA4, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x00078520, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0007ED0C, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x0009115C, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __FS_1000_H__
|
||||||
58
emummc/source/FS/offsets/1000_exfat.h
Normal file
58
emummc/source/FS/offsets/1000_exfat.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 m4xw <m4x@m4xw.net>
|
||||||
|
* Copyright (c) 2019 Atmosphere-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef __FS_1000_EXFAT_H__
|
||||||
|
#define __FS_1000_EXFAT_H__
|
||||||
|
|
||||||
|
// Accessor vtable getters
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_ACCESSOR_GC 0x14DC90
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_ACCESSOR_SD 0x14BDA0
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_ACCESSOR_NAND 0x146C20
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_WRAPPER_READ 0x142380
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_WRAPPER_WRITE 0x142460
|
||||||
|
#define FS_OFFSET_1000_EXFAT_RTLD 0x634
|
||||||
|
#define FS_OFFSET_1000_EXFAT_RTLD_DESTINATION 0x9C
|
||||||
|
|
||||||
|
#define FS_OFFSET_1000_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x1415A0
|
||||||
|
|
||||||
|
// Misc funcs
|
||||||
|
#define FS_OFFSET_1000_EXFAT_LOCK_MUTEX 0x28910
|
||||||
|
#define FS_OFFSET_1000_EXFAT_UNLOCK_MUTEX 0x28960
|
||||||
|
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x1422E0
|
||||||
|
|
||||||
|
// Misc Data
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SD_MUTEX 0xE353E8
|
||||||
|
#define FS_OFFSET_1000_EXFAT_NAND_MUTEX 0xE30DA0
|
||||||
|
#define FS_OFFSET_1000_EXFAT_ACTIVE_PARTITION 0xE30DE0
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SDMMC_DAS_HANDLE 0xE18B90
|
||||||
|
|
||||||
|
// NOPs
|
||||||
|
#define FS_OFFSET_1000_EXFAT_SD_DAS_INIT 0x151CEC
|
||||||
|
|
||||||
|
// Nintendo Paths
|
||||||
|
#define FS_OFFSET_1000_EXFAT_NINTENDO_PATHS \
|
||||||
|
{ \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0006BBA4, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x00078520, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 3, .adrp_offset = 0x0007ED0C, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 4, .adrp_offset = 0x0009115C, .add_rel_offset = 0x00000004}, \
|
||||||
|
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __FS_1000_EXFAT_H__
|
||||||
@@ -36,7 +36,6 @@ sdmmc_storage_t sd_storage;
|
|||||||
|
|
||||||
// init vars
|
// init vars
|
||||||
bool custom_driver = true;
|
bool custom_driver = true;
|
||||||
extern const volatile emuMMC_ctx_t emuMMC_ctx;
|
|
||||||
|
|
||||||
// FS funcs
|
// FS funcs
|
||||||
_sdmmc_accessor_gc sdmmc_accessor_gc;
|
_sdmmc_accessor_gc sdmmc_accessor_gc;
|
||||||
@@ -344,7 +343,7 @@ uint64_t sdmmc_wrapper_controller_close(int mmc_id)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mmc_id == FS_SDMMC_EMMC)
|
if (mmc_id == FS_SDMMC_EMMC)
|
||||||
{
|
{
|
||||||
// Close file handles and unmount
|
// Close file handles and unmount
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ extern char __argdata__;
|
|||||||
// TODO
|
// TODO
|
||||||
static char nintendo_path[0x80] = "Nintendo";
|
static char nintendo_path[0x80] = "Nintendo";
|
||||||
|
|
||||||
|
// 1.0.0 requires special path handling because it has separate album and contents paths.
|
||||||
|
#define FS_100_ALBUM_PATH 0
|
||||||
|
#define FS_100_CONTENTS_PATH 1
|
||||||
static char nintendo_path_album_100[0x100] = "/Nintendo/Album";
|
static char nintendo_path_album_100[0x100] = "/Nintendo/Album";
|
||||||
static char nintendo_path_contents_100[0x100] = "/Nintendo/Contents";
|
static char nintendo_path_contents_100[0x100] = "/Nintendo/Contents";
|
||||||
|
|
||||||
@@ -275,23 +278,18 @@ void setup_nintendo_paths(void)
|
|||||||
// 1.0.0 needs special handling because it uses two paths.
|
// 1.0.0 needs special handling because it uses two paths.
|
||||||
// Do album path
|
// Do album path
|
||||||
{
|
{
|
||||||
int path_len = snprintf(nintendo_path_album_100, sizeof(nintendo_path_album_100), "/%s/Album", nintendo_path);
|
snprintf(nintendo_path_album_100, sizeof(nintendo_path_album_100), "/%s/Album", nintendo_path);
|
||||||
intptr_t nintendo_album_path_location = (intptr_t)&nintendo_path_album_100;
|
intptr_t nintendo_album_path_location = (intptr_t)&nintendo_path_album_100;
|
||||||
intptr_t album_path_location = nintendo_album_path_location + path_len - 6; // "/Album"
|
uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[FS_100_ALBUM_PATH].adrp_offset);
|
||||||
uintptr_t fs_n_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[0].adrp_offset);
|
write_adrp_add(fs_offsets->nintendo_paths[FS_100_ALBUM_PATH].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[FS_100_ALBUM_PATH].add_rel_offset, nintendo_album_path_location);
|
||||||
uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[1].adrp_offset);
|
|
||||||
write_adrp_add(fs_offsets->nintendo_paths[0].opcode_reg, fs_n_adrp_opcode_location, fs_offsets->nintendo_paths[0].add_rel_offset, nintendo_album_path_location);
|
|
||||||
write_adrp_add(fs_offsets->nintendo_paths[1].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[1].add_rel_offset, album_path_location);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do contents path
|
// Do contents path
|
||||||
{
|
{
|
||||||
int path_len = snprintf(nintendo_path_contents_100, sizeof(nintendo_path_contents_100), "/%s/Contents", nintendo_path);
|
snprintf(nintendo_path_contents_100, sizeof(nintendo_path_contents_100), "/%s/Contents", nintendo_path);
|
||||||
intptr_t nintendo_contents_path_location = (intptr_t)&nintendo_path_contents_100;
|
intptr_t nintendo_contents_path_location = (intptr_t)&nintendo_path_contents_100;
|
||||||
intptr_t contents_path_location = nintendo_contents_path_location + path_len - 9; // "/Contents"
|
uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[FS_100_CONTENTS_PATH].adrp_offset);
|
||||||
uintptr_t fs_n_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[2].adrp_offset);
|
write_adrp_add(fs_offsets->nintendo_paths[FS_100_CONTENTS_PATH].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[FS_100_CONTENTS_PATH].add_rel_offset, nintendo_contents_path_location);
|
||||||
uintptr_t fs_adrp_opcode_location = INJECT_OFFSET(uintptr_t, fs_offsets->nintendo_paths[3].adrp_offset);
|
|
||||||
write_adrp_add(fs_offsets->nintendo_paths[2].opcode_reg, fs_n_adrp_opcode_location, fs_offsets->nintendo_paths[2].add_rel_offset, nintendo_contents_path_location);
|
|
||||||
write_adrp_add(fs_offsets->nintendo_paths[3].opcode_reg, fs_adrp_opcode_location, fs_offsets->nintendo_paths[3].add_rel_offset, contents_path_location);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,18 @@ extern "C" {
|
|||||||
* @return Result code.
|
* @return Result code.
|
||||||
* @note Syscall number 0x55.
|
* @note Syscall number 0x55.
|
||||||
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
||||||
|
* @warning Only exists on [10.0.0+]. For older versions use \ref svcLegacyQueryIoMapping.
|
||||||
*/
|
*/
|
||||||
Result svcQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size);
|
Result svcQueryIoMapping(u64* virtaddr, u64* out_size, u64 physaddr, u64 size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a virtual address mapped to a given IO range.
|
||||||
|
* @return Result code.
|
||||||
|
* @note Syscall number 0x55.
|
||||||
|
* @warning This is a privileged syscall. Use \ref envIsSyscallHinted to check if it is available.
|
||||||
|
* @warning Only exists on [1.0.0-9.2.0]. For newer versions use \ref svcQueryIoMapping.
|
||||||
|
*/
|
||||||
|
Result svcLegacyQueryIoMapping(u64* virtaddr, u64 physaddr, u64 size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Attaches a device address space to a device.
|
* @brief Attaches a device address space to a device.
|
||||||
|
|||||||
@@ -17,6 +17,15 @@
|
|||||||
.endm
|
.endm
|
||||||
|
|
||||||
SVC_BEGIN svcQueryIoMapping
|
SVC_BEGIN svcQueryIoMapping
|
||||||
|
STP X0, X1, [SP, #-16]!
|
||||||
|
SVC 0x55
|
||||||
|
LDP X3, X4, [SP], #16
|
||||||
|
STR X1, [X3]
|
||||||
|
STR X2, [X4]
|
||||||
|
RET
|
||||||
|
SVC_END
|
||||||
|
|
||||||
|
SVC_BEGIN svcLegacyQueryIoMapping
|
||||||
STR X0, [SP, #-16]!
|
STR X0, [SP, #-16]!
|
||||||
SVC 0x55
|
SVC 0x55
|
||||||
LDR X2, [SP], #16
|
LDR X2, [SP], #16
|
||||||
|
|||||||
@@ -25,11 +25,12 @@ enum FatalReason
|
|||||||
Fatal_InvalidAccessor,
|
Fatal_InvalidAccessor,
|
||||||
Fatal_ReadNoAccessor,
|
Fatal_ReadNoAccessor,
|
||||||
Fatal_WriteNoAccessor,
|
Fatal_WriteNoAccessor,
|
||||||
Fatal_IoMapping,
|
Fatal_IoMappingLegacy,
|
||||||
Fatal_UnknownVersion,
|
Fatal_UnknownVersion,
|
||||||
Fatal_BadResult,
|
Fatal_BadResult,
|
||||||
Fatal_GetConfig,
|
Fatal_GetConfig,
|
||||||
Fatal_CloseAccessor,
|
Fatal_CloseAccessor,
|
||||||
|
Fatal_IoMapping,
|
||||||
Fatal_Max
|
Fatal_Max
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,15 @@ static inline uintptr_t _GetIoMapping(u64 io_addr, u64 io_size)
|
|||||||
u64 vaddr;
|
u64 vaddr;
|
||||||
u64 aligned_addr = (io_addr & ~0xFFFul);
|
u64 aligned_addr = (io_addr & ~0xFFFul);
|
||||||
u64 aligned_size = io_size + (io_addr - aligned_addr);
|
u64 aligned_size = io_size + (io_addr - aligned_addr);
|
||||||
if (svcQueryIoMapping(&vaddr, aligned_addr, aligned_size) != 0) {
|
if (emuMMC_ctx.fs_ver >= FS_VER_10_0_0) {
|
||||||
fatal_abort(Fatal_IoMapping);
|
u64 out_size;
|
||||||
|
if (svcQueryIoMapping(&vaddr, &out_size, aligned_addr, aligned_size) != 0) {
|
||||||
|
fatal_abort(Fatal_IoMapping);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (svcLegacyQueryIoMapping(&vaddr, aligned_addr, aligned_size) != 0) {
|
||||||
|
fatal_abort(Fatal_IoMappingLegacy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (uintptr_t)(vaddr + (io_addr - aligned_addr));
|
return (uintptr_t)(vaddr + (io_addr - aligned_addr));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define _UTIL_H_
|
#define _UTIL_H_
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "../emuMMC/emummc_ctx.h"
|
||||||
|
|
||||||
intptr_t QueryIoMapping(u64 addr, u64 size);
|
intptr_t QueryIoMapping(u64 addr, u64 size);
|
||||||
#define byte_swap_32(num) ((num >> 24) & 0xff) | ((num << 8) & 0xff0000) | \
|
#define byte_swap_32(num) ((num >> 24) & 0xff) | ((num << 8) & 0xff0000) | \
|
||||||
@@ -37,4 +38,6 @@ void usleep(u64 ticks);
|
|||||||
void msleep(u64 milliseconds);
|
void msleep(u64 milliseconds);
|
||||||
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops);
|
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops);
|
||||||
|
|
||||||
|
extern volatile emuMMC_ctx_t emuMMC_ctx;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -156,6 +156,8 @@ $(OUTPUT).bin : $(OUTPUT).elf
|
|||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
my_libc.o: CFLAGS += -fno-builtin
|
||||||
|
|
||||||
%.elf:
|
%.elf:
|
||||||
@echo linking $(notdir $@)
|
@echo linking $(notdir $@)
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -33,7 +33,7 @@ static inline uint32_t get_special_clk_reg(CarDevice dev) {
|
|||||||
case CARDEVICE_BPMP: return 0;
|
case CARDEVICE_BPMP: return 0;
|
||||||
default: reboot();
|
default: reboot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t get_special_clk_val(CarDevice dev) {
|
static inline uint32_t get_special_clk_val(CarDevice dev) {
|
||||||
switch (dev) {
|
switch (dev) {
|
||||||
@@ -48,19 +48,19 @@ static inline uint32_t get_special_clk_val(CarDevice dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t g_clk_reg_offsets[NUM_CAR_BANKS] = {0x010, 0x014, 0x018, 0x360, 0x364, 0x280, 0x298};
|
static uint32_t g_clk_reg_offsets[NUM_CAR_BANKS] = {0x010, 0x014, 0x018, 0x360, 0x364, 0x280, 0x298};
|
||||||
static uint32_t g_rst_reg_offsets[NUM_CAR_BANKS] = {0x004, 0x008, 0x00C, 0x358, 0x35C, 0x28C, 0x2A4};
|
static uint32_t g_rst_reg_offsets[NUM_CAR_BANKS] = {0x004, 0x008, 0x00C, 0x358, 0x35C, 0x28C, 0x2A4};
|
||||||
|
|
||||||
static uint32_t g_clk_clr_reg_offsets[NUM_CAR_BANKS] = {0x324, 0x32C, 0x334, 0x444, 0x44C, 0x228, 0x2A0};
|
static uint32_t g_clk_clr_reg_offsets[NUM_CAR_BANKS] = {0x324, 0x32C, 0x334, 0x444, 0x44C, 0x228, 0x2A0};
|
||||||
|
|
||||||
void car_configure_oscillators(void) {
|
void car_configure_oscillators(void) {
|
||||||
/* Enable the crystal oscillator, setting drive strength to the saved value in PMC. */
|
/* Enable the crystal oscillator, setting drive strength to the saved value in PMC. */
|
||||||
CLK_RST_CONTROLLER_OSC_CTRL_0 = (CLK_RST_CONTROLLER_OSC_CTRL_0 & 0xFFFFFC0E) | 1 | (((APBDEV_PMC_OSC_EDPD_OVER_0 >> 1) & 0x3F) << 4);
|
CLK_RST_CONTROLLER_OSC_CTRL_0 = (CLK_RST_CONTROLLER_OSC_CTRL_0 & 0xFFFFFC0E) | 1 | (((APBDEV_PMC_OSC_EDPD_OVER_0 >> 1) & 0x3F) << 4);
|
||||||
|
|
||||||
/* Set CLK_M_DIVISOR to 1 (causes actual division by 2.) */
|
/* Set CLK_M_DIVISOR to 1 (causes actual division by 2.) */
|
||||||
CLK_RST_CONTROLLER_SPARE_REG0_0 = (1 << 2);
|
CLK_RST_CONTROLLER_SPARE_REG0_0 = (1 << 2);
|
||||||
/* Reading the register after writing it is required to ensure value takes. */
|
/* Reading the register after writing it is required to ensure value takes. */
|
||||||
(void)(CLK_RST_CONTROLLER_SPARE_REG0_0);
|
(void)(CLK_RST_CONTROLLER_SPARE_REG0_0);
|
||||||
|
|
||||||
/* Set TIMERUS_USEC_CFG to cycle at 0x60 / 0x5 = 19.2 MHz. */
|
/* Set TIMERUS_USEC_CFG to cycle at 0x60 / 0x5 = 19.2 MHz. */
|
||||||
/* Value is (dividend << 8) | (divisor). */
|
/* Value is (dividend << 8) | (divisor). */
|
||||||
TIMERUS_USEC_CFG_0 = 0x45F;
|
TIMERUS_USEC_CFG_0 = 0x45F;
|
||||||
@@ -68,30 +68,30 @@ void car_configure_oscillators(void) {
|
|||||||
|
|
||||||
void car_mbist_workaround(void) {
|
void car_mbist_workaround(void) {
|
||||||
/* This code works around MBIST bug. */
|
/* This code works around MBIST bug. */
|
||||||
|
|
||||||
/* Clear LVL2_CLK_GATE_OVR* registers. */
|
/* Clear LVL2_CLK_GATE_OVR* registers. */
|
||||||
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRA_0 = 0;
|
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRA_0 = 0;
|
||||||
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRB_0 = 0;
|
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRB_0 = 0;
|
||||||
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRC_0 = 0;
|
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRC_0 = 0;
|
||||||
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRD_0 = 0;
|
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRD_0 = 0;
|
||||||
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRE_0 = 0;
|
CLK_RST_CONTROLLER_LVL2_CLK_GATE_OVRE_0 = 0;
|
||||||
|
|
||||||
/* Clear bit patterns in CAR. */
|
/* Clear bit patterns in CAR. */
|
||||||
/* L: Reset all but RTC, TMR, GPIO, BPMP Cache (CACHE2). */
|
/* L: Reset all but RTC, TMR, GPIO, BPMP Cache (CACHE2). */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[0]) = MAKE_CAR_REG(g_clk_reg_offsets[0]) & 0x7FFFFECF;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[0]) = MAKE_CAR_REG(g_clk_reg_offsets[0]) & 0x7FFFFECF;
|
||||||
/* H: Reset all but MC, PMC, FUSE, EMC. */
|
/* H: Reset all but MC, PMC, FUSE, EMC. */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[1]) = MAKE_CAR_REG(g_clk_reg_offsets[1]) & 0xFDFFFF3E;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[1]) = MAKE_CAR_REG(g_clk_reg_offsets[1]) & 0xFDFFFF3E;
|
||||||
/* U: Reset all but CSITE, IRAM[A-D], BPMP Cache RAM (CRAM2). */
|
/* U: Reset all but CSITE, IRAM[A-D], BPMP Cache RAM (CRAM2). */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[2]) = MAKE_CAR_REG(g_clk_reg_offsets[2]) & 0xFE0FFDFF;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[2]) = MAKE_CAR_REG(g_clk_reg_offsets[2]) & 0xFE0FFDFF;
|
||||||
/* V: Reset all but MSELECT, S/PDIF audio doubler, TZRAM, SE. */
|
/* V: Reset all but MSELECT, S/PDIF audio doubler, TZRAM, SE. */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[3]) = MAKE_CAR_REG(g_clk_reg_offsets[3]) & 0x3FBFFFF7;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[3]) = MAKE_CAR_REG(g_clk_reg_offsets[3]) & 0x3FBFFFF7;
|
||||||
/* W: Reset all but PCIERX[0-5], ENTROPY. */
|
/* W: Reset all but PCIERX[0-5], ENTROPY. */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[4]) = MAKE_CAR_REG(g_clk_reg_offsets[4]) & 0xFFDFFF03;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[4]) = MAKE_CAR_REG(g_clk_reg_offsets[4]) & 0xFFDFFF03;
|
||||||
/* X: Reset all but ETC, MCLK, MCLK2, I2C6, EMC_DLL, GPU, DBGAPB, PLLG_REF, . */
|
/* X: Reset all but ETC, MCLK, MCLK2, I2C6, EMC_DLL, GPU, DBGAPB, PLLG_REF, . */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[5]) = MAKE_CAR_REG(g_clk_reg_offsets[5]) & 0xDCFFB87F;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[5]) = MAKE_CAR_REG(g_clk_reg_offsets[5]) & 0xDCFFB87F;
|
||||||
/* Y: Reset all but MC_CDPA, MC_CCPA. */
|
/* Y: Reset all but MC_CDPA, MC_CCPA. */
|
||||||
MAKE_CAR_REG(g_clk_clr_reg_offsets[6]) = MAKE_CAR_REG(g_clk_reg_offsets[6]) & 0xFFFFFCFF;
|
MAKE_CAR_REG(g_clk_clr_reg_offsets[6]) = MAKE_CAR_REG(g_clk_reg_offsets[6]) & 0xFFFFFCFF;
|
||||||
|
|
||||||
/* Enable clock to MC1, if CH1 is enabled in EMC. */
|
/* Enable clock to MC1, if CH1 is enabled in EMC. */
|
||||||
if (EMC_FBIO_CFG7_0 & 4) { /* CH1_ENABLE */
|
if (EMC_FBIO_CFG7_0 & 4) { /* CH1_ENABLE */
|
||||||
CLK_RST_CONTROLLER_CLK_ENB_W_SET_0 |= 0x40000000; /* SET_CLK_ENB_MC1 */
|
CLK_RST_CONTROLLER_CLK_ENB_W_SET_0 |= 0x40000000; /* SET_CLK_ENB_MC1 */
|
||||||
@@ -132,3 +132,7 @@ void clkrst_reboot(CarDevice dev) {
|
|||||||
clkrst_disable(dev);
|
clkrst_disable(dev);
|
||||||
clkrst_enable(dev);
|
clkrst_enable(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clkrst_enable_fuse_regs(bool enable) {
|
||||||
|
CLK_RST_CONTROLLER_MISC_CLK_ENB_0 = ((CLK_RST_CONTROLLER_MISC_CLK_ENB_0 & 0xEFFFFFFF) | ((enable & 1) << 28));
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -103,7 +103,8 @@ void rst_disable(CarDevice dev);
|
|||||||
|
|
||||||
void clkrst_enable(CarDevice dev);
|
void clkrst_enable(CarDevice dev);
|
||||||
void clkrst_disable(CarDevice dev);
|
void clkrst_disable(CarDevice dev);
|
||||||
|
|
||||||
void clkrst_reboot(CarDevice dev);
|
void clkrst_reboot(CarDevice dev);
|
||||||
|
|
||||||
|
void clkrst_enable_fuse_regs(bool enable);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 naehrwert
|
* Copyright (c) 2018 naehrwert
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -29,7 +29,7 @@ bool fuse_check_downgrade_status(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fuse_disable_programming(void) {
|
void fuse_disable_programming(void) {
|
||||||
FUSE_REGS->FUSE_DIS_PGM = 1;
|
FUSE_REGS->FUSE_DISABLEREGPROGRAM = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fuse_bypass_data_t g_fuse_bypass_entries[NUM_FUSE_BYPASS_ENTRIES] = {
|
static fuse_bypass_data_t g_fuse_bypass_entries[NUM_FUSE_BYPASS_ENTRIES] = {
|
||||||
@@ -37,13 +37,14 @@ static fuse_bypass_data_t g_fuse_bypass_entries[NUM_FUSE_BYPASS_ENTRIES] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void fuse_configure_fuse_bypass(void) {
|
void fuse_configure_fuse_bypass(void) {
|
||||||
/* Enable fuses in CAR? This seems to affect fuse data visibility. */
|
/* Make all fuse registers visible. */
|
||||||
CLK_RST_CONTROLLER_MISC_CLK_ENB_0 |= 0x10000000;
|
clkrst_enable_fuse_regs(true);
|
||||||
|
|
||||||
/* Configure bypass/override, only if programming is allowed. */
|
/* Configure bypass/override, only if programming is allowed. */
|
||||||
if (!(FUSE_REGS->FUSE_DIS_PGM & 1)) {
|
if (!(FUSE_REGS->FUSE_DISABLEREGPROGRAM & 1)) {
|
||||||
/* Enable write access. */
|
/* Enable write access and flush status. */
|
||||||
FUSE_REGS->FUSE_WRITE_ACCESS = (FUSE_REGS->FUSE_WRITE_ACCESS & ~0x1) | 0x10000;
|
FUSE_REGS->FUSE_WRITE_ACCESS_SW = (FUSE_REGS->FUSE_WRITE_ACCESS_SW & ~0x1) | 0x10000;
|
||||||
|
|
||||||
/* Enable fuse bypass config. */
|
/* Enable fuse bypass config. */
|
||||||
FUSE_REGS->FUSE_FUSEBYPASS = 1;
|
FUSE_REGS->FUSE_FUSEBYPASS = 1;
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ void fuse_configure_fuse_bypass(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable fuse write access. */
|
/* Disable fuse write access. */
|
||||||
FUSE_REGS->FUSE_WRITE_ACCESS |= 1;
|
FUSE_REGS->FUSE_WRITE_ACCESS_SW |= 1;
|
||||||
|
|
||||||
/* Enable fuse bypass config. */
|
/* Enable fuse bypass config. */
|
||||||
/* I think this is a bug, and Nintendo meant to write 0 here? */
|
/* I think this is a bug, and Nintendo meant to write 0 here? */
|
||||||
@@ -63,7 +64,7 @@ void fuse_configure_fuse_bypass(void) {
|
|||||||
/* I have no idea why this happens. What? */
|
/* I have no idea why this happens. What? */
|
||||||
/* This is probably also either a bug or does nothing. */
|
/* This is probably also either a bug or does nothing. */
|
||||||
/* Is this bit even clearable? */
|
/* Is this bit even clearable? */
|
||||||
FUSE_REGS->FUSE_DIS_PGM &= 0xFFFFFFFE;
|
FUSE_REGS->FUSE_DISABLEREGPROGRAM &= 0xFFFFFFFE;
|
||||||
|
|
||||||
/* Restore saved private key disable bit. */
|
/* Restore saved private key disable bit. */
|
||||||
FUSE_REGS->FUSE_PRIVATEKEYDISABLE |= (APBDEV_PMC_SECURE_SCRATCH21_0 & 0x10);
|
FUSE_REGS->FUSE_PRIVATEKEYDISABLE |= (APBDEV_PMC_SECURE_SCRATCH21_0 & 0x10);
|
||||||
@@ -71,5 +72,4 @@ void fuse_configure_fuse_bypass(void) {
|
|||||||
/* Lock private key disable secure scratch. */
|
/* Lock private key disable secure scratch. */
|
||||||
APBDEV_PMC_SEC_DISABLE2_0 |= 0x4000000;
|
APBDEV_PMC_SEC_DISABLE2_0 |= 0x4000000;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -23,154 +23,167 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t FUSE_CTRL;
|
uint32_t FUSE_FUSECTRL;
|
||||||
uint32_t FUSE_REG_ADDR;
|
uint32_t FUSE_FUSEADDR;
|
||||||
uint32_t FUSE_REG_READ;
|
uint32_t FUSE_FUSERDATA;
|
||||||
uint32_t FUSE_REG_WRITE;
|
uint32_t FUSE_FUSEWDATA;
|
||||||
uint32_t FUSE_TIME_RD1;
|
uint32_t FUSE_FUSETIME_RD1;
|
||||||
uint32_t FUSE_TIME_RD2;
|
uint32_t FUSE_FUSETIME_RD2;
|
||||||
uint32_t FUSE_TIME_PGM1;
|
uint32_t FUSE_FUSETIME_PGM1;
|
||||||
uint32_t FUSE_TIME_PGM2;
|
uint32_t FUSE_FUSETIME_PGM2;
|
||||||
uint32_t FUSE_PRIV2INTFC;
|
uint32_t FUSE_PRIV2INTFC_START;
|
||||||
uint32_t FUSE_FUSEBYPASS;
|
uint32_t FUSE_FUSEBYPASS;
|
||||||
uint32_t FUSE_PRIVATEKEYDISABLE;
|
uint32_t FUSE_PRIVATEKEYDISABLE;
|
||||||
uint32_t FUSE_DIS_PGM;
|
uint32_t FUSE_DISABLEREGPROGRAM;
|
||||||
uint32_t FUSE_WRITE_ACCESS;
|
uint32_t FUSE_WRITE_ACCESS_SW;
|
||||||
uint32_t FUSE_PWR_GOOD_SW;
|
uint32_t FUSE_PWR_GOOD_SW;
|
||||||
uint32_t _0x38[0x32];
|
uint32_t _0x38;
|
||||||
} fuse_registers_t;
|
uint32_t FUSE_PRIV2RESHIFT;
|
||||||
|
uint32_t _0x40[0x3];
|
||||||
|
uint32_t FUSE_FUSETIME_RD3;
|
||||||
|
uint32_t _0x50[0xC];
|
||||||
|
uint32_t FUSE_PRIVATE_KEY0_NONZERO;
|
||||||
|
uint32_t FUSE_PRIVATE_KEY1_NONZERO;
|
||||||
|
uint32_t FUSE_PRIVATE_KEY2_NONZERO;
|
||||||
|
uint32_t FUSE_PRIVATE_KEY3_NONZERO;
|
||||||
|
uint32_t FUSE_PRIVATE_KEY4_NONZERO;
|
||||||
|
uint32_t _0x90[0x1C];
|
||||||
|
} tegra_fuse_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t FUSE_PRODUCTION_MODE;
|
uint32_t FUSE_PRODUCTION_MODE;
|
||||||
uint32_t _0x4;
|
uint32_t FUSE_JTAG_SECUREID_VALID;
|
||||||
uint32_t _0x8;
|
uint32_t FUSE_ODM_LOCK;
|
||||||
uint32_t _0xC;
|
uint32_t FUSE_OPT_OPENGL_EN;
|
||||||
uint32_t FUSE_SKU_INFO;
|
uint32_t FUSE_SKU_INFO;
|
||||||
uint32_t FUSE_CPU_SPEEDO_0;
|
uint32_t FUSE_CPU_SPEEDO_0_CALIB;
|
||||||
uint32_t FUSE_CPU_IDDQ;
|
uint32_t FUSE_CPU_IDDQ_CALIB;
|
||||||
uint32_t _0x1C;
|
uint32_t FUSE_DAC_CRT_CALIB;
|
||||||
uint32_t _0x20;
|
uint32_t FUSE_DAC_HDTV_CALIB;
|
||||||
uint32_t _0x24;
|
uint32_t FUSE_DAC_SDTV_CALIB;
|
||||||
uint32_t FUSE_FT_REV;
|
uint32_t FUSE_OPT_FT_REV;
|
||||||
uint32_t FUSE_CPU_SPEEDO_1;
|
uint32_t FUSE_CPU_SPEEDO_1_CALIB;
|
||||||
uint32_t FUSE_CPU_SPEEDO_2;
|
uint32_t FUSE_CPU_SPEEDO_2_CALIB;
|
||||||
uint32_t FUSE_SOC_SPEEDO_0;
|
uint32_t FUSE_SOC_SPEEDO_0_CALIB;
|
||||||
uint32_t FUSE_SOC_SPEEDO_1;
|
uint32_t FUSE_SOC_SPEEDO_1_CALIB;
|
||||||
uint32_t FUSE_SOC_SPEEDO_2;
|
uint32_t FUSE_SOC_SPEEDO_2_CALIB;
|
||||||
uint32_t FUSE_SOC_IDDQ;
|
uint32_t FUSE_SOC_IDDQ_CALIB;
|
||||||
uint32_t _0x44;
|
uint32_t FUSE_RESERVED_PRODUCTION_WP;
|
||||||
uint32_t FUSE_FA;
|
uint32_t FUSE_FA;
|
||||||
uint32_t _0x4C;
|
uint32_t FUSE_RESERVED_PRODUCTION;
|
||||||
uint32_t _0x50;
|
uint32_t FUSE_HDMI_LANE0_CALIB;
|
||||||
uint32_t _0x54;
|
uint32_t FUSE_HDMI_LANE1_CALIB;
|
||||||
uint32_t _0x58;
|
uint32_t FUSE_HDMI_LANE2_CALIB;
|
||||||
uint32_t _0x5C;
|
uint32_t FUSE_HDMI_LANE3_CALIB;
|
||||||
uint32_t _0x60;
|
uint32_t FUSE_ENCRYPTION_RATE;
|
||||||
uint32_t FUSE_PUBLIC_KEY[0x8];
|
uint32_t FUSE_PUBLIC_KEY[0x8];
|
||||||
uint32_t FUSE_TSENSOR_1;
|
uint32_t FUSE_TSENSOR1_CALIB;
|
||||||
uint32_t FUSE_TSENSOR_2;
|
uint32_t FUSE_TSENSOR2_CALIB;
|
||||||
uint32_t _0x8C;
|
uint32_t FUSE_VSENSOR_CALIB;
|
||||||
uint32_t FUSE_CP_REV;
|
uint32_t FUSE_OPT_CP_REV;
|
||||||
uint32_t _0x94;
|
uint32_t FUSE_OPT_PFG;
|
||||||
uint32_t FUSE_TSENSOR_0;
|
uint32_t FUSE_TSENSOR0_CALIB;
|
||||||
uint32_t FUSE_FIRST_BOOTROM_PATCH_SIZE_REG;
|
uint32_t FUSE_FIRST_BOOTROM_PATCH_SIZE;
|
||||||
uint32_t FUSE_SECURITY_MODE;
|
uint32_t FUSE_SECURITY_MODE;
|
||||||
uint32_t FUSE_PRIVATE_KEY[0x4];
|
uint32_t FUSE_PRIVATE_KEY[0x5];
|
||||||
uint32_t FUSE_DEVICE_KEY;
|
uint32_t FUSE_ARM_JTAG_DIS;
|
||||||
uint32_t _0xB8;
|
uint32_t FUSE_BOOT_DEVICE_INFO;
|
||||||
uint32_t _0xBC;
|
|
||||||
uint32_t FUSE_RESERVED_SW;
|
uint32_t FUSE_RESERVED_SW;
|
||||||
uint32_t FUSE_VP8_ENABLE;
|
uint32_t FUSE_OPT_VP9_DISABLE;
|
||||||
uint32_t FUSE_RESERVED_ODM[0x8];
|
uint32_t FUSE_RESERVED_ODM[0x8];
|
||||||
uint32_t _0xE8;
|
uint32_t FUSE_OBS_DIS;
|
||||||
uint32_t _0xEC;
|
uint32_t FUSE_NOR_INFO;
|
||||||
uint32_t FUSE_SKU_USB_CALIB;
|
uint32_t FUSE_USB_CALIB;
|
||||||
uint32_t FUSE_SKU_DIRECT_CONFIG;
|
uint32_t FUSE_SKU_DIRECT_CONFIG;
|
||||||
uint32_t _0xF8;
|
uint32_t FUSE_KFUSE_PRIVKEY_CTRL;
|
||||||
uint32_t _0xFC;
|
uint32_t FUSE_PACKAGE_INFO;
|
||||||
uint32_t FUSE_VENDOR_CODE;
|
uint32_t FUSE_OPT_VENDOR_CODE;
|
||||||
uint32_t FUSE_FAB_CODE;
|
uint32_t FUSE_OPT_FAB_CODE;
|
||||||
uint32_t FUSE_LOT_CODE_0;
|
uint32_t FUSE_OPT_LOT_CODE_0;
|
||||||
uint32_t FUSE_LOT_CODE_1;
|
uint32_t FUSE_OPT_LOT_CODE_1;
|
||||||
uint32_t FUSE_WAFER_ID;
|
uint32_t FUSE_OPT_WAFER_ID;
|
||||||
uint32_t FUSE_X_COORDINATE;
|
uint32_t FUSE_OPT_X_COORDINATE;
|
||||||
uint32_t FUSE_Y_COORDINATE;
|
uint32_t FUSE_OPT_Y_COORDINATE;
|
||||||
uint32_t _0x11C;
|
uint32_t FUSE_OPT_SEC_DEBUG_EN;
|
||||||
uint32_t _0x120;
|
uint32_t FUSE_OPT_OPS_RESERVED;
|
||||||
uint32_t FUSE_SATA_CALIB;
|
uint32_t FUSE_SATA_CALIB;
|
||||||
uint32_t FUSE_GPU_IDDQ;
|
uint32_t FUSE_GPU_IDDQ_CALIB;
|
||||||
uint32_t FUSE_TSENSOR_3;
|
uint32_t FUSE_TSENSOR3_CALIB;
|
||||||
uint32_t _0x130;
|
uint32_t FUSE_SKU_BOND_OUT_L;
|
||||||
uint32_t _0x134;
|
uint32_t FUSE_SKU_BOND_OUT_H;
|
||||||
uint32_t _0x138;
|
uint32_t FUSE_SKU_BOND_OUT_U;
|
||||||
uint32_t _0x13C;
|
uint32_t FUSE_SKU_BOND_OUT_V;
|
||||||
uint32_t _0x140;
|
uint32_t FUSE_SKU_BOND_OUT_W;
|
||||||
uint32_t _0x144;
|
uint32_t FUSE_OPT_SAMPLE_TYPE;
|
||||||
uint32_t FUSE_OPT_SUBREVISION;
|
uint32_t FUSE_OPT_SUBREVISION;
|
||||||
uint32_t _0x14C;
|
uint32_t FUSE_OPT_SW_RESERVED_0;
|
||||||
uint32_t _0x150;
|
uint32_t FUSE_OPT_SW_RESERVED_1;
|
||||||
uint32_t FUSE_TSENSOR_4;
|
uint32_t FUSE_TSENSOR4_CALIB;
|
||||||
uint32_t FUSE_TSENSOR_5;
|
uint32_t FUSE_TSENSOR5_CALIB;
|
||||||
uint32_t FUSE_TSENSOR_6;
|
uint32_t FUSE_TSENSOR6_CALIB;
|
||||||
uint32_t FUSE_TSENSOR_7;
|
uint32_t FUSE_TSENSOR7_CALIB;
|
||||||
uint32_t FUSE_OPT_PRIV_SEC_DIS;
|
uint32_t FUSE_OPT_PRIV_SEC_EN;
|
||||||
uint32_t FUSE_PKC_DISABLE;
|
uint32_t FUSE_PKC_DISABLE;
|
||||||
uint32_t _0x16C;
|
uint32_t _0x16C;
|
||||||
uint32_t _0x170;
|
uint32_t _0x170;
|
||||||
uint32_t _0x174;
|
uint32_t _0x174;
|
||||||
uint32_t _0x178;
|
uint32_t _0x178;
|
||||||
uint32_t _0x17C;
|
uint32_t FUSE_FUSE2TSEC_DEBUG_DISABLE;
|
||||||
uint32_t FUSE_TSENSOR_COMMON;
|
uint32_t FUSE_TSENSOR_COMMON;
|
||||||
uint32_t _0x184;
|
uint32_t FUSE_OPT_CP_BIN;
|
||||||
uint32_t _0x188;
|
uint32_t FUSE_OPT_GPU_DISABLE;
|
||||||
uint32_t _0x18C;
|
uint32_t FUSE_OPT_FT_BIN;
|
||||||
uint32_t _0x190;
|
uint32_t FUSE_OPT_DONE_MAP;
|
||||||
uint32_t _0x194;
|
uint32_t _0x194;
|
||||||
uint32_t _0x198;
|
uint32_t FUSE_APB2JTAG_DISABLE;
|
||||||
uint32_t FUSE_DEBUG_AUTH_OVERRIDE;
|
uint32_t FUSE_ODM_INFO;
|
||||||
uint32_t _0x1A0;
|
uint32_t _0x1A0;
|
||||||
uint32_t _0x1A4;
|
uint32_t _0x1A4;
|
||||||
uint32_t _0x1A8;
|
uint32_t FUSE_ARM_CRYPT_DE_FEATURE;
|
||||||
uint32_t _0x1AC;
|
uint32_t _0x1AC;
|
||||||
uint32_t _0x1B0;
|
uint32_t _0x1B0;
|
||||||
uint32_t _0x1B4;
|
uint32_t _0x1B4;
|
||||||
uint32_t _0x1B8;
|
uint32_t _0x1B8;
|
||||||
uint32_t _0x1BC;
|
uint32_t _0x1BC;
|
||||||
uint32_t _0x1D0;
|
uint32_t FUSE_WOA_SKU_FLAG;
|
||||||
uint32_t FUSE_TSENSOR_8;
|
uint32_t FUSE_ECO_RESERVE_1;
|
||||||
|
uint32_t FUSE_GCPLEX_CONFIG_FUSE;
|
||||||
|
uint32_t FUSE_PRODUCTION_MONTH;
|
||||||
|
uint32_t FUSE_RAM_REPAIR_INDICATOR;
|
||||||
|
uint32_t FUSE_TSENSOR9_CALIB;
|
||||||
uint32_t _0x1D8;
|
uint32_t _0x1D8;
|
||||||
uint32_t _0x1DC;
|
uint32_t FUSE_VMIN_CALIBRATION;
|
||||||
uint32_t _0x1E0;
|
uint32_t FUSE_AGING_SENSOR_CALIBRATION;
|
||||||
uint32_t _0x1E4;
|
uint32_t FUSE_DEBUG_AUTHENTICATION;
|
||||||
uint32_t _0x1E8;
|
uint32_t FUSE_SECURE_PROVISION_INDEX;
|
||||||
uint32_t _0x1EC;
|
uint32_t FUSE_SECURE_PROVISION_INFO;
|
||||||
uint32_t _0x1F0;
|
uint32_t FUSE_OPT_GPU_DISABLE_CP1;
|
||||||
uint32_t _0x1F4;
|
uint32_t FUSE_SPARE_ENDIS;
|
||||||
uint32_t _0x1F8;
|
uint32_t FUSE_ECO_RESERVE_0;
|
||||||
uint32_t _0x1FC;
|
uint32_t _0x1FC;
|
||||||
uint32_t _0x200;
|
uint32_t _0x200;
|
||||||
uint32_t FUSE_RESERVED_CALIB;
|
uint32_t FUSE_RESERVED_CALIB0;
|
||||||
uint32_t _0x208;
|
uint32_t FUSE_RESERVED_CALIB1;
|
||||||
uint32_t _0x20C;
|
uint32_t FUSE_OPT_GPU_TPC0_DISABLE;
|
||||||
uint32_t _0x210;
|
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP1;
|
||||||
uint32_t _0x214;
|
uint32_t FUSE_OPT_CPU_DISABLE;
|
||||||
uint32_t _0x218;
|
uint32_t FUSE_OPT_CPU_DISABLE_CP1;
|
||||||
uint32_t FUSE_TSENSOR_9;
|
uint32_t FUSE_TSENSOR10_CALIB;
|
||||||
uint32_t _0x220;
|
uint32_t FUSE_TSENSOR10_CALIB_AUX;
|
||||||
uint32_t _0x224;
|
uint32_t FUSE_OPT_RAM_SVOP_DP;
|
||||||
uint32_t _0x228;
|
uint32_t FUSE_OPT_RAM_SVOP_PDP;
|
||||||
uint32_t _0x22C;
|
uint32_t FUSE_OPT_RAM_SVOP_REG;
|
||||||
uint32_t _0x230;
|
uint32_t FUSE_OPT_RAM_SVOP_SP;
|
||||||
uint32_t _0x234;
|
uint32_t FUSE_OPT_RAM_SVOP_SMPDP;
|
||||||
uint32_t _0x238;
|
uint32_t FUSE_OPT_GPU_TPC0_DISABLE_CP2;
|
||||||
uint32_t _0x23C;
|
uint32_t FUSE_OPT_GPU_TPC1_DISABLE;
|
||||||
uint32_t _0x240;
|
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP1;
|
||||||
uint32_t _0x244;
|
uint32_t FUSE_OPT_GPU_TPC1_DISABLE_CP2;
|
||||||
uint32_t _0x248;
|
uint32_t FUSE_OPT_CPU_DISABLE_CP2;
|
||||||
uint32_t _0x24C;
|
uint32_t FUSE_OPT_GPU_DISABLE_CP2;
|
||||||
uint32_t FUSE_USB_CALIB_EXT;
|
uint32_t FUSE_USB_CALIB_EXT;
|
||||||
uint32_t _0x254;
|
uint32_t FUSE_RESERVED_FIELD;
|
||||||
uint32_t _0x258;
|
uint32_t FUSE_OPT_ECC_EN;
|
||||||
uint32_t _0x25C;
|
uint32_t _0x25C;
|
||||||
uint32_t _0x260;
|
uint32_t _0x260;
|
||||||
uint32_t _0x264;
|
uint32_t _0x264;
|
||||||
@@ -179,12 +192,12 @@ typedef struct {
|
|||||||
uint32_t _0x270;
|
uint32_t _0x270;
|
||||||
uint32_t _0x274;
|
uint32_t _0x274;
|
||||||
uint32_t _0x278;
|
uint32_t _0x278;
|
||||||
uint32_t _0x27C;
|
uint32_t FUSE_SPARE_REALIGNMENT_REG;
|
||||||
uint32_t FUSE_SPARE_BIT[0x20];
|
uint32_t FUSE_SPARE_BIT[0x20];
|
||||||
} fuse_chip_registers_t;
|
} tegra_fuse_chip_t;
|
||||||
|
|
||||||
#define FUSE_REGS ((volatile fuse_registers_t *)(0x7000F800))
|
#define FUSE_REGS ((volatile tegra_fuse_t *)(0x7000F800))
|
||||||
#define FUSE_CHIP_REGS ((volatile fuse_chip_registers_t *)(0x7000F900))
|
#define FUSE_CHIP_REGS ((volatile tegra_fuse_chip_t *)(0x7000F900))
|
||||||
|
|
||||||
#define MAKE_FUSE_REG(n) MAKE_REG32(0x7000F800 + n)
|
#define MAKE_FUSE_REG(n) MAKE_REG32(0x7000F800 + n)
|
||||||
|
|
||||||
@@ -194,9 +207,7 @@ typedef struct {
|
|||||||
} fuse_bypass_data_t;
|
} fuse_bypass_data_t;
|
||||||
|
|
||||||
bool fuse_check_downgrade_status(void);
|
bool fuse_check_downgrade_status(void);
|
||||||
|
|
||||||
void fuse_configure_fuse_bypass(void);
|
void fuse_configure_fuse_bypass(void);
|
||||||
|
|
||||||
void fuse_disable_programming(void);
|
void fuse_disable_programming(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "lp0.h"
|
#include "lp0.h"
|
||||||
#include "mc.h"
|
#include "mc.h"
|
||||||
@@ -41,56 +41,56 @@ void lp0_entry_main(warmboot_metadata_t *meta) {
|
|||||||
if (meta->magic != WARMBOOT_MAGIC || target_firmware > ATMOSPHERE_TARGET_FIRMWARE_MAX) {
|
if (meta->magic != WARMBOOT_MAGIC || target_firmware > ATMOSPHERE_TARGET_FIRMWARE_MAX) {
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [4.0.0+] First thing warmboot does is disable BPMP access to memory. */
|
/* [4.0.0+] First thing warmboot does is disable BPMP access to memory. */
|
||||||
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_400) {
|
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_4_0_0) {
|
||||||
disable_bpmp_access_to_dram();
|
disable_bpmp_access_to_dram();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure debugging depending on FUSE_PRODUCTION_MODE */
|
/* Configure debugging depending on FUSE_PRODUCTION_MODE */
|
||||||
misc_configure_device_dbg_settings();
|
misc_configure_device_dbg_settings();
|
||||||
|
|
||||||
/* Check for downgrade. */
|
/* Check for downgrade. */
|
||||||
/* NOTE: We implemented this as "return false" */
|
/* NOTE: We implemented this as "return false" */
|
||||||
if (fuse_check_downgrade_status()) {
|
if (fuse_check_downgrade_status()) {
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_300) {
|
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_3_0_0) {
|
||||||
/* Nintendo's firmware checks APBDEV_PMC_SECURE_SCRATCH32_0 against a per-warmboot binary value here. */
|
/* Nintendo's firmware checks APBDEV_PMC_SECURE_SCRATCH32_0 against a per-warmboot binary value here. */
|
||||||
/* We won't bother with that. */
|
/* We won't bother with that. */
|
||||||
if (false /* APBDEV_PMC_SECURE_SCRATCH32_0 == WARMBOOT_MAGIC_NUMBER */) {
|
if (false /* APBDEV_PMC_SECURE_SCRATCH32_0 == WARMBOOT_MAGIC_NUMBER */) {
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Check that we're running at the correct physical address. */
|
/* TODO: Check that we're running at the correct physical address. */
|
||||||
|
|
||||||
/* Setup fuses, disable bypass. */
|
/* Setup fuses, disable bypass. */
|
||||||
fuse_configure_fuse_bypass();
|
fuse_configure_fuse_bypass();
|
||||||
|
|
||||||
/* Configure oscillators/timing in CAR. */
|
/* Configure oscillators/timing in CAR. */
|
||||||
car_configure_oscillators();
|
car_configure_oscillators();
|
||||||
|
|
||||||
/* Restore RAM configuration. */
|
/* Restore RAM configuration. */
|
||||||
misc_restore_ram_svop();
|
misc_restore_ram_svop();
|
||||||
emc_configure_pmacro_training();
|
emc_configure_pmacro_training();
|
||||||
|
|
||||||
/* Setup clock output for all devices, working around mbist bug. */
|
/* Setup clock output for all devices, working around mbist bug. */
|
||||||
car_mbist_workaround();
|
car_mbist_workaround();
|
||||||
|
|
||||||
/* Initialize the CPU cluster. */
|
/* Initialize the CPU cluster. */
|
||||||
cluster_initialize_cpu();
|
cluster_initialize_cpu();
|
||||||
|
|
||||||
secmon_restore_to_tzram(target_firmware);
|
secmon_restore_to_tzram(target_firmware);
|
||||||
|
|
||||||
/* Power on the CPU cluster. */
|
/* Power on the CPU cluster. */
|
||||||
cluster_power_on_cpu();
|
cluster_power_on_cpu();
|
||||||
|
|
||||||
/* Nintendo clears most of warmboot.bin out of IRAM here. We're not gonna bother. */
|
/* Nintendo clears most of warmboot.bin out of IRAM here. We're not gonna bother. */
|
||||||
/* memset( ... ); */
|
/* memset( ... ); */
|
||||||
|
|
||||||
const uint32_t halt_val = (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_400) ? 0x40000000 : 0x50000000;
|
const uint32_t halt_val = (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_4_0_0) ? 0x40000000 : 0x50000000;
|
||||||
while (true) {
|
while (true) {
|
||||||
/* Halt the BPMP. */
|
/* Halt the BPMP. */
|
||||||
FLOW_CTLR_HALT_COP_EVENTS_0 = halt_val;
|
FLOW_CTLR_HALT_COP_EVENTS_0 = halt_val;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -23,26 +23,26 @@
|
|||||||
#include "pmc.h"
|
#include "pmc.h"
|
||||||
|
|
||||||
void misc_configure_device_dbg_settings(void) {
|
void misc_configure_device_dbg_settings(void) {
|
||||||
/* Enable RTCK daisychaining by setting TBE bit. */
|
/* Set APB_MISC_PP_CONFIG_CTL_TBE (enables RTCK daisy-chaining). */
|
||||||
APB_MISC_PP_CONFIG_CTL_0 = 0x80;
|
APB_MISC_PP_CONFIG_CTL_0 = 0x80;
|
||||||
|
|
||||||
/* Literally none of this is documented in the TRM, lol. */
|
/* Configure JTAG and debug bits. */
|
||||||
if (FUSE_CHIP_REGS->FUSE_SECURITY_MODE == 1) {
|
if (FUSE_CHIP_REGS->FUSE_SECURITY_MODE == 1) {
|
||||||
uint32_t secure_boot_val = 0b0100; /* Sets NIDEN for aarch64. */
|
uint32_t secure_boot_val = 0b0100; /* Set NIDEN for aarch64. */
|
||||||
uint32_t misc_val = 0x40;
|
uint32_t pp_config_ctl_val = 0x40; /* Set APB_MISC_PP_CONFIG_CTL_JTAG. */
|
||||||
if (APBDEV_PMC_STICKY_BITS_0 & 0x40) {
|
if (APBDEV_PMC_STICKY_BITS_0 & 0x40) {
|
||||||
misc_val = 0x0;
|
pp_config_ctl_val = 0x0;
|
||||||
} else {
|
} else {
|
||||||
secure_boot_val = 0b1101; /* Sets SPNIDEN, NIDEN, DBGEN for aarch64. */
|
secure_boot_val = 0b1101; /* Set SPNIDEN, NIDEN, DBGEN for aarch64. */
|
||||||
}
|
}
|
||||||
SB_PFCFG_0 = (SB_PFCFG_0 & ~0b1111) | secure_boot_val; /* Configures debug bits. */
|
SB_PFCFG_0 = (SB_PFCFG_0 & ~0b1111) | secure_boot_val; /* Configure debug bits. */
|
||||||
APB_MISC_PP_CONFIG_CTL_0 |= misc_val; /* Undocumented, seems to control invasive debugging/JTAG. */
|
APB_MISC_PP_CONFIG_CTL_0 |= pp_config_ctl_val; /* Configure JTAG. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set sticky bits based SECURITY_MODE. */
|
/* Set HDA_LPBK_DIS if FUSE_SECURITY_MODE is set (disables HDA codec loopback). */
|
||||||
APBDEV_PMC_STICKY_BITS_0 |= FUSE_CHIP_REGS->FUSE_SECURITY_MODE;
|
APBDEV_PMC_STICKY_BITS_0 |= FUSE_CHIP_REGS->FUSE_SECURITY_MODE;
|
||||||
|
|
||||||
/* Set E_INPUT in PINMUX_AUX_GPIO_PA6_0 */
|
/* Set E_INPUT in PINMUX_AUX_GPIO_PA6_0 (needed by the XUSB and SATA controllers). */
|
||||||
PINMUX_AUX_GPIO_PA6_0 |= 0x40;
|
PINMUX_AUX_GPIO_PA6_0 |= 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -26,17 +26,14 @@
|
|||||||
#define MAKE_MISC_REG(n) MAKE_REG32(MISC_BASE + n)
|
#define MAKE_MISC_REG(n) MAKE_REG32(MISC_BASE + n)
|
||||||
|
|
||||||
#define APB_MISC_PP_CONFIG_CTL_0 MAKE_MISC_REG(0x024)
|
#define APB_MISC_PP_CONFIG_CTL_0 MAKE_MISC_REG(0x024)
|
||||||
|
|
||||||
#define APB_MISC_GP_ASDBGREG_0 MAKE_MISC_REG(0x810)
|
#define APB_MISC_GP_ASDBGREG_0 MAKE_MISC_REG(0x810)
|
||||||
|
|
||||||
#define PINMUX_AUX_PWR_I2C_SCL_0 MAKE_MISC_REG(0x30DC)
|
#define PINMUX_AUX_PWR_I2C_SCL_0 MAKE_MISC_REG(0x30DC)
|
||||||
#define PINMUX_AUX_PWR_I2C_SDA_0 MAKE_MISC_REG(0x30E0)
|
#define PINMUX_AUX_PWR_I2C_SDA_0 MAKE_MISC_REG(0x30E0)
|
||||||
#define PINMUX_AUX_DVFS_PWM_0 MAKE_MISC_REG(0x3184)
|
#define PINMUX_AUX_DVFS_PWM_0 MAKE_MISC_REG(0x3184)
|
||||||
|
|
||||||
#define PINMUX_AUX_GPIO_PA6_0 MAKE_MISC_REG(0x3244)
|
#define PINMUX_AUX_GPIO_PA6_0 MAKE_MISC_REG(0x3244)
|
||||||
|
|
||||||
void misc_configure_device_dbg_settings(void);
|
void misc_configure_device_dbg_settings(void);
|
||||||
|
|
||||||
void misc_restore_ram_svop(void);
|
void misc_restore_ram_svop(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -23,47 +23,35 @@
|
|||||||
|
|
||||||
#define MAKE_PMC_REG(ofs) (MAKE_REG32(PMC_BASE + ofs))
|
#define MAKE_PMC_REG(ofs) (MAKE_REG32(PMC_BASE + ofs))
|
||||||
|
|
||||||
#define APBDEV_PMC_CNTRL_0 MAKE_PMC_REG(0x000)
|
#define APBDEV_PMC_CNTRL_0 MAKE_PMC_REG(0x000)
|
||||||
|
#define APBDEV_PMC_DPD_SAMPLE_0 MAKE_PMC_REG(0x020)
|
||||||
#define APBDEV_PMC_DPD_SAMPLE_0 MAKE_PMC_REG(0x020)
|
#define APBDEV_PMC_DPD_ENABLE_0 MAKE_PMC_REG(0x024)
|
||||||
|
#define APBDEV_PMC_CLAMP_STATUS_0 MAKE_PMC_REG(0x02C)
|
||||||
#define APBDEV_PMC_DPD_ENABLE_0 MAKE_PMC_REG(0x024)
|
#define APBDEV_PMC_PWRGATE_TOGGLE_0 MAKE_PMC_REG(0x030)
|
||||||
|
#define APBDEV_PMC_REMOVE_CLAMPING_CMD_0 MAKE_PMC_REG(0x034)
|
||||||
#define APBDEV_PMC_CLAMP_STATUS_0 MAKE_PMC_REG(0x02C)
|
#define APBDEV_PMC_PWRGATE_STATUS_0 MAKE_PMC_REG(0x038)
|
||||||
|
#define APBDEV_PMC_SCRATCH12_0 MAKE_PMC_REG(0x080)
|
||||||
#define APBDEV_PMC_PWRGATE_TOGGLE_0 MAKE_PMC_REG(0x030)
|
#define APBDEV_PMC_SCRATCH13_0 MAKE_PMC_REG(0x084)
|
||||||
#define APBDEV_PMC_REMOVE_CLAMPING_CMD_0 MAKE_PMC_REG(0x034)
|
#define APBDEV_PMC_SCRATCH18_0 MAKE_PMC_REG(0x098)
|
||||||
#define APBDEV_PMC_PWRGATE_STATUS_0 MAKE_PMC_REG(0x038)
|
#define APBDEV_PMC_SCRATCH190_0 MAKE_PMC_REG(0x818)
|
||||||
|
#define APBDEV_PMC_OSC_EDPD_OVER_0 MAKE_PMC_REG(0x1A4)
|
||||||
#define APBDEV_PMC_SCRATCH12_0 MAKE_PMC_REG(0x080)
|
#define APBDEV_PMC_STICKY_BITS_0 MAKE_PMC_REG(0x2C0)
|
||||||
#define APBDEV_PMC_SCRATCH13_0 MAKE_PMC_REG(0x084)
|
#define APBDEV_PMC_SEC_DISABLE2_0 MAKE_PMC_REG(0x2C4)
|
||||||
#define APBDEV_PMC_SCRATCH18_0 MAKE_PMC_REG(0x098)
|
#define APBDEV_PMC_WEAK_BIAS_0 MAKE_PMC_REG(0x2C8)
|
||||||
#define APBDEV_PMC_SCRATCH190_0 MAKE_PMC_REG(0x818)
|
#define APBDEV_PMC_SECURE_SCRATCH21_0 MAKE_PMC_REG(0x334)
|
||||||
|
#define APBDEV_PMC_SECURE_SCRATCH32_0 MAKE_PMC_REG(0x360)
|
||||||
#define APBDEV_PMC_OSC_EDPD_OVER_0 MAKE_PMC_REG(0x1A4)
|
#define APBDEV_PMC_SECURE_SCRATCH34_0 MAKE_PMC_REG(0x368)
|
||||||
|
#define APBDEV_PMC_SECURE_SCRATCH35_0 MAKE_PMC_REG(0x36C)
|
||||||
#define APBDEV_PMC_STICKY_BITS_0 MAKE_PMC_REG(0x2C0)
|
#define APBDEV_PMC_SECURE_SCRATCH112_0 MAKE_PMC_REG(0xB18)
|
||||||
#define APBDEV_PMC_SEC_DISABLE2_0 MAKE_PMC_REG(0x2C4)
|
#define APBDEV_PMC_SECURE_SCRATCH113_0 MAKE_PMC_REG(0xB1C)
|
||||||
#define APBDEV_PMC_WEAK_BIAS_0 MAKE_PMC_REG(0x2C8)
|
#define APBDEV_PMC_SECURE_SCRATCH114_0 MAKE_PMC_REG(0xB20)
|
||||||
|
#define APBDEV_PMC_SECURE_SCRATCH115_0 MAKE_PMC_REG(0xB24)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH21_0 MAKE_PMC_REG(0x334)
|
#define APBDEV_PMC_FUSE_CTRL MAKE_PMC_REG(0x450)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH32_0 MAKE_PMC_REG(0x360)
|
#define APBDEV_PMC_IO_DPD3_REQ_0 MAKE_PMC_REG(0x45C)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH34_0 MAKE_PMC_REG(0x368)
|
#define APBDEV_PMC_IO_DPD3_STATUS_0 MAKE_PMC_REG(0x460)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH35_0 MAKE_PMC_REG(0x36C)
|
#define APBDEV_PMC_IO_DPD4_REQ_0 MAKE_PMC_REG(0x464)
|
||||||
|
#define APBDEV_PMC_IO_DPD4_STATUS_0 MAKE_PMC_REG(0x468)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH112_0 MAKE_PMC_REG(0xB18)
|
#define APBDEV_PMC_SET_SW_CLAMP_0 MAKE_PMC_REG(0x47C)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH113_0 MAKE_PMC_REG(0xB1C)
|
#define APBDEV_PMC_DDR_CNTRL_0 MAKE_PMC_REG(0x4E4)
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH114_0 MAKE_PMC_REG(0xB20)
|
|
||||||
#define APBDEV_PMC_SECURE_SCRATCH115_0 MAKE_PMC_REG(0xB24)
|
|
||||||
|
|
||||||
#define APBDEV_PMC_IO_DPD3_REQ_0 MAKE_PMC_REG(0x45C)
|
|
||||||
#define APBDEV_PMC_IO_DPD3_STATUS_0 MAKE_PMC_REG(0x460)
|
|
||||||
|
|
||||||
#define APBDEV_PMC_IO_DPD4_REQ_0 MAKE_PMC_REG(0x464)
|
|
||||||
#define APBDEV_PMC_IO_DPD4_STATUS_0 MAKE_PMC_REG(0x468)
|
|
||||||
|
|
||||||
#define APBDEV_PMC_SET_SW_CLAMP_0 MAKE_PMC_REG(0x47C)
|
|
||||||
|
|
||||||
#define APBDEV_PMC_DDR_CNTRL_0 MAKE_PMC_REG(0x4E4)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -36,20 +36,20 @@ static void __attribute__((__noinline__)) ll_init(volatile se_ll_t *ll, void *bu
|
|||||||
}
|
}
|
||||||
|
|
||||||
void se_check_error_status_reg(void) {
|
void se_check_error_status_reg(void) {
|
||||||
if (se_get_regs()->ERR_STATUS_REG) {
|
if (se_get_regs()->SE_ERR_STATUS) {
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void se_check_for_error(void) {
|
void se_check_for_error(void) {
|
||||||
volatile tegra_se_t *se = se_get_regs();
|
volatile tegra_se_t *se = se_get_regs();
|
||||||
if (se->INT_STATUS_REG & 0x10000 || se->FLAGS_REG & 3 || se->ERR_STATUS_REG) {
|
if (se->SE_INT_STATUS & 0x10000 || se->SE_STATUS & 3 || se->SE_ERR_STATUS) {
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void se_verify_flags_cleared(void) {
|
void se_verify_flags_cleared(void) {
|
||||||
if (se_get_regs()->FLAGS_REG & 3) {
|
if (se_get_regs()->SE_STATUS & 3) {
|
||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,8 +63,8 @@ void clear_aes_keyslot(unsigned int keyslot) {
|
|||||||
|
|
||||||
/* Zero out the whole keyslot and IV. */
|
/* Zero out the whole keyslot and IV. */
|
||||||
for (unsigned int i = 0; i < 0x10; i++) {
|
for (unsigned int i = 0; i < 0x10; i++) {
|
||||||
se->AES_KEYTABLE_ADDR = (keyslot << 4) | i;
|
se->SE_CRYPTO_KEYTABLE_ADDR = (keyslot << 4) | i;
|
||||||
se->AES_KEYTABLE_DATA = 0;
|
se->SE_CRYPTO_KEYTABLE_DATA = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,13 +78,13 @@ void clear_rsa_keyslot(unsigned int keyslot) {
|
|||||||
/* Zero out the whole keyslot. */
|
/* Zero out the whole keyslot. */
|
||||||
for (unsigned int i = 0; i < 0x40; i++) {
|
for (unsigned int i = 0; i < 0x40; i++) {
|
||||||
/* Select Keyslot Modulus[i] */
|
/* Select Keyslot Modulus[i] */
|
||||||
se->RSA_KEYTABLE_ADDR = (keyslot << 7) | i | 0x40;
|
se->SE_RSA_KEYTABLE_ADDR = (keyslot << 7) | i | 0x40;
|
||||||
se->RSA_KEYTABLE_DATA = 0;
|
se->SE_RSA_KEYTABLE_DATA = 0;
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < 0x40; i++) {
|
for (unsigned int i = 0; i < 0x40; i++) {
|
||||||
/* Select Keyslot Expontent[i] */
|
/* Select Keyslot Expontent[i] */
|
||||||
se->RSA_KEYTABLE_ADDR = (keyslot << 7) | i;
|
se->SE_RSA_KEYTABLE_ADDR = (keyslot << 7) | i;
|
||||||
se->RSA_KEYTABLE_DATA = 0;
|
se->SE_RSA_KEYTABLE_DATA = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +96,8 @@ void clear_aes_keyslot_iv(unsigned int keyslot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < (0x10 >> 2); i++) {
|
for (size_t i = 0; i < (0x10 >> 2); i++) {
|
||||||
se->AES_KEYTABLE_ADDR = (keyslot << 4) | 8 | i;
|
se->SE_CRYPTO_KEYTABLE_ADDR = (keyslot << 4) | 8 | i;
|
||||||
se->AES_KEYTABLE_DATA = 0;
|
se->SE_CRYPTO_KEYTABLE_DATA = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,15 +111,15 @@ void trigger_se_blocking_op(unsigned int op, void *dst, size_t dst_size, const v
|
|||||||
ll_init(&out_ll, dst, dst_size);
|
ll_init(&out_ll, dst, dst_size);
|
||||||
|
|
||||||
/* Set the LLs. */
|
/* Set the LLs. */
|
||||||
se->IN_LL_ADDR_REG = (uint32_t)(&in_ll);
|
se->SE_IN_LL_ADDR = (uint32_t)(&in_ll);
|
||||||
se->OUT_LL_ADDR_REG = (uint32_t) (&out_ll);
|
se->SE_OUT_LL_ADDR = (uint32_t) (&out_ll);
|
||||||
|
|
||||||
/* Set registers for operation. */
|
/* Set registers for operation. */
|
||||||
se->ERR_STATUS_REG = se->ERR_STATUS_REG;
|
se->SE_ERR_STATUS = se->SE_ERR_STATUS;
|
||||||
se->INT_STATUS_REG = se->INT_STATUS_REG;
|
se->SE_INT_STATUS = se->SE_INT_STATUS;
|
||||||
se->OPERATION_REG = op;
|
se->SE_OPERATION = op;
|
||||||
|
|
||||||
while (!(se->INT_STATUS_REG & 0x10)) { /* Wait a while */ }
|
while (!(se->SE_INT_STATUS & 0x10)) { /* Wait a while */ }
|
||||||
se_check_for_error();
|
se_check_for_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ void se_perform_aes_block_operation(void *dst, size_t dst_size, const void *src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Trigger AES operation. */
|
/* Trigger AES operation. */
|
||||||
se_get_regs()->BLOCK_COUNT_REG = 0;
|
se_get_regs()->SE_CRYPTO_LAST_BLOCK = 0;
|
||||||
trigger_se_blocking_op(OP_START, block, sizeof(block), block, sizeof(block));
|
trigger_se_blocking_op(OP_START, block, sizeof(block), block, sizeof(block));
|
||||||
|
|
||||||
/* Copy output data into dst. */
|
/* Copy output data into dst. */
|
||||||
@@ -154,8 +154,8 @@ void se_aes_ecb_encrypt_block(unsigned int keyslot, void *dst, size_t dst_size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set configuration high (256-bit vs 128-bit) based on parameter. */
|
/* Set configuration high (256-bit vs 128-bit) based on parameter. */
|
||||||
se->CONFIG_REG = (ALG_AES_ENC | DST_MEMORY) | (config_high << 16);
|
se->SE_CONFIG = (ALG_AES_ENC | DST_MEMORY) | (config_high << 16);
|
||||||
se->CRYPTO_REG = keyslot << 24 | 0x100;
|
se->SE_CRYPTO_CONFIG = keyslot << 24 | 0x100;
|
||||||
se_perform_aes_block_operation(dst, 0x10, src, 0x10);
|
se_perform_aes_block_operation(dst, 0x10, src, 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,8 +166,8 @@ void se_aes_ecb_decrypt_block(unsigned int keyslot, void *dst, size_t dst_size,
|
|||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
se->CONFIG_REG = (ALG_AES_DEC | DST_MEMORY);
|
se->SE_CONFIG = (ALG_AES_DEC | DST_MEMORY);
|
||||||
se->CRYPTO_REG = keyslot << 24;
|
se->SE_CRYPTO_CONFIG = keyslot << 24;
|
||||||
se_perform_aes_block_operation(dst, 0x10, src, 0x10);
|
se_perform_aes_block_operation(dst, 0x10, src, 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,16 +198,16 @@ void se_compute_aes_cmac(unsigned int keyslot, void *cmac, size_t cmac_size, con
|
|||||||
shift_left_xor_rb(derived_key);
|
shift_left_xor_rb(derived_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
se->CONFIG_REG = (ALG_AES_ENC | DST_HASHREG) | (config_high << 16);
|
se->SE_CONFIG = (ALG_AES_ENC | DST_HASHREG) | (config_high << 16);
|
||||||
se->CRYPTO_REG = (keyslot << 24) | (0x145);
|
se->SE_CRYPTO_CONFIG = (keyslot << 24) | (0x145);
|
||||||
clear_aes_keyslot_iv(keyslot);
|
clear_aes_keyslot_iv(keyslot);
|
||||||
|
|
||||||
unsigned int num_blocks = (data_size + 0xF) >> 4;
|
unsigned int num_blocks = (data_size + 0xF) >> 4;
|
||||||
/* Handle aligned blocks. */
|
/* Handle aligned blocks. */
|
||||||
if (num_blocks > 1) {
|
if (num_blocks > 1) {
|
||||||
se->BLOCK_COUNT_REG = num_blocks - 2;
|
se->SE_CRYPTO_LAST_BLOCK = num_blocks - 2;
|
||||||
trigger_se_blocking_op(OP_START, NULL, 0, data, data_size);
|
trigger_se_blocking_op(OP_START, NULL, 0, data, data_size);
|
||||||
se->CRYPTO_REG |= 0x80;
|
se->SE_CRYPTO_CONFIG |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create final block. */
|
/* Create final block. */
|
||||||
@@ -224,12 +224,12 @@ void se_compute_aes_cmac(unsigned int keyslot, void *cmac, size_t cmac_size, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Perform last operation. */
|
/* Perform last operation. */
|
||||||
se->BLOCK_COUNT_REG = 0;
|
se->SE_CRYPTO_LAST_BLOCK = 0;
|
||||||
trigger_se_blocking_op(OP_START, NULL, 0, last_block, sizeof(last_block));
|
trigger_se_blocking_op(OP_START, NULL, 0, last_block, sizeof(last_block));
|
||||||
|
|
||||||
/* Copy output CMAC. */
|
/* Copy output CMAC. */
|
||||||
for (unsigned int i = 0; i < (cmac_size >> 2); i++) {
|
for (unsigned int i = 0; i < (cmac_size >> 2); i++) {
|
||||||
((uint32_t *)cmac)[i] = ((volatile uint32_t *)se->HASH_RESULT_REG)[i];
|
((uint32_t *)cmac)[i] = ((volatile uint32_t *)se->SE_HASH_RESULT)[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,9 +244,9 @@ void se_aes_256_cbc_decrypt(unsigned int keyslot, void *dst, size_t dst_size, co
|
|||||||
reboot();
|
reboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
se->CONFIG_REG = (ALG_AES_DEC | DST_MEMORY) | (0x202 << 16);
|
se->SE_CONFIG = (ALG_AES_DEC | DST_MEMORY) | (0x202 << 16);
|
||||||
se->CRYPTO_REG = (keyslot << 24) | 0x66;
|
se->SE_CRYPTO_CONFIG = (keyslot << 24) | 0x66;
|
||||||
clear_aes_keyslot_iv(keyslot);
|
clear_aes_keyslot_iv(keyslot);
|
||||||
se->BLOCK_COUNT_REG = (src_size >> 4) - 1;
|
se->SE_CRYPTO_LAST_BLOCK = (src_size >> 4) - 1;
|
||||||
trigger_se_blocking_op(OP_START, dst, dst_size, src, src_size);
|
trigger_se_blocking_op(OP_START, dst, dst_size, src, src_size);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -92,71 +92,59 @@
|
|||||||
#define RSA_2048_BYTES 0x100
|
#define RSA_2048_BYTES 0x100
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t _0x0;
|
uint32_t SE_SE_SECURITY;
|
||||||
uint32_t _0x4;
|
uint32_t SE_TZRAM_SECURITY;
|
||||||
uint32_t OPERATION_REG;
|
uint32_t SE_OPERATION;
|
||||||
uint32_t INT_ENABLE_REG;
|
uint32_t SE_INT_ENABLE;
|
||||||
uint32_t INT_STATUS_REG;
|
uint32_t SE_INT_STATUS;
|
||||||
uint32_t CONFIG_REG;
|
uint32_t SE_CONFIG;
|
||||||
uint32_t IN_LL_ADDR_REG;
|
uint32_t SE_IN_LL_ADDR;
|
||||||
uint32_t _0x1C;
|
uint32_t SE_IN_CUR_BYTE_ADDR;
|
||||||
uint32_t _0x20;
|
uint32_t SE_IN_CUR_LL_ID;
|
||||||
uint32_t OUT_LL_ADDR_REG;
|
uint32_t SE_OUT_LL_ADDR;
|
||||||
uint32_t _0x28;
|
uint32_t SE_OUT_CUR_BYTE_ADDR;
|
||||||
uint32_t _0x2C;
|
uint32_t SE_OUT_CUR_LL_ID;
|
||||||
uint8_t HASH_RESULT_REG[0x20];
|
uint32_t SE_HASH_RESULT[0x10];
|
||||||
uint8_t _0x50[0x20];
|
uint32_t SE_CTX_SAVE_CONFIG;
|
||||||
uint32_t CONTEXT_SAVE_CONFIG_REG;
|
uint32_t _0x74[0x63];
|
||||||
uint8_t _0x74[0x18C];
|
uint32_t SE_SHA_CONFIG;
|
||||||
uint32_t SHA_CONFIG_REG;
|
uint32_t SE_SHA_MSG_LENGTH[0x4];
|
||||||
uint32_t SHA_MSG_LENGTH_REG;
|
uint32_t SE_SHA_MSG_LEFT[0x4];
|
||||||
uint32_t _0x208;
|
uint32_t _0x224[0x17];
|
||||||
uint32_t _0x20C;
|
uint32_t SE_CRYPTO_SECURITY_PERKEY;
|
||||||
uint32_t _0x210;
|
uint32_t SE_CRYPTO_KEYTABLE_ACCESS[0x10];
|
||||||
uint32_t SHA_MSG_LEFT_REG;
|
uint32_t _0x2C4[0x10];
|
||||||
uint32_t _0x218;
|
uint32_t SE_CRYPTO_CONFIG;
|
||||||
uint32_t _0x21C;
|
uint32_t SE_CRYPTO_LINEAR_CTR[0x4];
|
||||||
uint32_t _0x220;
|
uint32_t SE_CRYPTO_LAST_BLOCK;
|
||||||
uint32_t _0x224;
|
uint32_t SE_CRYPTO_KEYTABLE_ADDR;
|
||||||
uint8_t _0x228[0x58];
|
uint32_t SE_CRYPTO_KEYTABLE_DATA;
|
||||||
uint32_t AES_KEY_READ_DISABLE_REG;
|
uint32_t _0x324[0x3];
|
||||||
uint32_t AES_KEYSLOT_FLAGS[0x10];
|
uint32_t SE_CRYPTO_KEYTABLE_DST;
|
||||||
uint8_t _0x2C4[0x3C];
|
uint32_t _0x334[0x3];
|
||||||
uint32_t _0x300;
|
uint32_t SE_RNG_CONFIG;
|
||||||
uint32_t CRYPTO_REG;
|
uint32_t SE_RNG_SRC_CONFIG;
|
||||||
uint32_t CRYPTO_CTR_REG[4];
|
uint32_t SE_RNG_RESEED_INTERVAL;
|
||||||
uint32_t BLOCK_COUNT_REG;
|
uint32_t _0x34C[0x2D];
|
||||||
uint32_t AES_KEYTABLE_ADDR;
|
uint32_t SE_RSA_CONFIG;
|
||||||
uint32_t AES_KEYTABLE_DATA;
|
uint32_t SE_RSA_KEY_SIZE;
|
||||||
uint32_t _0x324;
|
uint32_t SE_RSA_EXP_SIZE;
|
||||||
uint32_t _0x328;
|
uint32_t SE_RSA_SECURITY_PERKEY;
|
||||||
uint32_t _0x32C;
|
uint32_t SE_RSA_KEYTABLE_ACCESS[0x2];
|
||||||
uint32_t CRYPTO_KEYTABLE_DST_REG;
|
uint32_t _0x418[0x2];
|
||||||
uint8_t _0x334[0xC];
|
uint32_t SE_RSA_KEYTABLE_ADDR;
|
||||||
uint32_t RNG_CONFIG_REG;
|
uint32_t SE_RSA_KEYTABLE_DATA;
|
||||||
uint32_t RNG_SRC_CONFIG_REG;
|
uint32_t SE_RSA_OUTPUT[0x40];
|
||||||
uint32_t RNG_RESEED_INTERVAL_REG;
|
uint32_t _0x528[0xB6];
|
||||||
uint8_t _0x34C[0xB4];
|
uint32_t SE_STATUS;
|
||||||
uint32_t RSA_CONFIG;
|
uint32_t SE_ERR_STATUS;
|
||||||
uint32_t RSA_KEY_SIZE_REG;
|
uint32_t SE_MISC;
|
||||||
uint32_t RSA_EXP_SIZE_REG;
|
uint32_t SE_SPARE;
|
||||||
uint32_t RSA_KEY_READ_DISABLE_REG;
|
uint32_t SE_ENTROPY_DEBUG_COUNTER;
|
||||||
uint32_t RSA_KEYSLOT_FLAGS[2];
|
|
||||||
uint32_t _0x418;
|
|
||||||
uint32_t _0x41C;
|
|
||||||
uint32_t RSA_KEYTABLE_ADDR;
|
|
||||||
uint32_t RSA_KEYTABLE_DATA;
|
|
||||||
uint8_t RSA_OUTPUT[0x100];
|
|
||||||
uint8_t _0x528[0x2D8];
|
|
||||||
uint32_t FLAGS_REG;
|
|
||||||
uint32_t ERR_STATUS_REG;
|
|
||||||
uint32_t _0x808;
|
|
||||||
uint32_t SPARE_0;
|
|
||||||
uint32_t _0x810;
|
|
||||||
uint32_t _0x814;
|
uint32_t _0x814;
|
||||||
uint32_t _0x818;
|
uint32_t _0x818;
|
||||||
uint32_t _0x81C;
|
uint32_t _0x81C;
|
||||||
uint8_t _0x820[0x17E0];
|
uint32_t _0x820[0x5F8];
|
||||||
} tegra_se_t;
|
} tegra_se_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@@ -30,13 +30,13 @@ static void secmon_decrypt_saved_image(void *dst, const void *src, size_t size);
|
|||||||
|
|
||||||
void secmon_restore_to_tzram(const uint32_t target_firmware) {
|
void secmon_restore_to_tzram(const uint32_t target_firmware) {
|
||||||
/* Newer warmboot binaries clear the untouched keyslots for safety. */
|
/* Newer warmboot binaries clear the untouched keyslots for safety. */
|
||||||
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_500) {
|
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_5_0_0) {
|
||||||
secmon_clear_unused_keyslots();
|
secmon_clear_unused_keyslots();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decrypt Secure Monitor from DRAM into TZRAM. */
|
/* Decrypt Secure Monitor from DRAM into TZRAM. */
|
||||||
void *tzram_src = (void *)(0x80010000);
|
void *tzram_src = (void *)(0x80010000);
|
||||||
void *tzram_dst = (void *)(target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_500 ? 0x7C012000 : 0x7C010000);
|
void *tzram_dst = (void *)(target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_5_0_0 ? 0x7C012000 : 0x7C010000);
|
||||||
const size_t tzram_size = 0xE000;
|
const size_t tzram_size = 0xE000;
|
||||||
secmon_decrypt_saved_image(tzram_dst, tzram_src, tzram_size);
|
secmon_decrypt_saved_image(tzram_dst, tzram_src, tzram_size);
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ void secmon_restore_to_tzram(const uint32_t target_firmware) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make security engine require secure busmaster. */
|
/* Make security engine require secure busmaster. */
|
||||||
se_get_regs()->_0x4 = 0;
|
se_get_regs()->SE_TZRAM_SECURITY = 0;
|
||||||
|
|
||||||
/* TODO: se_verify_keys_unreadable(); */
|
/* TODO: se_verify_keys_unreadable(); */
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user