Compare commits

...
192 Commits
Author SHA1 Message Date
Michael Scire 80cae0cc2d kern: simplify random bitmap selection to match latest Nintendo logic 2021-10-25 17:00:59 -07:00
Michael Scire e780171c78 kern: add (and use) generic KSystemControlBase 2021-10-25 15:07:24 -07:00
Michael Scire 0cbf726479 kern/test: add some scheduler tests (yields work correctly, all non-special priorities are cooperative/not pre-emptive 2021-10-25 13:54:33 -07:00
Michael Scire a192ca5172 hos: whoops 2021-10-25 13:54:33 -07:00
Michael Scire cbebfcb9e2 hos: better safe than sorry 2021-10-25 13:54:33 -07:00
Michael Scire ec950d8320 hos: allow turning off ams extension hard-reqs for unit testing 2021-10-25 13:54:33 -07:00
Michael Scire d562bb841d kern: add toggleable support for 40-bit physaddr caps 2021-10-25 13:54:33 -07:00
Michael Scire ff1760fac1 util: add trait/macro for is_constexpr_constructible 2021-10-25 13:54:33 -07:00
Michael Scire 7ea4737abb test: add tests for SetMemoryPermission 2021-10-25 13:54:33 -07:00
Michael Scire 0a1ce6f079 kern/test: add wip qemu-virt board support to mesosphere 2021-10-25 13:54:33 -07:00
Michael Scire 10ed579c38 kernel_ldr: bring initial cache flush in line with Nintendo 2021-10-25 13:38:52 -07:00
Michael Scire 6ad3219656 kern: reflect nintendo cache management behavior for initial processes 2021-10-25 13:02:35 -07:00
Michael Scire 54dde406bc kern: devirtualize KReadableEvent::Reset, KWorkerTask::DoWorkerTask 2021-10-24 20:41:38 -07:00
Michael Scire fd187f952e kern: enable lto for global instants (saves about a page in deduplicated code) 2021-10-24 17:06:43 -07:00
Michael Scire 8a661cee6e kern: devirtualize KAutoObjectWithList::GetId() 2021-10-24 17:00:05 -07:00
Michael Scire 3e4acc62f3 kern: fix reorder-init in KHandleTable 2021-10-24 13:08:08 -07:00
Michael Scire d0cd511c0e kern: devirtualize most things that are free to devirtualize (see #1672) 2021-10-24 13:04:31 -07:00
Michael Scire aaa3770806 kern: optimize timespan -> tick codegen, improve .text layout 2021-10-24 01:16:24 -07:00
Michael Scire 89926f44c6 kern: use optimized red black tree finds for remaining holdouts 2021-10-23 21:58:48 -07:00
Michael Scire 436613401a kern: devirtualize several KAutoObject functions 2021-10-23 21:13:26 -07:00
Michael Scire 2490bbf4f9 kern: KCacheHelper: better reflect nintendo coremask clearing logic 2021-10-23 17:44:30 -07:00
Michael Scire 71e4313d0c kern: devirtualize remaining vcall for class token/dyncast 2021-10-23 16:04:04 -07:00
SciresM 36e4914be8 kern: avoid constexpr init for many objects (avoids unnecessary memory clear) (#1668) 2021-10-23 15:25:20 -07:00
Michael Scire 20716cb3de kern: use new AtomicRef, use Atomic<bool> 2021-10-20 13:29:38 -07:00
Michael Scire aed9d3f535 util: better match true std::atomic semantics 2021-10-20 11:02:17 -07:00
Michael Scire c6d7174dd3 exo: use the fancy new optimal atomics 2021-10-20 08:52:54 -07:00
Michael Scire d74f364107 kern/util: use custom atomics wrapper to substantially improve codegen 2021-10-19 15:24:15 -07:00
Michael Scire 52332e8d75 kern: use 13.0.0 revised KLightLock logic 2021-10-19 02:45:29 -07:00
Michael Scire 3fc695aff8 kern: fix capability check for thread priorities 2021-10-19 01:41:23 -07:00
Michael Scire d3eb1268bc kern: remove spurious assertion 2021-10-19 01:21:23 -07:00
Michael Scire f3b532070b kern: update scheduler for 13.0.0 change, fix some ctz/clz bugs 2021-10-19 01:20:28 -07:00
Michael Scire 42b6c2dd95 kern: fix use of plr vs plr_heap, fix close/unlock order in ArbitrateLock 2021-10-19 01:19:31 -07:00
Michael Scire 52c914afcc ams-libs: move -Wno-invalid-offsetof to cxxflags, not cflags 2021-10-18 13:10:02 -07:00
Michael Scire 692247b26b ams-libs: use nintendo_nx identifier for source file compat bpmp<->ccplex 2021-10-18 11:10:25 -07:00
Michael Scire 799a9a5f98 lr: fix EraseRedirection hang introduced by refactoring 2021-10-18 11:00:55 -07:00
Michael Scire 889d843718 ams: improve offsetof style consistency 2021-10-18 00:17:13 -07:00
Michael Scire ec6d1a92ef util: improve (and use) offsetof that's """standard compliant""" 2021-10-17 21:45:02 -07:00
Michael Scire ad4c794aea constexpr: resign ourselves to gcc dropping void -> T support 2021-10-17 02:39:16 -07:00
Michael Scire 96d3187f3e kern: remove need for explicit reserved member in KAutoObject 2021-10-16 17:17:26 -07:00
Michael Scire bfffe6b119 kern: devirtualize KAutoObject::DynamicCast<>()
This is an optimization that saves the most common type of virtual call in the kernel (DynamicCast)
by storing class token as a member, rather than getting it via virtual call every time.

This does not currently cost any memory space on 64-bit targets, due to pre-existing padding space.

This optimization can be turned off via a compile-time flag for accuracy.
2021-10-16 16:24:06 -07:00
Michael Scire 26c02e2019 kern/util: update structure layouts to match Nintendo (saves 0x10 per KThread/KSession) 2021-10-16 16:13:10 -07:00
Michael Scire 7805a3624e fusee: accept non-zero rather than rejecting non-one for emummc enable 2021-10-16 12:26:17 -07:00
Michael Scire 64950dbd31 powctl: remove unused arm_neon header after last commit 2021-10-16 10:11:45 -07:00
Michael Scire 03efc31f9c powctl: don't require arm64 arch for floating -> fixed conversion 2021-10-16 10:04:19 -07:00
Michael Scire f7f83b4742 git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "cf765c094"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "cf765c094"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-10-15 23:55:53 -07:00
Michael Scire 8634ea0f7c docs: add changelog for 1.2.0 2021-10-15 23:54:25 -07:00
Michael Scire 2541f6dd71 tipc: implement special-case templating used by 13.0.0 pgl 2021-10-15 21:23:55 -07:00
Michael Scire ff5f376c33 tipc: enable named-thread dispatch 2021-10-15 19:59:29 -07:00
Michael Scire d1bc1a5c57 boot: update for 13.0.0/aula parameter changes (closes #1477) 2021-10-15 19:03:11 -07:00
Michael Scire 990daec3a2 powctl: integrate 13.0.0 changes (aula params not done yet) 2021-10-15 16:30:27 -07:00
Michael Scire c04a262d49 boot: update display logic for 13.0.0 changes 2021-10-14 19:48:13 -07:00
Michael Scire 7e536f74ae strat: fix some mitm server management logic 2021-10-14 00:40:43 -07:00
Michael Scire 891fa32bf1 tipc/sm: update more fully for 13.0.0 changes 2021-10-13 23:50:57 -07:00
Michael Scire ca25a884b5 tipc: add additional logic from 13.0.0 2021-10-12 00:57:54 -07:00
Michael Scire 0189c5f1e6 sm/tipc: minor cleanup 2021-10-12 00:20:21 -07:00
Michael Scire 124a1a1ea0 sm: update for 13.0.0, optimize layout to reduce storage size. 2021-10-11 22:16:37 -07:00
Michael Scire 82d07e04aa strat: don't force fs globals to link into every process 2021-10-11 22:16:12 -07:00
Michael Scire bd1bcdf52b sf: prevent emitting mitm/defer code unless server in process supports it 2021-10-11 19:01:27 -07:00
Michael Scire d27fe8a229 util: fix consteval CountTrailingZeroes impl 2021-10-11 13:15:11 -07:00
Michael Scire 1c5edaf4fb fatal: use align up for width calc 2021-10-11 12:41:43 -07:00
Michael Scire 3cd8ec509c boot: probably should have done this a few months ago huh 2021-10-11 01:01:31 -07:00
Michael Scire 3bee3e77ca ams: bump api verrsion pre-emptively to 1.2.0 2021-10-11 01:00:07 -07:00
Michael Scire 5708bb1557 ams: allow bootloader to merely approximate correct target firmware 2021-10-11 00:54:17 -07:00
Michael Scire d41de21753 fusee: fix loader stub 2021-10-11 00:19:47 -07:00
Michael Scire 06f68a8159 loader: refactor to remove fake namespaces 2021-10-10 21:37:29 -07:00
Michael Scire d9dc04318d loader: refactor ro manager/improve accuracy 2021-10-10 18:22:32 -07:00
Michael Scire d8a36e39f2 spl: refactor for accuracy/move into libstrat 2021-10-10 12:57:36 -07:00
ndeadlyandndeadly 4758dfa933 docs: add hactool to list of build dependencies (#1662)
Co-authored-by: ndeadly <24677491+ndeadly@users.noreply.github.com>
2021-10-10 04:50:57 -07:00
Michael Scire bc96ebb74c os: add FlushDataCache 2021-10-10 00:33:52 -07:00
Michael Scire a595c232b9 strat: use m_ for member variables 2021-10-10 00:14:06 -07:00
Michael Scire ce28591ab2 svc: use m_ for member variables 2021-10-09 16:14:00 -07:00
Michael Scire 00116450c3 sdmmc: use m_ for member variables 2021-10-09 15:59:59 -07:00
Michael Scire 179d91a563 kern: fix some lingering non-m_ member variables 2021-10-09 15:46:04 -07:00
Michael Scire 67a45c97ef exo/vapours: refactor member variables to m_ over this-> 2021-10-09 15:40:06 -07:00
Michael Scire 5a38311ebf libstrat: remove lingering debugging edits 2021-10-09 14:51:44 -07:00
Michael Scire 1ab0bd1765 ams: replace most remaining operator & with std::addressof 2021-10-09 14:49:53 -07:00
Michael Scire ce8aacef21 settings: fix correctness issue in LazyFileAccessor 2021-10-09 14:20:37 -07:00
Michael Scire ec65c39d17 strat: refactor address taking of form &var[...] 2021-10-09 12:45:31 -07:00
Michael Scire b0e520112b strat: always use explicit result namespacing 2021-10-09 10:36:21 -07:00
Adubbz 303c6eb5f9 settings: implement KeyValueStore (#1659)
* settings: implement KeyValueStore and dependencies

* settings: update KeyValueStore for recent refactoring

* settings: address feedback
2021-10-09 09:16:40 -07:00
Michael Scire 14c8801259 sm: remove apm:p compatibility hack
Homebrew which would hang when doing this were compiled with libnx < 3.0.0.

Homebrew which is compiled with < 3.0.0 cannot send messages to sm, because
of the incorrect serialization problem (which required homebrew recompile when
12.0.0 released).

Thus, there is no case where this makes a difference.
2021-10-08 15:25:52 -07:00
Michael Scire 960ba52a43 kern: put rela in bss
NOTE: This saves ~0x4000 of space at the cost of crimes against the linker script.
2021-10-08 12:48:53 -07:00
Michael Scire fba962ef11 kern: clean up mesosphere buildscript 2021-10-08 12:32:23 -07:00
Michael Scire 9def4b5925 kern: tidy up capability calc 2021-10-08 12:29:41 -07:00
Michael Scire 578843f92c fusee: fix loader stub size alignment 2021-10-08 11:18:12 -07:00
Michael Scire e5cce0f61c git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "0a4c2759a"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "0a4c2759a"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-10-07 23:38:51 -07:00
Michael Scire d14290e357 os: fix mutex push/pop prototypes 2021-10-07 23:38:15 -07:00
Michael Scire 812acb8b68 git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "80d72af9f"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "80d72af9f"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-10-07 23:07:34 -07:00
Michael Scire 229651fe72 ams.mitm: avoid using std::unordered_map, it manifests exception code 2021-10-07 22:59:16 -07:00
Michael Scire 41a4bf53f6 cs: prevent exceptions from manifesting 2021-10-07 19:48:40 -07:00
Michael Scire 888b35833e boot: save 12KB 2021-10-07 19:33:07 -07:00
Michael Scire afccc35e79 erpt: save 8KB 2021-10-07 19:14:31 -07:00
Michael Scire e7ca22abd7 jpegdec: save 128KB of memory 2021-10-07 18:03:11 -07:00
Michael Scire ffc143860b strat: use ams::Main() instead of main(argc, argv) 2021-10-07 17:44:54 -07:00
Michael Scire 6a53726833 strat: build sysmodules with -Wextra/-Werror 2021-10-06 23:22:54 -07:00
Michael Scire e8f1efd01b libstrat: fix compilation without pre-compiled header/without lto 2021-10-06 17:58:42 -07:00
Michael Scire 7ca83c9d3b libstrat: enable -Wextra, -Werror
This caught an embarrassingly large number of bugs.
2021-10-06 15:20:48 -07:00
Michael Scire e1fbf27398 os: fix MapTransferMemory output not being set 2021-10-06 12:07:26 -07:00
Michael Scire 4866e80769 svc: refactor/rename MemoryInfo fields 2021-10-05 15:16:54 -07:00
Michael Scire d9159f81d2 ro: double whoops 2021-10-05 12:40:58 -07:00
Michael Scire 306f413874 ro/dmnt: fix process address space detection 2021-10-05 12:34:09 -07:00
Michael Scire 719ead824e strat: remove map namespace, svc: add address space defs 2021-10-05 12:22:34 -07:00
Michael Scire 69777cf792 strat: use sf::NativeHandle for ipc templating 2021-10-05 00:11:36 -07:00
Michael Scire d97e97258e sf: add NativeHandle type
TODO: figure out how to integrate this into templating...
2021-10-04 17:34:16 -07:00
Michael Scire d0041a33ac strat: prefer os::NativeHandle to Handle/svc::Handle where sensible 2021-10-04 17:12:32 -07:00
Michael Scire 597d521f52 pm: use svc::LimitableResource where relevant 2021-10-04 16:33:18 -07:00
Michael Scire 6f680fe63b strat: use svc:: over ::svc 2021-10-04 14:54:13 -07:00
Michael Scire 77fe5cf6f5 ams: the copyright^H^H^H^H^H^H^Hmplex plane is the algebraic closure of the reals 2021-10-04 12:59:10 -07:00
Michael Scire 6f76066d24 os: remove ManagedHandle, refactor to use NativeHandle typename 2021-10-04 12:33:09 -07:00
Michael Scire a774833790 ro: simplify program id logic 2021-10-01 19:10:19 -07:00
Michael Scire 65fd967550 pm/cfg: simplify initial process id range logic 2021-10-01 17:37:39 -07:00
Michael Scire 18825866ac strat: automatic program id detection 2021-10-01 17:18:50 -07:00
Michael Scire 9ecec1b935 result: improve Includes codegen 2021-10-01 15:12:38 -07:00
Michael Scire 2b37e5d486 os: adopt nintendo ReaderWriter naming over ReadWrite 2021-10-01 11:42:34 -07:00
Michael Scire 00d0c94f2d os: amend io region api 2021-10-01 01:02:48 -07:00
Michael Scire 3eac814268 os: improve thread name codegen 2021-10-01 00:41:35 -07:00
Michael Scire 82f3416799 os: implement SharedMemory, update AslrSpaceManager 2021-10-01 00:36:18 -07:00
Michael Scire 101e3087fe os: fix AttachTransferMemory return type 2021-09-30 22:18:46 -07:00
Michael Scire 24d6933145 strat: use consistent include style for lib headers 2021-09-30 19:21:08 -07:00
Michael Scire 7444a68cd1 os: adopt multiwait naming over waitable 2021-09-30 19:00:47 -07:00
Michael Scire d9b4009f82 os: add IoRegion 2021-09-30 11:43:17 -07:00
Michael Scire 2d214f5e1e os: add tentative IoRegionType 2021-09-30 11:32:45 -07:00
Michael Scire c31060f0b8 lmem: fix assert with side effects 2021-09-29 23:56:30 -07:00
Michael Scire 427ab78bc6 pm: implement newer-N-pm's dynamic resource logic 2021-09-29 23:33:25 -07:00
Michael Scire 41ab4c2c68 stratosphere: use SdkMutex/SdkRecursiveMutex over Mutex 2021-09-29 22:52:50 -07:00
Michael Scire a4fe1bb5d8 libstrat: uncomment some asserts 2021-09-29 22:02:58 -07:00
Michael Scire 9b04ff0f54 ams-libs: AMS_ASSERT no longer invokes expression 2021-09-29 21:32:40 -07:00
Michael Scire 5dc64bc1f7 os: implement Barrier 2021-09-29 18:03:11 -07:00
Michael Scire b25218c918 os: implement SdkRecursiveMutex 2021-09-29 14:56:53 -07:00
Michael Scire c949779b3d stratosphere: grant access to SynchronizePreemptionState 2021-09-29 14:18:03 -07:00
Michael Scire 6b438c7adf ddsf: We can use LightEvent now 2021-09-29 14:17:40 -07:00
Michael Scire 8fc7d715a5 os: add unit tests for ExpandUnsignedValueToAscii 2021-09-29 13:55:40 -07:00
Michael Scire 15ff64e03a os: implement ExpandUnsignedValueToAscii
Nintendo does this as of latest firmware.

It's desirable because it removes the only usage of util::SNPrintf() from os library,
which means programs which don't otherwise use SNPrintf do not need to link it into .text.

This saves ~0xD40 of .text as of time-of-commit when successfully unlinking, and e.g.
reduces our sm (and other modules) memory size by a page.
2021-09-29 13:42:11 -07:00
Michael Scire 1e7a327a25 os: implement LightSemaphore 2021-09-29 13:24:03 -07:00
Michael Scire b8a1ebd11a os: implement LightMessageQueue 2021-09-29 12:55:52 -07:00
Michael Scire cf5f431058 os: refactor MessageQueue to use new MessageQueueHelper template 2021-09-29 12:24:18 -07:00
Michael Scire c7634c66c4 os: tweak LightEvent codegen 2021-09-28 19:11:52 -07:00
Michael Scire 632b6b3330 os: implement LightEvent 2021-09-28 18:54:09 -07:00
Michael Scire 5e0bbb61b1 os: implement ReadWriteBusyMutex 2021-09-28 17:01:11 -07:00
Michael Scire 09570c470c os: implement BusyMutex 2021-09-28 14:53:55 -07:00
Michael Scire d00cec38b0 kern: use util::BitFlagSet for capability flags 2021-09-27 11:37:27 -07:00
BestPig 273206f314 Reduce insert_splash_screen processing time with python3 from ~1m20s to ~0.6s 2021-09-27 11:35:21 -07:00
Michael Scire 98f438e742 kern: fix/update thread permissions on pin 2021-09-26 14:51:54 -07:00
Michael Scire 99c74469e6 git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "e05183a6f"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "e05183a6f"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-09-24 09:17:32 -07:00
Michael Scire a3d9efb18c ams: bump version to 1.1.1 2021-09-24 09:16:30 -07:00
Michael Scire 3fe072a1d0 kern: devirtualize page table operations 2021-09-21 10:09:27 -07:00
Michael Scire ab81ed2795 fs.mitm: fix memory leak in romfs build (closes #1031) 2021-09-20 17:53:29 -07:00
shchmue 56bfbb02ec Make build_package3.py Python 2&3 compatible 2021-09-20 12:37:25 -07:00
Michael Scire 006f8022c0 pkg3: fix build when revision collides with a previous commit 2021-09-19 11:07:23 -07:00
Michael Scire 296d049257 git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "dc52a3228"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "dc52a3228"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-09-19 11:01:23 -07:00
Michael Scire 155f158197 ncm: fix destructor availability 2021-09-19 11:00:57 -07:00
Michael Scire 3dc51e164f loader: fix enum cast 2021-09-19 10:42:28 -07:00
Michael Scire 801f784fae git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "33ae401bc"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "33ae401bc"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-09-19 10:36:39 -07:00
Michael Scire ed295c4cb5 docs: add changelog for 1.0.0 2021-09-19 10:34:31 -07:00
Michael Scire 790f7498c1 loader: update for 13.0.0 ncm changes 2021-09-19 10:34:31 -07:00
Michael Scire 7cdfa68dd5 svc: bump supported version 2021-09-19 10:34:31 -07:00
Michael Scire 90732ff311 kern: unify all waiting semantics to use single api 2021-09-19 10:34:31 -07:00
Michael Scire f6fb5f2c8d kern/svc: implement IoPool/Region svc support 2021-09-19 10:34:31 -07:00
Michael Scire ce7dd55257 svc/kern/dd: remove MapDeviceAddressSpace() 2021-09-19 10:34:31 -07:00
Michael Scire 481ce12b7b kern: update Initialize0 for new arguments/randomization semantics 2021-09-19 10:34:31 -07:00
Michael Scire 2f2c36b22b kern: KMemoryManager/KPageGroup use physical addresses instead of virtual, now 2021-09-19 10:34:31 -07:00
Michael Scire 2c4bd44d7e kern: support dynamic resource expansion for system heaps/events/sessions. 2021-09-19 10:34:31 -07:00
Michael Scire 2b91956051 kern: improve kdebug attach semantics 2021-09-19 10:34:31 -07:00
Michael Scire 4c73c461f1 kern: update KPageTable::Unmap block closing logic 2021-09-19 10:34:31 -07:00
Michael Scire 8b49cea4a9 kern: optimize logging for release kernel strings (saves printf space in .text) 2021-09-19 10:34:31 -07:00
Michael Scire fdf008108c kern: add new KMemoryState 2021-09-19 10:34:31 -07:00
Michael Scire 252486913b kern: KWorkerTaskManager no longer tracks id 2021-09-19 10:34:31 -07:00
Michael Scire 44d10da7b8 kern: KSchedulerInterruptTask -> KSchedulerInterruptHandler 2021-09-19 10:34:31 -07:00
Michael Scire cb28150912 kern: kill the interrupt task manager thread 2021-09-19 10:34:31 -07:00
Michael Scire 29cc3d1c09 kern: remove per-KInterruptEventTask locks 2021-09-19 10:34:31 -07:00
Michael Scire e6a6fe6f38 kern: delete KWritableEvent, devirtualize KReadableEvent Signal/Clear 2021-09-19 10:34:31 -07:00
Michael Scire d80ad222cc kern: KConditionVariable arbiter functions now static 2021-09-19 10:34:31 -07:00
Michael Scire 572cbd8619 kern: KAutoObject doesn't need (virtual) destructor 2021-09-19 10:34:31 -07:00
Michael Scire 183243bf16 kern: optimize handle table layout 2021-09-19 10:34:31 -07:00
Michael Scire 6407786059 kern: update GetInfo logic for tick count InfoTypes 2021-09-19 10:34:31 -07:00
Michael Scire 6cbfaaf835 kern: port limit is now 0x180 2021-09-19 10:34:31 -07:00
Adubbz b6b09d6944 ncm: updated to 13.0.0 2021-09-19 10:34:31 -07:00
Michael Scire c1c07af99a git subrepo pull emummc
subrepo:
  subdir:   "emummc"
  merged:   "7a3db0fb"
upstream:
  origin:   "https://github.com/m4xw/emuMMC"
  branch:   "develop"
  commit:   "f6608731"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-09-19 10:34:31 -07:00
Michael Scire 05b54c4c2a erpt: launch sprofile only on 13.0.0+ 2021-09-19 10:34:31 -07:00
Michael Scire 619a7b2074 git subrepo pull emummc
subrepo:
  subdir:   "emummc"
  merged:   "4e1ac0a7"
upstream:
  origin:   "https://github.com/m4xw/emuMMC"
  branch:   "develop"
  commit:   "c6a2e9cc"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-09-19 10:34:31 -07:00
Adubbz a941e4be03 ncm: skeleton new commands 2021-09-19 10:34:31 -07:00
Michael Scire e2a74a9e38 git subrepo pull emummc
subrepo:
  subdir:   "emummc"
  merged:   "2e001dd2"
upstream:
  origin:   "https://github.com/m4xw/emuMMC"
  branch:   "develop"
  commit:   "29deabb2"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2021-09-19 10:34:31 -07:00
Michael Scire 89541c8042 sprofile: fully reimplement sprof:bg + sprof:sp 2021-09-19 10:34:31 -07:00
Michael Scire ae54ec5981 sprofile: implement non-importer bgagent commands 2021-09-19 10:34:31 -07:00
Michael Scire 75d5e2aef0 sprofile: implement OpenProfileUpdateObserver 2021-09-19 10:34:31 -07:00
Michael Scire bd240b23d8 erpt: skeleton sprofile apis 2021-09-19 10:34:31 -07:00
Michael Scire 568a3b62eb set.mitm: pointer buffer size was increased to 0x200 in 13.0.0 2021-09-19 10:34:31 -07:00
Michael Scire 04cbc06bc1 ams: update current target firmware 2021-09-19 10:34:31 -07:00
Michael Scire 385f00c375 fusee: bump package2 check 2021-09-19 10:34:31 -07:00
Michael Scire 23a1cee2e3 exo: more fixes for 13.0.0 2021-09-19 10:34:31 -07:00
Michael Scire fedd684a1c fusee/exo: update for new dram id changes 2021-09-19 10:34:31 -07:00
Michael Scire cb299d9260 fusee/exo: update for recognition of 13.0.0 2021-09-19 10:34:31 -07:00
2888 changed files with 63787 additions and 30135 deletions

No files matched your search

+2
View File
@@ -7,6 +7,7 @@ Building Atmosphère is a very straightforward process that relies almost exclus
+ [Python 2](https://www.python.org) (Python 3 may work as well, but this is not guaranteed) + [Python 2](https://www.python.org) (Python 3 may work as well, but this is not guaranteed)
+ [LZ4](https://pypi.org/project/lz4) + [LZ4](https://pypi.org/project/lz4)
+ [PyCryptodome](https://pypi.org/project/pycryptodome) (optional) + [PyCryptodome](https://pypi.org/project/pycryptodome) (optional)
+ [hactool](https://github.com/SciresM/hactool)
## Instructions ## 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. 1. Follow the guide located [here](https://devkitpro.org/wiki/Getting_Started) to install and configure all the tools necessary for the build process.
@@ -17,6 +18,7 @@ Building Atmosphère is a very straightforward process that relies almost exclus
+ `switch-libjpeg-turbo` + `switch-libjpeg-turbo`
+ `devkitARM` + `devkitARM`
+ `devkitarm-rules` + `devkitarm-rules`
+ `hactool`
3. Install the following library via python's package manager `pip`, required by [exosphere](components/exosphere.md): 3. Install the following library via python's package manager `pip`, required by [exosphere](components/exosphere.md):
+ `lz4` + `lz4`
+53
View File
@@ -1,4 +1,57 @@
# Changelog # Changelog
## 1.2.0
+ `boot` was updated to reflect the latest official behavior for display/battery management.
+ This should fix any issues that might result from running older releases on the OLED model, if you're somehow in a position to do so.
+ The "target firmware" system was changed to allow the bootloader to specify an approximation, rather than the true target firmware.
+ Previously we expected compliant bootloaders to inspect SYSTEM:/ to determine the specific target firmware.
+ Now, we only require an approximate version, with major version == true major version and approximate version <= true version.
+ This greatly simplifies bootloader requirements, and correspondingly all code for accessing SYSTEM has been removed from fusee.
+ This should result in a substantial speedup when booting emummc with fusee, as SYSTEM accesses were the most expensive thing done previously.
+ This should resolve any inconsistency in firmware detection when booting via fusee vs hekate.
+ This should also improve our compatibility with micro firmware releases, making it more likely that atmosphere "just works" if nothing important has changed.
+ Dynamic resource limit determination logic was implemented in `pm` to match latest official behavior.
+ This greatly simplifies/makes consistent the resource limits on older firmwares, as well.
+ An enormous amount of refactoring was performed under the hood, including:
+ **Please Note**: If you are a developer who uses Atmosphere-libs, a number of changes here are breaking.
+ Feel free to contact SciresM#0524 for help updating your program.
+ The OS namespace had many primitives implemented/made more accurate.
+ Since mesosphere is now always-on, os::LightEvent (which required newer SVCs) is now globally usable (and used by stratosphere where relevant).
+ Assertions are now true no-ops when building for release.
+ Stratosphere is now built with -Wextra/-Werror.
+ Most "common" logic in system module main.cpp files was moved into libstratosphere.
+ **Please Note**: main.cpp files for prior atmosphere-libs will no longer work, for a really large number of reasons.
+ A number of longstanding code style issues were corrected.
+ Mesosphere now uses util::BitFlagSet for SVC permissions.
+ Mesosphere now puts its relocation table inside .bss, which allows that memory to be reclaimed after relocations are performed.
+ These changes save ~16KB of memory in the kernel, all said and done.
+ A number of locations in stratosphere where memory could be saved were spotted and taken advantage of, leading to ~150-200KB of saved memory.
+ The `spl` and `loader` system module was refactored to better reflect official logic.
+ `sf` ipc server code was updated to only emit mitm/defer logic when that logic is actually required somewhere in process.
+ `tipc` ipc server code was updated to reflect changes to official logic made in 13.0.0.
+ Many, many other minor changes, please talk to SciresM#0524 or read the relevant commits if you want to know more.
+ A number of minor issues were fixed, including:
+ Mesosphere's handling of SVC permissions on thread pin/unpin was updated to reflect official kernel behavior.
+ util::CountTrailingZeroes() was fixed to calculate the correct value when used at compile-time.
+ General system stability improvements to enhance the user's experience.
## 1.1.1
+ A bug was fixed which caused some memory to leak when launching a game with mods enabled, eventually causing a crash after enough game launches without rebooting.
+ General system stability improvements to enhance the user's experience.
## 1.1.0
+ Support was implemented for 13.0.0.
+ `mesosphère` was updated to reflect the latest official kernel behavior.
+ `ncm` was updated to reflect the latest official behaviors.
+ `erpt` was updated to reflect the latest official behaviors.
+ Two new services ("sprofile") were added to `erpt`, and have been fully reimplemented.
+ **Please Note**: These services provide a way for settings to be pushed to consoles over the internet without system update.
+ Because there appear to be no settings pushed out yet, this implementation fundamentally cannot be fully tested right now, but hopefully there are no issues once settings begin being distributed.
+ The `LogManager` system module was reimplemented.
+ This system module provides services that some games use for logging.
+ Atmosphere's reimplementation supports logging to the SD card (if `lm!enable_sd_card_logging` is true) and to ams.TMA.
+ To control the directory where logs are saved, modify the `lm!sd_card_log_output_directory` setting.
+ Atmosphere's reimplementation is disabled by default (in order to save memory), but can be enabled by setting `lm!enable_log_manager` to true.
+ This will allow reading over logs from games which use the services (or potentially logging from homebrew in the future), which can be useful to developers.
+ Please note that when TMA is fully implemented in the future, enabling TMA will forcibly enable `LogManager`.
+ General system stability improvements to enhance the user's experience.
## 1.0.0 ## 1.0.0
+ `fusee` was completely re-written in C++ to use the same atmosphere-libs APIs as the rest of atmosphere's code. + `fusee` was completely re-written in C++ to use the same atmosphere-libs APIs as the rest of atmosphere's code.
+ The rewrite was performed with a big emphasis on ensuring a good boot speed, and generally boot should be much faster than it was previously. + The rewrite was performed with a big emphasis on ensuring a good boot speed, and generally boot should be much faster than it was previously.
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2018-2020 Atmosphère-NX Copyright (c) Atmosphère-NX
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -6,7 +6,7 @@
[subrepo] [subrepo]
remote = https://github.com/m4xw/emuMMC remote = https://github.com/m4xw/emuMMC
branch = develop branch = develop
commit = cbc294c390ed73bb281bc1028a8899c053427112 commit = f66087313546161a000ee196a788f0626caf80fa
parent = 38f9a76ba028995ed3274da3a45b0254f09d1f59 parent = 38f9a76ba028995ed3274da3a45b0254f09d1f59
method = rebase method = rebase
cmdver = 0.4.1 cmdver = 0.4.1
+8 -8
View File
@@ -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 - 11.0.0** **1.0.0 - 13.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
+11
View File
@@ -37,4 +37,15 @@
#define BOOT_PARTITION_SIZE 0x2000 #define BOOT_PARTITION_SIZE 0x2000
#define FS_READ_WRITE_ERROR 1048 #define FS_READ_WRITE_ERROR 1048
#define NAND_PATROL_SECTOR 0xC20
#define NAND_PATROL_OFFSET 0x184000
typedef struct _fs_nand_patrol_t
{
uint8_t hmac[0x20];
unsigned int offset;
unsigned int count;
uint8_t rsvd[0x1D8];
} fs_nand_patrol_t;
#endif /* __FS_H__ */ #endif /* __FS_H__ */
+8
View File
@@ -55,6 +55,8 @@
#include "offsets/1200_exfat.h" #include "offsets/1200_exfat.h"
#include "offsets/1203.h" #include "offsets/1203.h"
#include "offsets/1203_exfat.h" #include "offsets/1203_exfat.h"
#include "offsets/1300.h"
#include "offsets/1300_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
@@ -121,6 +123,8 @@ DEFINE_OFFSET_STRUCT(_1200);
DEFINE_OFFSET_STRUCT(_1200_EXFAT); DEFINE_OFFSET_STRUCT(_1200_EXFAT);
DEFINE_OFFSET_STRUCT(_1203); DEFINE_OFFSET_STRUCT(_1203);
DEFINE_OFFSET_STRUCT(_1203_EXFAT); DEFINE_OFFSET_STRUCT(_1203_EXFAT);
DEFINE_OFFSET_STRUCT(_1300);
DEFINE_OFFSET_STRUCT(_1300_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) {
@@ -202,6 +206,10 @@ const fs_offsets_t *get_fs_offsets(enum FS_VER version) {
return &(GET_OFFSET_STRUCT_NAME(_1203)); return &(GET_OFFSET_STRUCT_NAME(_1203));
case FS_VER_12_0_3_EXFAT: case FS_VER_12_0_3_EXFAT:
return &(GET_OFFSET_STRUCT_NAME(_1203_EXFAT)); return &(GET_OFFSET_STRUCT_NAME(_1203_EXFAT));
case FS_VER_13_0_0:
return &(GET_OFFSET_STRUCT_NAME(_1300));
case FS_VER_13_0_0_EXFAT:
return &(GET_OFFSET_STRUCT_NAME(_1300_EXFAT));
default: default:
fatal_abort(Fatal_UnknownVersion); fatal_abort(Fatal_UnknownVersion);
} }
+3
View File
@@ -80,6 +80,9 @@ enum FS_VER
FS_VER_12_0_3, FS_VER_12_0_3,
FS_VER_12_0_3_EXFAT, FS_VER_12_0_3_EXFAT,
FS_VER_13_0_0,
FS_VER_13_0_0_EXFAT,
FS_VER_MAX, FS_VER_MAX,
}; };
+59
View File
@@ -0,0 +1,59 @@
/*
* 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_1300_H__
#define __FS_1300_H__
// Accessor vtable getters
#define FS_OFFSET_1300_SDMMC_ACCESSOR_GC 0x158C80
#define FS_OFFSET_1300_SDMMC_ACCESSOR_SD 0x15AA90
#define FS_OFFSET_1300_SDMMC_ACCESSOR_NAND 0x1591B0
// Hooks
#define FS_OFFSET_1300_SDMMC_WRAPPER_READ 0x154620
#define FS_OFFSET_1300_SDMMC_WRAPPER_WRITE 0x1546E0
#define FS_OFFSET_1300_RTLD 0x688
#define FS_OFFSET_1300_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C)))
#define FS_OFFSET_1300_CLKRST_SET_MIN_V_CLK_RATE 0x153820
// Misc funcs
#define FS_OFFSET_1300_LOCK_MUTEX 0x29690
#define FS_OFFSET_1300_UNLOCK_MUTEX 0x296E0
#define FS_OFFSET_1300_SDMMC_WRAPPER_CONTROLLER_OPEN 0x154500
#define FS_OFFSET_1300_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x154590
// Misc Data
#define FS_OFFSET_1300_SD_MUTEX 0xE133E8
#define FS_OFFSET_1300_NAND_MUTEX 0xE0E768
#define FS_OFFSET_1300_ACTIVE_PARTITION 0xE0E7A8
#define FS_OFFSET_1300_SDMMC_DAS_HANDLE 0xDF6E18
// NOPs
#define FS_OFFSET_1300_SD_DAS_INIT 0x27744
// Nintendo Paths
#define FS_OFFSET_1300_NINTENDO_PATHS \
{ \
{.opcode_reg = 3, .adrp_offset = 0x0006EBE0, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 3, .adrp_offset = 0x0007BEEC, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 4, .adrp_offset = 0x00082294, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 4, .adrp_offset = 0x0009422C, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
}
#endif // __FS_1300_H__
+59
View File
@@ -0,0 +1,59 @@
/*
* 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_1300_EXFAT_H__
#define __FS_1300_EXFAT_H__
// Accessor vtable getters
#define FS_OFFSET_1300_EXFAT_SDMMC_ACCESSOR_GC 0x158C80
#define FS_OFFSET_1300_EXFAT_SDMMC_ACCESSOR_SD 0x15AA90
#define FS_OFFSET_1300_EXFAT_SDMMC_ACCESSOR_NAND 0x1591B0
// Hooks
#define FS_OFFSET_1300_EXFAT_SDMMC_WRAPPER_READ 0x154620
#define FS_OFFSET_1300_EXFAT_SDMMC_WRAPPER_WRITE 0x1546E0
#define FS_OFFSET_1300_EXFAT_RTLD 0x688
#define FS_OFFSET_1300_EXFAT_RTLD_DESTINATION ((uintptr_t)(INT64_C(-0x3C)))
#define FS_OFFSET_1300_EXFAT_CLKRST_SET_MIN_V_CLK_RATE 0x153820
// Misc funcs
#define FS_OFFSET_1300_EXFAT_LOCK_MUTEX 0x29690
#define FS_OFFSET_1300_EXFAT_UNLOCK_MUTEX 0x296E0
#define FS_OFFSET_1300_EXFAT_SDMMC_WRAPPER_CONTROLLER_OPEN 0x154500
#define FS_OFFSET_1300_EXFAT_SDMMC_WRAPPER_CONTROLLER_CLOSE 0x154590
// Misc Data
#define FS_OFFSET_1300_EXFAT_SD_MUTEX 0xE203E8
#define FS_OFFSET_1300_EXFAT_NAND_MUTEX 0xE1B768
#define FS_OFFSET_1300_EXFAT_ACTIVE_PARTITION 0xE1B7A8
#define FS_OFFSET_1300_EXFAT_SDMMC_DAS_HANDLE 0xE03E18
// NOPs
#define FS_OFFSET_1300_EXFAT_SD_DAS_INIT 0x27744
// Nintendo Paths
#define FS_OFFSET_1300_EXFAT_NINTENDO_PATHS \
{ \
{.opcode_reg = 3, .adrp_offset = 0x0006EBE0, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 3, .adrp_offset = 0x0007BEEC, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 4, .adrp_offset = 0x00082294, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 4, .adrp_offset = 0x0009422C, .add_rel_offset = 0x00000004}, \
{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \
}
#endif // __FS_1300_EXFAT_H__
+87 -39
View File
@@ -89,7 +89,7 @@ static void _sdmmc_ensure_initialized(void)
} }
} }
static void _file_based_update_filename(char *outFilename, u32 sd_path_len, u32 part_idx) static void _file_based_update_filename(char *outFilename, unsigned int sd_path_len, unsigned int part_idx)
{ {
snprintf(outFilename + sd_path_len, 3, "%02d", part_idx); snprintf(outFilename + sd_path_len, 3, "%02d", part_idx);
} }
@@ -103,9 +103,7 @@ static void _file_based_emmc_finalize(void)
f_close(&f_emu.fp_boot1); f_close(&f_emu.fp_boot1);
for (int i = 0; i < f_emu.parts; i++) for (int i = 0; i < f_emu.parts; i++)
{
f_close(&f_emu.fp_gpp[i]); f_close(&f_emu.fp_gpp[i]);
}
// Force unmount FAT volume. // Force unmount FAT volume.
f_mount(NULL, "", 1); f_mount(NULL, "", 1);
@@ -114,12 +112,59 @@ static void _file_based_emmc_finalize(void)
} }
} }
static void _nand_patrol_ensure_integrity(void)
{
fs_nand_patrol_t nand_patrol;
static bool nand_patrol_checked = false;
if (!nand_patrol_checked)
{
if (emuMMC_ctx.EMMC_Type == emuMMC_SD_Raw)
{
unsigned int nand_patrol_sector = emuMMC_ctx.EMMC_StoragePartitionOffset + NAND_PATROL_SECTOR;
if (!sdmmc_storage_read(&sd_storage, nand_patrol_sector, 1, &nand_patrol))
goto out;
// Clear nand patrol if last offset exceeds storage.
if (nand_patrol.offset > sd_storage.sec_cnt)
{
memset(&nand_patrol, 0, sizeof(fs_nand_patrol_t));
sdmmc_storage_write(&sd_storage, nand_patrol_sector, 1, &nand_patrol);
}
}
else if (emuMMC_ctx.EMMC_Type == emuMMC_SD_File && fat_mounted)
{
FIL *fp = &f_emu.fp_boot0;
if (f_lseek(fp, NAND_PATROL_OFFSET) != FR_OK)
goto out;
if (f_read_fast(fp, &nand_patrol, sizeof(fs_nand_patrol_t)) != FR_OK)
goto out;
// Clear nand patrol if last offset exceeds total file based size.
if (nand_patrol.offset > f_emu.total_sect)
{
memset(&nand_patrol, 0, sizeof(fs_nand_patrol_t));
if (f_lseek(fp, NAND_PATROL_OFFSET) != FR_OK)
goto out;
if (f_write_fast(fp, &nand_patrol, sizeof(fs_nand_patrol_t)) != FR_OK)
goto out;
f_sync(fp);
}
}
out:
nand_patrol_checked = true;
}
}
void sdmmc_finalize(void) void sdmmc_finalize(void)
{ {
if (!sdmmc_storage_end(&sd_storage)) if (!sdmmc_storage_end(&sd_storage))
{
fatal_abort(Fatal_InitSD); fatal_abort(Fatal_InitSD);
}
storageSDinitialized = false; storageSDinitialized = false;
} }
@@ -137,14 +182,14 @@ static void _file_based_emmc_initialize(void)
memcpy(path + path_len, "BOOT0", 6); memcpy(path + path_len, "BOOT0", 6);
if (f_open(&f_emu.fp_boot0, path, FA_READ | FA_WRITE) != FR_OK) if (f_open(&f_emu.fp_boot0, path, FA_READ | FA_WRITE) != FR_OK)
fatal_abort(Fatal_FatfsFileOpen); fatal_abort(Fatal_FatfsFileOpen);
if (!f_expand_cltbl(&f_emu.fp_boot0, 0x400, f_emu.clmt_boot0, f_size(&f_emu.fp_boot0))) if (!f_expand_cltbl(&f_emu.fp_boot0, EMUMMC_FP_CLMT_COUNT, f_emu.clmt_boot0, f_size(&f_emu.fp_boot0)))
fatal_abort(Fatal_FatfsMemExhaustion); fatal_abort(Fatal_FatfsMemExhaustion);
// Open BOOT1 physical partition. // Open BOOT1 physical partition.
memcpy(path + path_len, "BOOT1", 6); memcpy(path + path_len, "BOOT1", 6);
if (f_open(&f_emu.fp_boot1, path, FA_READ | FA_WRITE) != FR_OK) if (f_open(&f_emu.fp_boot1, path, FA_READ | FA_WRITE) != FR_OK)
fatal_abort(Fatal_FatfsFileOpen); fatal_abort(Fatal_FatfsFileOpen);
if (!f_expand_cltbl(&f_emu.fp_boot1, 0x400, f_emu.clmt_boot1, f_size(&f_emu.fp_boot1))) if (!f_expand_cltbl(&f_emu.fp_boot1, EMUMMC_FP_CLMT_COUNT, f_emu.clmt_boot1, f_size(&f_emu.fp_boot1)))
fatal_abort(Fatal_FatfsMemExhaustion); fatal_abort(Fatal_FatfsMemExhaustion);
// Open handles for GPP physical partition files. // Open handles for GPP physical partition files.
@@ -152,15 +197,14 @@ static void _file_based_emmc_initialize(void)
if (f_open(&f_emu.fp_gpp[0], path, FA_READ | FA_WRITE) != FR_OK) if (f_open(&f_emu.fp_gpp[0], path, FA_READ | FA_WRITE) != FR_OK)
fatal_abort(Fatal_FatfsFileOpen); fatal_abort(Fatal_FatfsFileOpen);
if (!f_expand_cltbl(&f_emu.fp_gpp[0], 0x400, &f_emu.clmt_gpp[0], f_size(&f_emu.fp_gpp[0]))) if (!f_expand_cltbl(&f_emu.fp_gpp[0], EMUMMC_FP_CLMT_COUNT, &f_emu.clmt_gpp[0], f_size(&f_emu.fp_gpp[0])))
fatal_abort(Fatal_FatfsMemExhaustion); fatal_abort(Fatal_FatfsMemExhaustion);
f_emu.part_size = f_size(&f_emu.fp_gpp[0]) >> 9; f_emu.part_size = (uint64_t)f_size(&f_emu.fp_gpp[0]) >> 9;
f_emu.total_sect = f_emu.part_size;
// Iterate folder for split parts and stop if next doesn't exist. // Iterate folder for split parts and stop if next doesn't exist.
// Supports up to 32 parts of any size. for (f_emu.parts = 1; f_emu.parts < EMUMMC_FILE_MAX_PARTS; f_emu.parts++)
// TODO: decide on max parts and define them. (hekate produces up to 30 parts on 1GB mode.)
for (f_emu.parts = 1; f_emu.parts < 32; f_emu.parts++)
{ {
_file_based_update_filename(path, path_len, f_emu.parts); _file_based_update_filename(path, path_len, f_emu.parts);
@@ -173,8 +217,13 @@ static void _file_based_emmc_initialize(void)
return; return;
} }
if (!f_expand_cltbl(&f_emu.fp_gpp[f_emu.parts], 0x400, &f_emu.clmt_gpp[f_emu.parts * 0x400], f_size(&f_emu.fp_gpp[f_emu.parts]))) if (!f_expand_cltbl(&f_emu.fp_gpp[f_emu.parts], EMUMMC_FP_CLMT_COUNT,
&f_emu.clmt_gpp[f_emu.parts * EMUMMC_FP_CLMT_COUNT], f_size(&f_emu.fp_gpp[f_emu.parts])))
{
fatal_abort(Fatal_FatfsMemExhaustion); fatal_abort(Fatal_FatfsMemExhaustion);
}
f_emu.total_sect += (uint64_t)f_size(&f_emu.fp_gpp[f_emu.parts]) >> 9;
} }
} }
@@ -189,7 +238,7 @@ bool sdmmc_initialize(void)
{ {
storageSDinitialized = true; storageSDinitialized = true;
// File based emummc. // Init file based emummc.
if ((emuMMC_ctx.EMMC_Type == emuMMC_SD_File) && !fat_mounted) if ((emuMMC_ctx.EMMC_Type == emuMMC_SD_File) && !fat_mounted)
{ {
if (f_mount(&f_emu.sd_fs, "", 1) != FR_OK) if (f_mount(&f_emu.sd_fs, "", 1) != FR_OK)
@@ -200,6 +249,9 @@ bool sdmmc_initialize(void)
_file_based_emmc_initialize(); _file_based_emmc_initialize();
} }
// Check if nand patrol offset is inside limits.
_nand_patrol_ensure_integrity();
break; break;
} }
@@ -207,9 +259,7 @@ bool sdmmc_initialize(void)
} }
if (!storageSDinitialized) if (!storageSDinitialized)
{
fatal_abort(Fatal_InitSD); fatal_abort(Fatal_InitSD);
}
} }
return storageSDinitialized; return storageSDinitialized;
@@ -239,19 +289,17 @@ sdmmc_accessor_t *sdmmc_accessor_get(int mmc_id)
void mutex_lock_handler(int mmc_id) void mutex_lock_handler(int mmc_id)
{ {
if (custom_driver) if (custom_driver)
{
lock_mutex(sd_mutex); lock_mutex(sd_mutex);
}
lock_mutex(nand_mutex); lock_mutex(nand_mutex);
} }
void mutex_unlock_handler(int mmc_id) void mutex_unlock_handler(int mmc_id)
{ {
unlock_mutex(nand_mutex); unlock_mutex(nand_mutex);
if (custom_driver) if (custom_driver)
{
unlock_mutex(sd_mutex); unlock_mutex(sd_mutex);
}
} }
int sdmmc_nand_get_active_partition_index() int sdmmc_nand_get_active_partition_index()
@@ -271,12 +319,16 @@ int sdmmc_nand_get_active_partition_index()
static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned int num_sectors, bool is_write) static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned int num_sectors, bool is_write)
{ {
if ((emuMMC_ctx.EMMC_Type == emuMMC_SD_Raw)) if (emuMMC_ctx.EMMC_Type == emuMMC_SD_Raw)
{ {
// raw partition sector offset: emuMMC_ctx.EMMC_StoragePartitionOffset. // raw partition sector offset: emuMMC_ctx.EMMC_StoragePartitionOffset.
sector += emuMMC_ctx.EMMC_StoragePartitionOffset; sector += emuMMC_ctx.EMMC_StoragePartitionOffset;
// Set physical partition offset. // Set physical partition offset.
sector += (sdmmc_nand_get_active_partition_index() * BOOT_PARTITION_SIZE); sector += (sdmmc_nand_get_active_partition_index() * BOOT_PARTITION_SIZE);
if (__builtin_expect(sector + num_sectors > sd_storage.sec_cnt, 0))
return 0; // Out of bounds. Can only happen with Nand Patrol if resized.
if (!is_write) if (!is_write)
return sdmmc_storage_read(&sd_storage, sector, num_sectors, buf); return sdmmc_storage_read(&sd_storage, sector, num_sectors, buf);
else else
@@ -290,6 +342,9 @@ static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned
case FS_EMMC_PARTITION_GPP: case FS_EMMC_PARTITION_GPP:
if (f_emu.parts) if (f_emu.parts)
{ {
if (__builtin_expect(sector + num_sectors > f_emu.total_sect, 0))
return 0; // Out of bounds. Can only happen with Nand Patrol if resized.
fp = &f_emu.fp_gpp[sector / f_emu.part_size]; fp = &f_emu.fp_gpp[sector / f_emu.part_size];
sector = sector % f_emu.part_size; sector = sector % f_emu.part_size;
@@ -300,21 +355,21 @@ static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned
while (remaining > 0) { while (remaining > 0) {
const unsigned int cur_sectors = MIN(remaining, f_emu.part_size - sector); const unsigned int cur_sectors = MIN(remaining, f_emu.part_size - sector);
if (f_lseek(fp, (u64)sector << 9) != FR_OK) if (f_lseek(fp, (uint64_t)sector << 9) != FR_OK)
return 0; // Out of bounds. return 0; // Out of bounds.
if (is_write) if (!is_write)
{ {
if (f_write_fast(fp, buf, (u64)cur_sectors << 9) != FR_OK) if (f_read_fast(fp, buf, (uint64_t)cur_sectors << 9) != FR_OK)
return 0; return 0;
} }
else else
{ {
if (f_read_fast(fp, buf, (u64)cur_sectors << 9) != FR_OK) if (f_write_fast(fp, buf, (uint64_t)cur_sectors << 9) != FR_OK)
return 0; return 0;
} }
buf = (char *)buf + ((u64)cur_sectors << 9); buf = (char *)buf + ((uint64_t)cur_sectors << 9);
remaining -= cur_sectors; remaining -= cur_sectors;
sector = 0; sector = 0;
++fp; ++fp;
@@ -324,28 +379,25 @@ static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned
} }
} }
else else
{
fp = &f_emu.fp_gpp[0]; fp = &f_emu.fp_gpp[0];
}
break; break;
case FS_EMMC_PARTITION_BOOT1: case FS_EMMC_PARTITION_BOOT1:
fp = &f_emu.fp_boot1; fp = &f_emu.fp_boot1;
break; break;
case FS_EMMC_PARTITION_BOOT0: case FS_EMMC_PARTITION_BOOT0:
fp = &f_emu.fp_boot0; fp = &f_emu.fp_boot0;
break; break;
} }
if (f_lseek(fp, (u64)sector << 9) != FR_OK) if (f_lseek(fp, (uint64_t)sector << 9) != FR_OK)
return 0; // Out of bounds. return 0; // Out of bounds. Can only happen with Nand Patrol if resized.
uint64_t res = 0;
if (!is_write) if (!is_write)
res = !f_read_fast(fp, buf, (u64)num_sectors << 9); return !f_read_fast(fp, buf, (uint64_t)num_sectors << 9);
else else
res = !f_write_fast(fp, buf, (u64)num_sectors << 9); return !f_write_fast(fp, buf, (uint64_t)num_sectors << 9);
return res;
} }
// Controller open wrapper // Controller open wrapper
@@ -382,9 +434,7 @@ uint64_t sdmmc_wrapper_controller_close(int mmc_id)
if (_this != NULL) if (_this != NULL)
{ {
if (mmc_id == FS_SDMMC_SD) if (mmc_id == FS_SDMMC_SD)
{
return 0; return 0;
}
if (mmc_id == FS_SDMMC_EMMC) if (mmc_id == FS_SDMMC_EMMC)
{ {
@@ -504,8 +554,6 @@ uint64_t sdmmc_wrapper_write(int mmc_id, unsigned int sector, unsigned int num_s
mutex_lock_handler(mmc_id); mutex_lock_handler(mmc_id);
_current_accessor = _this; _current_accessor = _this;
sector += 0;
// Call hekates driver. // Call hekates driver.
if (sdmmc_storage_write(&sd_storage, sector, num_sectors, buf)) if (sdmmc_storage_write(&sd_storage, sector, num_sectors, buf))
{ {
+8 -4
View File
@@ -36,6 +36,9 @@ extern "C" {
#include "../FS/FS.h" #include "../FS/FS.h"
#include "../libs/fatfs/ff.h" #include "../libs/fatfs/ff.h"
#define EMUMMC_FILE_MAX_PARTS 32
#define EMUMMC_FP_CLMT_COUNT 1024
// FS typedefs // FS typedefs
typedef sdmmc_accessor_t *(*_sdmmc_accessor_gc)(); typedef sdmmc_accessor_t *(*_sdmmc_accessor_gc)();
typedef sdmmc_accessor_t *(*_sdmmc_accessor_sd)(); typedef sdmmc_accessor_t *(*_sdmmc_accessor_sd)();
@@ -63,11 +66,12 @@ typedef struct _file_based_ctxt
uint64_t parts; uint64_t parts;
uint64_t part_size; uint64_t part_size;
FIL fp_boot0; FIL fp_boot0;
DWORD clmt_boot0[0x400]; DWORD clmt_boot0[EMUMMC_FP_CLMT_COUNT];
FIL fp_boot1; FIL fp_boot1;
DWORD clmt_boot1[0x400]; DWORD clmt_boot1[EMUMMC_FP_CLMT_COUNT];
FIL fp_gpp[32]; FIL fp_gpp[EMUMMC_FILE_MAX_PARTS];
DWORD clmt_gpp[0x8000]; DWORD clmt_gpp[EMUMMC_FILE_MAX_PARTS * EMUMMC_FP_CLMT_COUNT];
uint64_t total_sect;
} file_based_ctxt; } file_based_ctxt;
#ifdef __cplusplus #ifdef __cplusplus
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -22,14 +22,14 @@ namespace ams::secmon::loader {
class Lz4Uncompressor { class Lz4Uncompressor {
private: private:
const u8 *src; const u8 *m_src;
size_t src_size; size_t m_src_size;
size_t src_offset; size_t m_src_offset;
u8 *dst; u8 *m_dst;
size_t dst_size; size_t m_dst_size;
size_t dst_offset; size_t m_dst_offset;
public: public:
Lz4Uncompressor(void *dst, size_t dst_size, const void *src, size_t src_size) : src(static_cast<const u8 *>(src)), src_size(src_size), src_offset(0), dst(static_cast<u8 *>(dst)), dst_size(dst_size), dst_offset(0) { Lz4Uncompressor(void *dst, size_t dst_size, const void *src, size_t src_size) : m_src(static_cast<const u8 *>(src)), m_src_size(src_size), m_src_offset(0), m_dst(static_cast<u8 *>(dst)), m_dst_size(dst_size), m_dst_offset(0) {
/* ... */ /* ... */
} }
@@ -42,7 +42,7 @@ namespace ams::secmon::loader {
this->Copy(this->GetCopySize(control >> 4)); this->Copy(this->GetCopySize(control >> 4));
/* If we've exceeded size, we're done. */ /* If we've exceeded size, we're done. */
if (this->src_offset >= this->src_size) { if (m_src_offset >= m_src_size) {
break; break;
} }
@@ -55,21 +55,21 @@ namespace ams::secmon::loader {
const size_t wide_copy_size = this->GetCopySize(control & 0xF); const size_t wide_copy_size = this->GetCopySize(control & 0xF);
/* Copy bytes. */ /* Copy bytes. */
const size_t end_offset = this->dst_offset + wide_copy_size + 4; const size_t end_offset = m_dst_offset + wide_copy_size + 4;
for (size_t cur_offset = this->dst_offset; cur_offset < end_offset; this->dst_offset = (++cur_offset)) { for (size_t cur_offset = m_dst_offset; cur_offset < end_offset; m_dst_offset = (++cur_offset)) {
AMS_ABORT_UNLESS(wide_offset <= cur_offset); AMS_ABORT_UNLESS(wide_offset <= cur_offset);
this->dst[cur_offset] = this->dst[cur_offset - wide_offset]; m_dst[cur_offset] = m_dst[cur_offset - wide_offset];
} }
} }
} }
private: private:
u8 ReadByte() { u8 ReadByte() {
return this->src[this->src_offset++]; return m_src[m_src_offset++];
} }
bool CanRead() const { bool CanRead() const {
return this->src_offset < this->src_size; return m_src_offset < m_src_size;
} }
size_t GetCopySize(u8 control) { size_t GetCopySize(u8 control) {
@@ -87,9 +87,9 @@ namespace ams::secmon::loader {
} }
void Copy(size_t size) { void Copy(size_t size) {
__builtin_memcpy(this->dst + this->dst_offset, this->src + this->src_offset, size); __builtin_memcpy(m_dst + m_dst_offset, m_src + m_src_offset, size);
this->dst_offset += size; m_dst_offset += size;
this->src_offset += size; m_src_offset += size;
} }
}; };
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -76,10 +76,10 @@ namespace ams::secmon::fatal {
Bit_Readable = 31, Bit_Readable = 31,
}; };
private: private:
u32 value; u32 m_value;
protected: protected:
constexpr ALWAYS_INLINE u32 SelectBit(Bit n) const { constexpr ALWAYS_INLINE u32 SelectBit(Bit n) const {
return (this->value & (1u << n)); return (m_value & (1u << n));
} }
constexpr ALWAYS_INLINE bool GetBit(Bit n) const { constexpr ALWAYS_INLINE bool GetBit(Bit n) const {
@@ -97,7 +97,7 @@ namespace ams::secmon::fatal {
ALWAYS_INLINE void SetValue(u32 v) { ALWAYS_INLINE void SetValue(u32 v) {
/* Prevent re-ordering around entry modifications. */ /* Prevent re-ordering around entry modifications. */
__asm__ __volatile__("" ::: "memory"); __asm__ __volatile__("" ::: "memory");
this->value = v; m_value = v;
__asm__ __volatile__("" ::: "memory"); __asm__ __volatile__("" ::: "memory");
} }
public: public:
@@ -112,7 +112,7 @@ namespace ams::secmon::fatal {
constexpr ALWAYS_INLINE u32 GetAttributes() const { return this->SelectBit(Bit_NonSecure) | this->SelectBit(Bit_Writeable) | this->SelectBit(Bit_Readable); } constexpr ALWAYS_INLINE u32 GetAttributes() const { return this->SelectBit(Bit_NonSecure) | this->SelectBit(Bit_Writeable) | this->SelectBit(Bit_Readable); }
constexpr ALWAYS_INLINE dd::PhysicalAddress GetPhysicalAddress() const { return (static_cast<u64>(this->value) << DevicePageBits) & PhysicalAddressMask; } constexpr ALWAYS_INLINE dd::PhysicalAddress GetPhysicalAddress() const { return (static_cast<u64>(m_value) << DevicePageBits) & PhysicalAddressMask; }
ALWAYS_INLINE void Invalidate() { this->SetValue(0); } ALWAYS_INLINE void Invalidate() { this->SetValue(0); }
}; };
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -221,7 +221,7 @@ namespace ams::secmon::fatal {
const int prefix_len = std::strlen(automatic_backups_prefix); const int prefix_len = std::strlen(automatic_backups_prefix);
for (size_t i = 0; i + prefix_len < f_ctx->stack_dump_size; ++i) { for (size_t i = 0; i + prefix_len < f_ctx->stack_dump_size; ++i) {
if (std::memcmp(&f_ctx->stack_dump[i], automatic_backups_prefix, prefix_len) == 0) { if (std::memcmp(f_ctx->stack_dump + i, automatic_backups_prefix, prefix_len) == 0) {
suggestion = "The atmosphere directory may improperly have archive bits set.\n" suggestion = "The atmosphere directory may improperly have archive bits set.\n"
"Please try running an archive bit fixer tool (for example, the one in Hekate).\n"; "Please try running an archive bit fixer tool (for example, the one in Hekate).\n";
break; break;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,7 +1,7 @@
/* /*
* Copyright (c) 2018 naehrwert * Copyright (c) 2018 naehrwert
* Copyright (C) 2018 CTCaer * Copyright (C) 2018 CTCaer
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -58,6 +58,7 @@ namespace ams::secmon::fatal {
Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count) { Result ReadSdCard(void *dst, size_t size, size_t sector_index, size_t sector_count) {
/* Validate that our buffer is valid. */ /* Validate that our buffer is valid. */
AMS_ASSERT(size >= sector_count * sdmmc::SectorSize); AMS_ASSERT(size >= sector_count * sdmmc::SectorSize);
AMS_UNUSED(size);
/* Repeatedly read sectors. */ /* Repeatedly read sectors. */
u8 *dst_u8 = static_cast<u8 *>(dst); u8 *dst_u8 = static_cast<u8 *>(dst);
@@ -83,6 +84,7 @@ namespace ams::secmon::fatal {
Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) { Result WriteSdCard(size_t sector_index, size_t sector_count, const void *src, size_t size) {
/* Validate that our buffer is valid. */ /* Validate that our buffer is valid. */
AMS_ASSERT(size >= sector_count * sdmmc::SectorSize); AMS_ASSERT(size >= sector_count * sdmmc::SectorSize);
AMS_UNUSED(size);
/* Repeatedly read sectors. */ /* Repeatedly read sectors. */
const u8 *src_u8 = static_cast<const u8 *>(src); const u8 *src_u8 = static_cast<const u8 *>(src);
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -28,7 +28,7 @@ namespace ams::fs {
}; };
struct ReadOption { struct ReadOption {
u32 value; u32 _value;
static const ReadOption None; static const ReadOption None;
}; };
@@ -36,7 +36,7 @@ namespace ams::fs {
inline constexpr const ReadOption ReadOption::None = {0}; inline constexpr const ReadOption ReadOption::None = {0};
inline constexpr bool operator==(const ReadOption &lhs, const ReadOption &rhs) { inline constexpr bool operator==(const ReadOption &lhs, const ReadOption &rhs) {
return lhs.value == rhs.value; return lhs._value == rhs._value;
} }
inline constexpr bool operator!=(const ReadOption &lhs, const ReadOption &rhs) { inline constexpr bool operator!=(const ReadOption &lhs, const ReadOption &rhs) {
@@ -46,10 +46,10 @@ namespace ams::fs {
static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32)); static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
struct WriteOption { struct WriteOption {
u32 value; u32 _value;
constexpr inline bool HasFlushFlag() const { constexpr inline bool HasFlushFlag() const {
return this->value & 1; return _value & 1;
} }
static const WriteOption None; static const WriteOption None;
@@ -60,7 +60,7 @@ namespace ams::fs {
inline constexpr const WriteOption WriteOption::Flush = {1}; inline constexpr const WriteOption WriteOption::Flush = {1};
inline constexpr bool operator==(const WriteOption &lhs, const WriteOption &rhs) { inline constexpr bool operator==(const WriteOption &lhs, const WriteOption &rhs) {
return lhs.value == rhs.value; return lhs._value == rhs._value;
} }
inline constexpr bool operator!=(const WriteOption &lhs, const WriteOption &rhs) { inline constexpr bool operator!=(const WriteOption &lhs, const WriteOption &rhs) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -85,10 +85,10 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
/* We can get away with only including latest because exosphere supports newer-than-expected master key in engine. */ /* We can get away with only including latest because exosphere supports newer-than-expected master key in engine. */
/* TODO: Update on next change of keys. */ /* TODO: Update on next change of keys. */
/* Mariko Development Master Kek Source. */ /* Mariko Development Master Kek Source. */
.byte 0x75, 0x2D, 0x2E, 0xF3, 0x2F, 0x3F, 0xFE, 0x65, 0xF4, 0xA9, 0x83, 0xB4, 0xED, 0x42, 0x63, 0xBA .byte 0x4D, 0x5A, 0xB2, 0xC9, 0xE9, 0xE4, 0x4E, 0xA4, 0xD3, 0xBF, 0x94, 0x12, 0x36, 0x30, 0xD0, 0x7F
/* Mariko Production Master Kek Source. */ /* Mariko Production Master Kek Source. */
.byte 0xE5, 0x41, 0xAC, 0xEC, 0xD1, 0xA7, 0xD1, 0xAB, 0xED, 0x03, 0x77, 0xF1, 0x27, 0xCA, 0xF8, 0xF1 .byte 0x52, 0x71, 0x9B, 0xDF, 0xA7, 0x8B, 0x61, 0xD8, 0xD5, 0x85, 0x11, 0xE4, 0x8E, 0x4F, 0x74, 0xC6
/* Development Master Key Vectors. */ /* Development Master Key Vectors. */
.byte 0x46, 0x22, 0xB4, 0x51, 0x9A, 0x7E, 0xA7, 0x7F, 0x62, 0xA1, 0x1F, 0x8F, 0xC5, 0x3A, 0xDB, 0xFE /* Zeroes encrypted with Master Key 00. */ .byte 0x46, 0x22, 0xB4, 0x51, 0x9A, 0x7E, 0xA7, 0x7F, 0x62, 0xA1, 0x1F, 0x8F, 0xC5, 0x3A, 0xDB, 0xFE /* Zeroes encrypted with Master Key 00. */
@@ -103,6 +103,7 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
.byte 0x43, 0x3D, 0xC5, 0x3B, 0xEF, 0x91, 0x02, 0x21, 0x61, 0x54, 0x63, 0x8A, 0x35, 0xE7, 0xCA, 0xEE /* Master key 08 encrypted with Master key 09. */ .byte 0x43, 0x3D, 0xC5, 0x3B, 0xEF, 0x91, 0x02, 0x21, 0x61, 0x54, 0x63, 0x8A, 0x35, 0xE7, 0xCA, 0xEE /* Master key 08 encrypted with Master key 09. */
.byte 0x6C, 0x2E, 0xCD, 0xB3, 0x34, 0x61, 0x77, 0xF5, 0xF9, 0xB1, 0xDD, 0x61, 0x98, 0x19, 0x3E, 0xD4 /* Master key 09 encrypted with Master key 0A. */ .byte 0x6C, 0x2E, 0xCD, 0xB3, 0x34, 0x61, 0x77, 0xF5, 0xF9, 0xB1, 0xDD, 0x61, 0x98, 0x19, 0x3E, 0xD4 /* Master key 09 encrypted with Master key 0A. */
.byte 0x21, 0x88, 0x6B, 0x10, 0x9E, 0x83, 0xD6, 0x52, 0xAB, 0x08, 0xDB, 0x6D, 0x39, 0xFF, 0x1C, 0x9C /* Master key 0A encrypted with Master key 0B. */ .byte 0x21, 0x88, 0x6B, 0x10, 0x9E, 0x83, 0xD6, 0x52, 0xAB, 0x08, 0xDB, 0x6D, 0x39, 0xFF, 0x1C, 0x9C /* Master key 0A encrypted with Master key 0B. */
.byte 0x8A, 0xCE, 0xC4, 0x7F, 0xBE, 0x08, 0x61, 0x88, 0xD3, 0x73, 0x64, 0x51, 0xE2, 0xB6, 0x53, 0x15 /* Master key 0B encrypted with Master key 0C. */
/* Production Master Key Vectors. */ /* Production Master Key Vectors. */
.byte 0x0C, 0xF0, 0x59, 0xAC, 0x85, 0xF6, 0x26, 0x65, 0xE1, 0xE9, 0x19, 0x55, 0xE6, 0xF2, 0x67, 0x3D /* Zeroes encrypted with Master Key 00. */ .byte 0x0C, 0xF0, 0x59, 0xAC, 0x85, 0xF6, 0x26, 0x65, 0xE1, 0xE9, 0x19, 0x55, 0xE6, 0xF2, 0x67, 0x3D /* Zeroes encrypted with Master Key 00. */
@@ -117,6 +118,7 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
.byte 0x4D, 0xD9, 0x98, 0x42, 0x45, 0x0D, 0xB1, 0x3C, 0x52, 0x0C, 0x9A, 0x44, 0xBB, 0xAD, 0xAF, 0x80 /* Master key 08 encrypted with Master key 09. */ .byte 0x4D, 0xD9, 0x98, 0x42, 0x45, 0x0D, 0xB1, 0x3C, 0x52, 0x0C, 0x9A, 0x44, 0xBB, 0xAD, 0xAF, 0x80 /* Master key 08 encrypted with Master key 09. */
.byte 0xB8, 0x96, 0x9E, 0x4A, 0x00, 0x0D, 0xD6, 0x28, 0xB3, 0xD1, 0xDB, 0x68, 0x5F, 0xFB, 0xE1, 0x2A /* Master key 09 encrypted with Master key 0A. */ .byte 0xB8, 0x96, 0x9E, 0x4A, 0x00, 0x0D, 0xD6, 0x28, 0xB3, 0xD1, 0xDB, 0x68, 0x5F, 0xFB, 0xE1, 0x2A /* Master key 09 encrypted with Master key 0A. */
.byte 0xC1, 0x8D, 0x16, 0xBB, 0x2A, 0xE4, 0x1D, 0xD4, 0xC2, 0xC1, 0xB6, 0x40, 0x94, 0x35, 0x63, 0x98 /* Master key 0A encrypted with Master key 0B. */ .byte 0xC1, 0x8D, 0x16, 0xBB, 0x2A, 0xE4, 0x1D, 0xD4, 0xC2, 0xC1, 0xB6, 0x40, 0x94, 0x35, 0x63, 0x98 /* Master key 0A encrypted with Master key 0B. */
.byte 0xA3, 0x24, 0x65, 0x75, 0xEA, 0xCC, 0x6E, 0x8D, 0xFB, 0x5A, 0x16, 0x50, 0x74, 0xD2, 0x15, 0x06 /* Master key 0B encrypted with Master key 0C. */
/* Device Master Key Source Sources. */ /* Device Master Key Source Sources. */
.byte 0x8B, 0x4E, 0x1C, 0x22, 0x42, 0x07, 0xC8, 0x73, 0x56, 0x94, 0x08, 0x8B, 0xCC, 0x47, 0x0F, 0x5D /* 4.0.0 Device Master Key Source Source. */ .byte 0x8B, 0x4E, 0x1C, 0x22, 0x42, 0x07, 0xC8, 0x73, 0x56, 0x94, 0x08, 0x8B, 0xCC, 0x47, 0x0F, 0x5D /* 4.0.0 Device Master Key Source Source. */
@@ -128,6 +130,7 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
.byte 0x4A, 0xC3, 0x4E, 0x14, 0x8B, 0x96, 0x4A, 0xD5, 0xD4, 0x99, 0x73, 0xC4, 0x45, 0xAB, 0x8B, 0x49 /* 9.0.0 Device Master Key Source Source. */ .byte 0x4A, 0xC3, 0x4E, 0x14, 0x8B, 0x96, 0x4A, 0xD5, 0xD4, 0x99, 0x73, 0xC4, 0x45, 0xAB, 0x8B, 0x49 /* 9.0.0 Device Master Key Source Source. */
.byte 0x14, 0xB8, 0x74, 0x12, 0xCB, 0xBD, 0x0B, 0x8F, 0x20, 0xFB, 0x30, 0xDA, 0x27, 0xE4, 0x58, 0x94 /* 9.1.0 Device Master Key Source Source. */ .byte 0x14, 0xB8, 0x74, 0x12, 0xCB, 0xBD, 0x0B, 0x8F, 0x20, 0xFB, 0x30, 0xDA, 0x27, 0xE4, 0x58, 0x94 /* 9.1.0 Device Master Key Source Source. */
.byte 0xAA, 0xFD, 0xBC, 0xBB, 0x25, 0xC3, 0xA4, 0xEF, 0xE3, 0xEE, 0x58, 0x53, 0xB7, 0xF8, 0xDD, 0xD6 /* 12.1.0 Device Master Key Source Source. */ .byte 0xAA, 0xFD, 0xBC, 0xBB, 0x25, 0xC3, 0xA4, 0xEF, 0xE3, 0xEE, 0x58, 0x53, 0xB7, 0xF8, 0xDD, 0xD6 /* 12.1.0 Device Master Key Source Source. */
.byte 0xE4, 0xF3, 0x45, 0x6F, 0x18, 0xA1, 0x89, 0xF8, 0xDA, 0x4C, 0x64, 0x75, 0x68, 0xE6, 0xBD, 0x4F /* 13.0.0 Device Master Key Source Source. */
/* Development Device Master Kek Sources. */ /* Development Device Master Kek Sources. */
.byte 0xD6, 0xBD, 0x9F, 0xC6, 0x18, 0x09, 0xE1, 0x96, 0x20, 0x39, 0x60, 0xD2, 0x89, 0x83, 0x31, 0x34 /* 4.0.0 Device Master Kek Source. */ .byte 0xD6, 0xBD, 0x9F, 0xC6, 0x18, 0x09, 0xE1, 0x96, 0x20, 0x39, 0x60, 0xD2, 0x89, 0x83, 0x31, 0x34 /* 4.0.0 Device Master Kek Source. */
@@ -139,6 +142,7 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
.byte 0x61, 0x6A, 0x88, 0x21, 0xA3, 0x52, 0xB0, 0x19, 0x16, 0x25, 0xA4, 0xE3, 0x4C, 0x54, 0x02, 0x0F /* 9.0.0 Device Master Kek Source. */ .byte 0x61, 0x6A, 0x88, 0x21, 0xA3, 0x52, 0xB0, 0x19, 0x16, 0x25, 0xA4, 0xE3, 0x4C, 0x54, 0x02, 0x0F /* 9.0.0 Device Master Kek Source. */
.byte 0x9D, 0xB1, 0xAE, 0xCB, 0xF6, 0xF6, 0xE3, 0xFE, 0xAB, 0x6F, 0xCB, 0xAF, 0x38, 0x03, 0xFC, 0x7B /* 9.1.0 Device Master Kek Source. */ .byte 0x9D, 0xB1, 0xAE, 0xCB, 0xF6, 0xF6, 0xE3, 0xFE, 0xAB, 0x6F, 0xCB, 0xAF, 0x38, 0x03, 0xFC, 0x7B /* 9.1.0 Device Master Kek Source. */
.byte 0xC4, 0xBB, 0xF3, 0x9F, 0xA3, 0xAA, 0x00, 0x99, 0x7C, 0x97, 0xAD, 0x91, 0x8F, 0xE8, 0x45, 0xCB /* 12.1.0 Device Master Kek Source. */ .byte 0xC4, 0xBB, 0xF3, 0x9F, 0xA3, 0xAA, 0x00, 0x99, 0x7C, 0x97, 0xAD, 0x91, 0x8F, 0xE8, 0x45, 0xCB /* 12.1.0 Device Master Kek Source. */
.byte 0x20, 0x20, 0xAA, 0xFB, 0x89, 0xC2, 0xF0, 0x70, 0xB5, 0xE0, 0xA3, 0x11, 0x8A, 0x29, 0x8D, 0x0F /* 13.0.0 Device Master Kek Source. */
/* Production Device Master Kek Sources. */ /* Production Device Master Kek Sources. */
.byte 0x88, 0x62, 0x34, 0x6E, 0xFA, 0xF7, 0xD8, 0x3F, 0xE1, 0x30, 0x39, 0x50, 0xF0, 0xB7, 0x5D, 0x5D /* 4.0.0 Device Master Kek Source. */ .byte 0x88, 0x62, 0x34, 0x6E, 0xFA, 0xF7, 0xD8, 0x3F, 0xE1, 0x30, 0x39, 0x50, 0xF0, 0xB7, 0x5D, 0x5D /* 4.0.0 Device Master Kek Source. */
@@ -150,3 +154,4 @@ _ZN3ams6secmon4boot15VolatileKeyDataE:
.byte 0x03, 0xE7, 0xEB, 0x43, 0x1B, 0xCF, 0x5F, 0xB5, 0xED, 0xDC, 0x97, 0xAE, 0x21, 0x8D, 0x19, 0xED /* 9.0.0 Device Master Kek Source. */ .byte 0x03, 0xE7, 0xEB, 0x43, 0x1B, 0xCF, 0x5F, 0xB5, 0xED, 0xDC, 0x97, 0xAE, 0x21, 0x8D, 0x19, 0xED /* 9.0.0 Device Master Kek Source. */
.byte 0xCE, 0xFE, 0x41, 0x0F, 0x46, 0x9A, 0x30, 0xD6, 0xF2, 0xE9, 0x0C, 0x6B, 0xB7, 0x15, 0x91, 0x36 /* 9.1.0 Device Master Kek Source. */ .byte 0xCE, 0xFE, 0x41, 0x0F, 0x46, 0x9A, 0x30, 0xD6, 0xF2, 0xE9, 0x0C, 0x6B, 0xB7, 0x15, 0x91, 0x36 /* 9.1.0 Device Master Kek Source. */
.byte 0xC2, 0x65, 0x34, 0x6E, 0xC7, 0xC6, 0x5D, 0x97, 0x3E, 0x34, 0x5C, 0x6B, 0xB3, 0x7E, 0xC6, 0xE3 /* 12.1.0 Device Master Kek Source. */ .byte 0xC2, 0x65, 0x34, 0x6E, 0xC7, 0xC6, 0x5D, 0x97, 0x3E, 0x34, 0x5C, 0x6B, 0xB3, 0x7E, 0xC6, 0xE3 /* 12.1.0 Device Master Kek Source. */
.byte 0x77, 0x52, 0x92, 0xF0, 0xAA, 0xE3, 0xFB, 0xE0, 0x60, 0x16, 0xB3, 0x78, 0x68, 0x53, 0xF7, 0xA8 /* 13.0.0 Device Master Kek Source. */
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -94,7 +94,7 @@ namespace ams::secmon::boot {
} }
/* Check that the key generation is one that we can use. */ /* Check that the key generation is one that we can use. */
static_assert(pkg1::KeyGeneration_Count == 12); static_assert(pkg1::KeyGeneration_Count == 13);
if (key_generation >= pkg1::KeyGeneration_Count) { if (key_generation >= pkg1::KeyGeneration_Count) {
return false; return false;
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
@@ -22,7 +22,7 @@ namespace ams::secmon {
constexpr inline uintptr_t PMC = MemoryRegionVirtualDevicePmc.GetAddress(); constexpr inline uintptr_t PMC = MemoryRegionVirtualDevicePmc.GetAddress();
constinit std::atomic_bool g_is_locked = false; constinit util::Atomic<bool> g_is_locked = false;
} }
@@ -72,7 +72,7 @@ namespace ams::secmon {
} }
/* Acquire exclusive access to exception handling logic. */ /* Acquire exclusive access to exception handling logic. */
if (!g_is_locked.exchange(true)) { if (!g_is_locked.Exchange(true)) {
/* Invoke the exception handler impl. */ /* Invoke the exception handler impl. */
ExceptionHandlerImpl(lr, sp); ExceptionHandlerImpl(lr, sp);
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,16 +23,16 @@ namespace ams::secmon {
void *PageMapperImpl::GetPointerTo(uintptr_t phys, size_t size) const { void *PageMapperImpl::GetPointerTo(uintptr_t phys, size_t size) const {
/* Ensure we stay within the page. */ /* Ensure we stay within the page. */
if (util::AlignDown(phys, 4_KB) != this->physical_address) { if (util::AlignDown(phys, 4_KB) != m_physical_address) {
return nullptr; return nullptr;
} }
if (size != 0) { if (size != 0) {
if (util::AlignDown(phys + size - 1, 4_KB) != this->physical_address) { if (util::AlignDown(phys + size - 1, 4_KB) != m_physical_address) {
return nullptr; return nullptr;
} }
} }
return reinterpret_cast<void *>(phys + (this->virtual_address - this->physical_address)); return reinterpret_cast<void *>(phys + (m_virtual_address - m_physical_address));
} }
bool PageMapperImpl::CopyToMapping(uintptr_t dst_phys, const void *src, size_t size) const { bool PageMapperImpl::CopyToMapping(uintptr_t dst_phys, const void *src, size_t size) const {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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,
@@ -22,10 +22,10 @@ namespace ams::secmon {
class PageMapperImpl { class PageMapperImpl {
private: private:
uintptr_t physical_address; uintptr_t m_physical_address;
uintptr_t virtual_address; uintptr_t m_virtual_address;
public: public:
constexpr PageMapperImpl(uintptr_t phys) : physical_address(util::AlignDown(phys, 4_KB)), virtual_address() { /* ... */ } constexpr PageMapperImpl(uintptr_t phys) : m_physical_address(util::AlignDown(phys, 4_KB)), m_virtual_address() { /* ... */ }
void *GetPointerTo(uintptr_t phys, size_t size) const; void *GetPointerTo(uintptr_t phys, size_t size) const;
@@ -37,14 +37,14 @@ namespace ams::secmon {
template<auto F> template<auto F>
bool MapImpl() { bool MapImpl() {
this->virtual_address = F(this->physical_address); m_virtual_address = F(m_physical_address);
return this->virtual_address != 0; return m_virtual_address != 0;
} }
template<auto F> template<auto F>
void UnmapImpl() { void UnmapImpl() {
F(); F();
this->virtual_address = 0; m_virtual_address = 0;
} }
}; };
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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-2020 Atmosphère-NX * Copyright (c) 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,
Loaded 100 of 2888 files, more files were not shown because too many files have changed in this diff. Show more