Difference between revisions of "JIT services"

From Nintendo Switch Brew
Jump to navigation Jump to search
(fix swapped cmds)
Line 1: Line 1:
JIT is a sysmodule for run-time code generation on development kits (allowing for overlapping R-X and RW- views of memory). This system module is not present in retail units.
+
JIT is a sysmodule for run-time code generation (allowing for overlapping R-X and RW- views of memory). This was added to retail with [10.0.0+]. This was also supported in sdknso for a number of versions prior.
 +
 
 +
nnMain just initializes [[RO_services|ro:1]], then starts hosting the service from the main-thread with max_sessions=1 (threads are not created for service-hosting).
 +
 
 +
This is intended to only be used by Applications. The initialization in sdknso uses [[Applet_Manager_services#PrepareForJit|PrepareForJit]] at the start. sdknso later uses [[SVC|svcCreateCodeMemory]].
 +
 
 +
This loads the user-specified [[NRO]] into sysmodule-context ("DllPlugin"), and calls various symbols from that NRO. It seems the code writing (in cmd GenerateCode) is done via symbol-calling, allowing the NRO to handle input_buffer->code translation+writing.
  
 
= jit:u =
 
= jit:u =

Revision as of 14:48, 15 April 2020

JIT is a sysmodule for run-time code generation (allowing for overlapping R-X and RW- views of memory). This was added to retail with [10.0.0+]. This was also supported in sdknso for a number of versions prior.

nnMain just initializes ro:1, then starts hosting the service from the main-thread with max_sessions=1 (threads are not created for service-hosting).

This is intended to only be used by Applications. The initialization in sdknso uses PrepareForJit at the start. sdknso later uses svcCreateCodeMemory.

This loads the user-specified NRO into sysmodule-context ("DllPlugin"), and calls various symbols from that NRO. It seems the code writing (in cmd GenerateCode) is done via symbol-calling, allowing the NRO to handle input_buffer->code translation+writing.

jit:u

This is "nn::jitsrv::IJitService".

Cmd Name Notes
0 CreateJitEnvironment Returns an #IJitEnvironment

IJitEnvironment

This is "nn::jitsrv::IJitEnvironment".

Cmd Name
0 GenerateCode
1 Control
1000 LoadPlugin
1001 GetCodeAddress