Commit graph

463 commits

Author SHA1 Message Date
Michael Scire
406320f6ec kern: better divide non-secure size, don't waste fatal memory unless necessary 2023-02-22 17:19:51 -08:00
Michael Scire
04c9004e05 erpt: fix multiple issues with automatic report cleanup (thanks @yellows8)
* Setting retrieval was performed before the call that used the setting.
* Call to detect number of files passed incomplete path and was guaranteed to fail.
* Call to delete reports passed incomplete path and was guaranteed to do nothing.
2022-12-13 01:08:13 -07:00
Michael Scire
8ce4f19615 ncm: update enums, refactor comparison operators 2022-10-18 11:10:17 -07:00
Michael Scire
d178ea368a lr: new AOC commands use MapAlias for paths... 2022-10-12 09:15:16 -07:00
Michael Scire
5ee7d8a5ed kern: update for new device map semantics 2022-10-12 09:15:16 -07:00
Michael Scire
d00406e089 os: update os namespace for 15.0.0, loader/ro: update to use csrng, spl: bump max sessions 2022-10-12 09:15:16 -07:00
Michael Scire
dddb5bfdea boot2: launch new eth sysmodule after bsdsockets 2022-10-12 09:15:16 -07:00
Michael Scire
ed0572bd53 erpt: update IDs for 15.0.0 2022-10-12 09:15:16 -07:00
Michael Scire
427130a122 ncm: update for new add on content/attr changes 2022-10-12 09:15:16 -07:00
Michael Scire
e1aff401ba lr: add support for location resolver disable commands 2022-10-12 09:15:16 -07:00
Michael Scire
05de5538d6 ncm: GetContentAccessibilities, GetContentInfo* 2022-10-12 09:15:16 -07:00
Michael Scire
545765d167 ams/fuse: update version numbers, update DramId read logic 2022-10-12 09:15:16 -07:00
Michael Scire
d954e85826 fs/emummc: fix DirectoryRedirectionFileSystem not stripping prefix 2022-08-06 08:48:51 -07:00
Michael Scire
d75f9bbedf fs: add extension GetEntryList to AesCtrCounterExtendedStorage 2022-06-11 16:54:02 -07:00
Michael Scire
a65b6df8d2 os: implement MemoryHeapManager, SetMemoryAttribute 2022-06-10 22:36:03 -07:00
Michael Scire
a975689c59 ams: address some warnings when building with gcc-12 2022-06-05 22:57:08 -07:00
Michael Scire
4db485083b strat: update for code changes found in boot (closes #1797) 2022-05-05 17:45:55 -07:00
Michael Scire
3545c0aac2 ams: fs accuracy fixes, bump to 1.3.2 2022-04-29 16:14:01 -07:00
Michael Scire
c2c0a2e169 ro/os: use os primitives for MapProcessCodeMemory 2022-04-18 01:39:22 -07:00
Michael Scire
f5052b4bca loader: update for changes in 14.0.0 2022-04-17 20:11:05 -07:00
Michael Scire
70d67bb115 loader: use os apis for interacting with process memory 2022-04-17 18:51:36 -07:00
Michael Scire
9056e0b05f strat: fix linux clang build 2022-04-17 14:01:03 -07:00
Michael Scire
b45671fd35 fs: QueryEntry uses NonSecure buffers 2022-04-08 11:23:39 -07:00
Michael Scire
106599895d fs: fix memory leak when path is reallocated (closes #1842) 2022-04-08 11:02:17 -07:00
Michael Scire
72baa4ff18 ams: add enum recognition for 14.1.0 2022-04-04 17:44:56 -07:00
Michael Scire
d7f89a0c31 fs: update signature for VerifySign1 2022-04-01 21:06:26 -07:00
Michael Scire
2e6223d9d0 fssystem: add unique lock apis 2022-03-28 14:29:22 -07:00
Michael Scire
28f11a86fd fs: update romfs types 2022-03-28 13:57:06 -07:00
Michael Scire
9b47ddf01f fs: update LocalFileSystem 2022-03-28 01:33:40 -07:00
Michael Scire
0fbf007bcf fs: fixup all OperateRange implementations 2022-03-28 00:54:10 -07:00
Michael Scire
4ad8dad416 os: add DetachIoRegionHandle 2022-03-28 00:00:36 -07:00
Michael Scire
8e258bde9d util: LockFreeAtomicType (for time) 2022-03-27 20:15:10 -07:00
Michael Scire
c0d5140ef0 strat: add windows socket api, linux/macos TODO 2022-03-27 14:36:31 -07:00
Michael Scire
bbf22b4c60 ams: globally prefer R_RETURN to return for ams::Result 2022-03-26 14:48:33 -07:00
Michael Scire
dd78ede99f ams: use R_SUCCEED, R_THROW globally 2022-03-26 00:14:36 -07:00
Michael Scire
a4a2cc2218 fs: update IStorage::Check functions for 14.0.0 2022-03-25 23:29:36 -07:00
Michael Scire
ec44eaa263 fs: update nca drivers (and dependents/callees) for 14.0.0 changes 2022-03-25 09:48:24 -07:00
Michael Scire
20e53fcd82 fs: update HashGeneratorFactorySelector to reflect 14.0.0 2022-03-24 21:57:37 -07:00
SciresM
64c6ef2de7
fs: reduce path size 0x28 -> 0x18
This implements two optimizations on fs::Path, which N added in 12.0.0.

The current structure looks like: 

```cpp
struct Path {
    const char *m_str; // Points to the read-only path string
    char *m_write_buffer_buffer; // Part of std::unique_ptr<char[], ams::fs::impl::Deleter>
    ams::fs::impl::Deleter m_write_buffer_deleter; // Parse of std::unique_ptr<char[], ams::fs::impl::Deleter>, stores the size of the buffer.
    size_t m_write_buffer_length; // Copy of the write buffer's size accessible to the Path() structure.
    bool m_is_normalized; // Whether the path buffer is normalized
};
```

This is pretty wasteful. The write buffer size is stored twice, wasting 8 bytes, because one copy of the size isn't accessible to the path.

In addition, due to alignment, the bool wastes 7 padding bytes.

This commit:

* Encodes normalized in the low bit of the write buffer length, saving 8 bytes.
* Use a custom WriteBuffer class rather than generic unique_ptr, to avoid needing to store the WriteBuffer twice.


These each save 8 bytes, for a final size of 0x18 rather than 0x28.
2022-03-24 20:22:47 -07:00
Michael Scire
dfa475a769 util: add pointer utils, use to constrain fs pointers 2022-03-24 16:21:03 -07:00
Michael Scire
141ae5c7ab fs: fix removed include 2022-03-24 13:31:49 -07:00
Michael Scire
4646581e93 fs: for my sanity, begin tracking version where code was last checked for accuracy 2022-03-24 08:43:40 -07:00
Michael Scire
6f54ab5716 fs: fix out of bounds access when parsing directory paths 2022-03-23 13:38:34 -07:00
Michael Scire
a89c5dd5d7 ncm: hot take, uninitialized data bad 2022-03-23 09:10:50 -07:00
Michael Scire
07f91f0a83 boot2: launch omm before am 2022-03-23 09:10:50 -07:00
Michael Scire
247852db3a pm: hook up the new libnx apis 2022-03-23 09:10:50 -07:00
Michael Scire
74fddf667a pm: loosen restriction on resource limit boost 2022-03-23 09:10:50 -07:00
Michael Scire
027242e909 erpt: update id map 2022-03-23 09:10:50 -07:00
Michael Scire
3579797309 sf: add new debug-interface-id in cmif out header 2022-03-23 09:10:50 -07:00
Michael Scire
fa98bf9434 libstrat: misc fixes for unused arg warnings 2022-03-23 09:10:50 -07:00
Michael Scire
e975784179 fatal: update for new 14.0.0 command 2022-03-23 09:10:50 -07:00
Michael Scire
e05df99342 pm/kern: update for 14.0.0 2022-03-23 09:10:50 -07:00
Michael Scire
588d761615 exo/fusee: first pass at updating enums for 14.0.0 2022-03-23 09:10:50 -07:00
Michael Scire
320a946fc7 ncm: update client code to better reflect latest sysupdate 2022-03-21 17:21:44 -07:00
Michael Scire
ca142889c4 strat: only include windows.h in translation units where actually needed 2022-03-21 17:21:44 -07:00
Michael Scire
c35114bacc fs: utilities for hac2l to print gc headers 2022-03-21 17:21:44 -07:00
Michael Scire
2d984822c6 fs: add gc validation wrappers for hac2l 2022-03-21 17:21:44 -07:00
Michael Scire
32d443977e fs: add indirection to raw storage open, for hac2l 2022-03-21 17:21:44 -07:00
Michael Scire
741efd04ec strat: minor result/overflow check fixes 2022-03-21 17:21:44 -07:00
Michael Scire
e13b81aa9e fs: revise allocation-fail result names 2022-03-21 17:21:44 -07:00
Michael Scire
11e4bed199 strat: revise fs unsupported operation results, add overflow utils 2022-03-21 17:21:44 -07:00
Michael Scire
ba4e7c5866 fs: fix inverted alignment determination in compressed storage 2022-03-21 17:21:44 -07:00
Michael Scire
da1b24b9b5 fs: fix locking in FileSystemBufferManager 2022-03-21 17:21:44 -07:00
Michael Scire
cb3d20ef79 fs: fix clang-build, os: StackGuardManager 2022-03-21 17:21:44 -07:00
Michael Scire
be9338eb33 fs: move bitmap classes out of save:: 2022-03-21 17:21:44 -07:00
Michael Scire
7a69723021 fs: fix missing mutex acquire in compressed storage invalidate/find 2022-03-21 17:21:44 -07:00
Michael Scire
d638bbbb62 fs: first pass at compressed storage (works on iridium with wip hac2l code) 2022-03-21 17:21:44 -07:00
Michael Scire
df631d74f0 fssrv: add ExternalKeyManager (rights-id crypto) for hac2l 2022-03-21 17:21:44 -07:00
Michael Scire
646f84bad1 abort/error: print backtrace, abuse templates, overhaul result/diag (macos not done yet) 2022-03-21 17:21:44 -07:00
Michael Scire
13697fa921 libs: add ongoing work to facilitate hactool rewrite 2022-03-21 17:21:44 -07:00
Michael Scire
706b8492fd libs: begin adding capacity for doing crypto on generic os (using externally-preset keys) 2022-03-21 17:21:44 -07:00
Michael Scire
64a97576d0 ams: support building unit test programs on windows/linux/macos 2022-03-21 17:21:44 -07:00
Michael Scire
9a38be201a erpt: add automatic report cleanup mechanism on boot (closes #1795) 2022-03-17 00:31:38 -07:00
Michael Scire
2b6719ec25 ams_mitm: update to use new NcaFileSystemDriver intf 2022-02-21 15:17:17 -08:00
Michael Scire
3f6010b4dc fix SubStorage copy ctor/= op for new shared_ptr member 2022-02-21 15:17:17 -08:00
Michael Scire
01f7f567b9 fs: add Sha256HashGenerator, LZ4 decompressor 2022-02-21 15:17:17 -08:00
Michael Scire
a2aec363d7 fs: remove now unused StorageOption 2022-02-21 15:17:17 -08:00
Michael Scire
52296fc2dd fs: revise NcaFileSystemDriver for latest semantics 2022-02-21 15:17:17 -08:00
Michael Scire
ccf29a1302 fssystem: revise allocator logic for latest semantics 2022-02-21 15:17:17 -08:00
Michael Scire
28ea6555f8 fssrv: flesh out the program registry 2022-02-21 15:17:17 -08:00
Michael Scire
e8d14eb77d fssrv: skeleton more program registry logic 2022-02-21 15:17:17 -08:00
Michael Scire
33701bb387 fssrv: add skeleton getters for service object sf::SharedPointers 2022-02-21 15:17:17 -08:00
Michael Scire
f3dbdc2391 fs: allocations with mutex held must be unsafe 2022-02-21 15:17:17 -08:00
Michael Scire
64b4cc25fc fs: implement newer allocator templates 2022-02-21 15:17:17 -08:00
Michael Scire
ace409ccec fssrv: skeleton server manager setup/registration 2022-02-21 15:17:17 -08:00
Michael Scire
0e08aa0a31 fssrv: add placeholder for ipc interface 2022-02-21 15:17:17 -08:00
Michael Scire
94de5bf4f4 fs: add skeleton dir for sysmodule code
Please note this isn't likely to immediately be the active ams project.
2022-02-21 15:17:17 -08:00
SciresM
96f95b9f95
Integrate new result macros. (#1780)
* result: try out some experimental shenanigans

* result: sketch out some more shenanigans

* result: see what it looks like to convert kernel to use result conds instead of guards

* make rest of kernel use experimental new macro-ing
2022-02-14 14:45:32 -08:00
Michael Scire
4efa5d7dd0 ams: first attempt at 13.2.1 support 2022-01-19 16:28:32 -08:00
Michael Scire
30fac905af ams: deduplicate static initialization logic 2021-12-13 13:07:03 -08:00
Michael Scire
09c6aa29dd sf/cmif: optimize dispatch table walk to use binary search over linear search 2021-12-06 13:13:46 -08:00
Michael Scire
ddfc16731f ams/hos: add enum support for 13.2.0 2021-11-30 16:22:57 -08:00
Michael Scire
fcc7ce49d9 sm/tipc: ensure technical-correctness of sins (no page cost) 2021-11-06 20:05:32 -07:00
Michael Scire
f98c7cba98 sm: save 0x5000 of memory by sinning 2021-11-06 19:33:08 -07:00
Léo Lam
496adb0018
Minor header fixes to reduce parsing issues with Clang (#1700)
* Work around Clang's incomplete C++20 support for omitting typename

* vapours: fix Clang error about missing return in constexpr function

* stratosphere: fix call to non-constexpr strlen in constexpr function

strlen being constexpr is a non-compliant GCC extension; Clang
explicitly rejects it: https://reviews.llvm.org/D23692

* stratosphere: add a bunch of missing override specifiers

* stratosphere: work around Clang consteval bug

Minimal example: https://godbolt.org/z/MoM64v93M

The issue seems to be that Clang does not consider f(x) to be a
constant expression if x comes from a template argument that isn't
a non-type auto template argument (???)

We can work around this by relaxing GetMessageHeaderForCheck (by using
constexpr instead of consteval). This produces no functional changes
because the result of GetMessageHeaderForCheck() is assigned to a
constexpr variable, so the result is guaranteed to be computed
at compile-time.

* stratosphere: fix missing require clauses in definitions

GCC not requiring the require clauses to be repeated for member
definitions is actually a compiler bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96830

Clang rejects declarations with missing require clauses.

* Fix ALWAYS_INLINE_LAMBDA and parameter list relative order

While GCC doesn't seem to care about the position of the always_inline
attribute relative to the parameter list, Clang is very picky
and requires the attribute to appear after the parameter list
(and before a trailing return type)

* stratosphere: fix static constexpr member variable with incomplete type

GCC accepts this for some reason (because of the lambda?) but Clang
correctly rejects this.
2021-11-06 18:19:34 -07:00
Michael Scire
47218f0da8 ams: overhaul fs.mitm romfs ownership, bump to 1.2.4 2021-11-04 13:38:41 -07:00
Michael Scire
4489513f7c dmnt: enable experimental standalone usage of gdbstub, while starlink is in dev 2021-11-03 23:56:25 -07:00
Michael Scire
6cf5205a28 spl: fix legacy physical keyslot compatibility 2021-10-30 11:21:25 -07:00
Michael Scire
0a58e803be kern/test: add wip qemu-virt board support to mesosphere 2021-10-25 17:31:14 -07:00
Michael Scire
889d843718 ams: improve offsetof style consistency 2021-10-18 00:17:13 -07:00