Commit graph

2141 commits

Author SHA1 Message Date
lynxnb
fed1b8b773 Use actual code size when reporting memory usage
Instead of using the code region size, we now report the correct code memory usage based on code pages that have been allocated.
2024-08-28 01:05:32 +02:00
lynxnb
3250c2d598 Update Dynarmic submodule to 6.7.0 2024-08-27 23:14:29 +02:00
lynxnb
5d36679d62 Perform TLS page address translation for direct accesses
This allows the IPC code to work without modifications since `KThread::tlsRegion` now stores a host address that can be accessed directly.
2024-07-31 00:21:23 +02:00
lynxnb
69fbbe169b Translate guest virtual addresses on direct accesses from SVCs 2024-07-31 00:21:23 +02:00
lynxnb
8e9f268693 Fix incorrect logging call in QueryMemory 2024-07-31 00:21:23 +02:00
lynxnb
4a3705c409 Enable more JIT optimizations and log exceptions 2024-07-31 00:21:23 +02:00
lynxnb
361e36a968 Enable JIT fastmem 2024-07-31 00:21:23 +02:00
lynxnb
965d8145ae Implement exclusive memory writes and exclusive monitor 2024-07-31 00:21:23 +02:00
lynxnb
371349d69f Implement coprocessor 15 accesses 2024-07-31 00:21:22 +02:00
lynxnb
cc585f968e Add a signal handler for JIT threads 2024-05-10 15:12:15 +02:00
lynxnb
ec74ed6c3d Introduce a thread local pointer to the current guest thread
This also gives easier access to the current guest process structure via the thread structure, just like any kernel does for their internal structures.
2024-05-10 15:12:15 +02:00
lynxnb
f7e199e02e Implement GetThreadContext3 SVC for 32bit processes 2024-05-10 15:12:15 +02:00
lynxnb
ce5fb3f729 Support initializing VMM for 32bit address spaces 2024-05-10 15:12:15 +02:00
lynxnb
3c52d9e3c9 Introduce a preemption handler for scheduling with JIT
Scheduler initialization has been delayed until process information is available, as it needs to differentiate between 32bit and 64bit processes.
2024-05-10 15:12:13 +02:00
lynxnb
0d2e9de34e Introduce kernel objects for 32bit processes
This commit introduces two new kernel thread types, `KNceThread` and `Jit32Thread`.
`KNceThread`s behave like the previous kernel thread object by setting up thread state and jumping into guest code.
`KJit32Thread`s need to run guest code on a `JitCore32` object, so they perform the necessary state setup and then they also setup the jit core for executing guest code. A loop was introduced because jit execution might return when halted, either for an SVC or for preemption. In those cases the thread needs to wait to be scheduled before executing again.

The process object has also been updated to be able to create 32bit threads when running 32bit processes.

Additionally NCE's ThreadContext has been removed from DeviceState, since a thread is not an NCE thread only anymore, and IPC code has been changed to retrieve the tls region from the thread object.
2024-05-08 13:44:46 +02:00
lynxnb
537a103f16 Initialize JIT when launching 32bit executables 2024-05-08 13:44:46 +02:00
lynxnb
2777d1ee8f Introduce Jit32 and JitCore32 objects 2024-05-08 13:44:45 +02:00
lynxnb
ab6400d745 Add Dynarmic as a submodule 2024-05-08 13:44:45 +02:00
TheASVigilante
ae1566a482 Fix accidental recursion with trap handling 2024-04-28 20:04:22 +02:00
lynxnb
83111c2ae7 Move memory trapping infrastructure outside of NCE 2024-04-27 16:15:29 +02:00
lynxnb
d5d6e677ca Rework CI to only upload artifacts for PR builds
CI now performs build checks on pushes to the master branch only.
For pull requests, the dev variant of the app is built and artifacts are uploaded for ease of testing and side-by-side installation. PR builds use autogenerated debug signing keys, resulting in different keys being used for each build on purpose to ensure they cannot be installed over each other, avoiding any possible conflict between two PRs.
2024-02-27 23:11:15 +01:00
lynxnb
686a25120b Move SvcTable definition out of header files 2024-02-23 15:06:40 +01:00
lynxnb
18626a4251 Introduce a generic register context for SVCs
`SvcContext` represents a common interface for accessing registers from SVCs, decoupling them from a particular thread context.
2024-02-23 15:06:40 +01:00
lynxnb
80b3b223c8 KProcess: correctly handle empty optional chunk 2024-02-22 08:53:45 +01:00
lynxnb
b51c31dc72 memory: update KMemory to use guest addresses 2024-02-21 15:40:23 +01:00
lynxnb
8addba3273 memory: use guest addresses everywhere
The memory manager has been reworked to handle addresses in the guest address space, and applying an offset to get the address on the host whenever memory needs to be mapped/unmapped/reprotected.
2024-02-21 15:40:05 +01:00
lynxnb
d693cac5da memory: fix insertion at the beginning of the chunks map
The memory manager was incorrectly inserting chunks when the new chunk was being inserted at the beginning of the chunks map (no previous chunk available). The existing chunk was resized to an empty chunk (correctly), but the new chunk was never inserted because of `std::map::insert` skipping insertion on an already existing key.
This resulted in an empty chunk being left at the beginning of the map, causing infinite loops for code that worked by scanning the chunks map.

Usages of `std::map::operator[]` have also been replaced with the safer `insert_or_assign`.
2024-02-21 15:39:48 +01:00
lynxnb
f9f9b6de71 Loader: skip patching non 64-bit executables 2024-02-21 15:17:51 +01:00
lynxnb
bdb4e3fdd8 Loader: make dynsym handling more generic
dynsym is not hardcoded to handle Elf64_Sym only anymore, and a templated ResolveSymbol function has been introduced to easily support Elf32_Sym lookup in the future.
2024-02-21 15:04:44 +01:00
lynxnb
1102f42730 Move symbol hooking setup code out of loader 2024-02-21 15:04:35 +01:00
Pablo González
c87f753893
Make navigation bar transparent (#203) 2024-01-29 17:31:08 +01:00
Niccolò Betto
0b0e48c647
Fix invalid switch-case syntax resulting from nvdrv macro expansion (#242) 2024-01-29 17:19:03 +01:00
Adrien Bouillon
6346c2693c
Add basic support for Google Game Dashboard (#240) 2024-01-29 17:11:05 +01:00
Pablo González
d2b2b0fabe
Add toString to exceptions in Gradle (#241) 2024-01-29 17:10:06 +01:00
Pablo González
f15d0ef22c
Use string resources in ProfilePicturePreference (#198) 2024-01-29 17:09:43 +01:00
Pablo González
b4e763202f
Fix try-catch in save import (#197) 2024-01-29 17:09:29 +01:00
Dubrova Dzmitry
135b7f31c9
Implement info reading from Ro section (#173) 2024-01-13 19:32:38 +01:00
Pablo González
1323259155
Iterate through siblings without recursion in vfs::TraverseDirectory (#205)
Prevents a stack overflow because of recursion depth.
2024-01-05 15:50:14 +01:00
Ishan0981
3fb7f9b81a
Fixed hide invalid files preference title not showing (#231) 2024-01-05 15:41:35 +01:00
lynxnb
2ee8d36b9e Misc Gradle build script cleanup 2024-01-05 02:19:03 +01:00
lynxnb
29d1717ce9 Update CI to use the latest dependencies 2024-01-05 02:19:03 +01:00
lynxnb
557f8ae9c8 Update JVM target to Java 17 2024-01-05 02:19:03 +01:00
lynxnb
91353a8dd8 Update Kotlin to 1.9.22 2024-01-05 02:19:03 +01:00
lynxnb
4c59723149 Update Android dependencies + bump compileSdk to 34 2024-01-05 02:19:03 +01:00
lynxnb
63d17dd9fb Update to Gradle 8.2 + AGP 8.2.1
- Migrated to buildConfig gradle attribute
- Migrated to non-transitive R classes
2024-01-05 02:19:03 +01:00
lynxnb
350f36d52f Remove the LLVM submodule 2024-01-04 17:52:52 +01:00
lynxnb
45aa3945a3 Update NDK to 26.1.10909125
Starting from version 26+, the NDK is based on LLVM 17 and comes with Clang 17 featuring full language and library C++20 support.
This means we can get rid of the massive LLVM submodule in the repo, which will be done in a following commit.
2024-01-04 17:52:52 +01:00
lynxnb
c3f14ba2a7 Remove hasFragileUserData from the app manifest
It was effectively unused, and only caused issues for users, even after proper implementation that enabled it on signed builds only.
2024-01-04 16:40:57 +01:00
lynxnb
da33f10a2a Show the current version in main activity 2024-01-04 16:40:57 +01:00
lynxnb
3fa832c5c9 Introduce proper versioning based on git tags
Version code uses the number of commits until the last tag.
Version name uses the tag name if HEAD is a tag, otherwise it uses the last tag name followed by the branch name and the short commit hash.
2024-01-04 16:40:57 +01:00