Changes

Jump to navigation Jump to search
517 bytes added ,  05:49, 26 February 2023
no edit summary
Line 27: Line 27:  
This essentially does state/object init and maps the CodeMemory regions in the user-process. The permissions for the first CodeMemory is R-X, for the second CodeMemory it's R--. Both CodeMemory are mapped in the sysmodule with permissions RW-.
 
This essentially does state/object init and maps the CodeMemory regions in the user-process. The permissions for the first CodeMemory is R-X, for the second CodeMemory it's R--. Both CodeMemory are mapped in the sysmodule with permissions RW-.
   −
Both CodeMemory are intended to be optional, however really both are required.
+
Both CodeMemory are optional. Handling for size=0 was originally broken, this was [[Switch_System_Flaws|fixed]] with [14.0.0+].
    
This copies the user-process CodeMemory addr/size for each CodeMemory to elsewhere in state, however it uses the first CodeMemory for the second CodeMemory state init as well. This is the same state used by [[#GenerateCode]] and [[#GetCodeAddress]].
 
This copies the user-process CodeMemory addr/size for each CodeMemory to elsewhere in state, however it uses the first CodeMemory for the second CodeMemory state init as well. This is the same state used by [[#GenerateCode]] and [[#GetCodeAddress]].
Line 49: Line 49:  
== GenerateCode ==
 
== GenerateCode ==
 
Takes an u32, an u64, a [[#CodeRange]], a [[#CodeRange]], a [[#Struct32]], a type-0x5 input buffer, a type-0x6 output buffer, and returns an output s32, a [[#CodeRange]], a [[#CodeRange]].
 
Takes an u32, an u64, a [[#CodeRange]], a [[#CodeRange]], a [[#Struct32]], a type-0x5 input buffer, a type-0x6 output buffer, and returns an output s32, a [[#CodeRange]], a [[#CodeRange]].
 +
 +
sdknso copies data from an user-buffer to the tmp [[#Struct32]] which is used with the cmd, the size of that user-buffer is passed as the cmd input u32.
    
An error is thrown if the funcptr in state for the "nnjitpluginGenerateCode" symbol is not set.
 
An error is thrown if the funcptr in state for the "nnjitpluginGenerateCode" symbol is not set.
Line 67: Line 69:  
* in_CodeRange.size must be >= out_CodeRange.size.
 
* in_CodeRange.size must be >= out_CodeRange.size.
 
* (out_CodeRange.offset-in_CodeRange.offset) must be <= (in_CodeRange.size-out_CodeRange.size).
 
* (out_CodeRange.offset-in_CodeRange.offset) must be <= (in_CodeRange.size-out_CodeRange.size).
 +
 +
After using the cmd, sdknso runs cache operations.
    
== Control ==
 
== Control ==
Line 97: Line 101:  
No input, returns two output u64s which are loaded from state.
 
No input, returns two output u64s which are loaded from state.
   −
These u64s are the user-process map-addrs for each CodeMemory from [[#CreateJitEnvironment|state]].
+
These u64s are the user-process map-addrs for each CodeMemory from [[#CreateJitEnvironment|state]]. Originally the second addr was a duplicate of the first addr, this was [[Switch_System_Flaws|fixed]] with [14.0.0+].
    
== CodeRange ==
 
== CodeRange ==
Line 115: Line 119:  
== Struct32 ==
 
== Struct32 ==
 
This is "nn::jitsrv::Struct32". This is a 0x20-byte struct. This is 8-byte aligned.
 
This is "nn::jitsrv::Struct32". This is a 0x20-byte struct. This is 8-byte aligned.
 +
 +
This contains arbitrary plugin-specific input data which is passed to the [[#GenerateCode]] funcptr.
    
= Title usage =
 
= Title usage =
Line 120: Line 126:     
* [[Super Mario 3D All-Stars]] (N64 emulation only)
 
* [[Super Mario 3D All-Stars]] (N64 emulation only)
 +
* [[Nintendo 64 - Nintendo Switch Online]]

Navigation menu