JIT services: Difference between revisions
No edit summary |
|||
Line 28: | Line 28: | ||
Both CodeMemory are intended to be optional, however really both are required. | Both CodeMemory are intended to be optional, however really both are required. | ||
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]]. | |||
= IJitEnvironment = | = IJitEnvironment = | ||
Line 54: | Line 56: | ||
The funcptr is called with the following params: x0 = s32* out, x1 = {ptr to output [[#CodeRange]] initialized with the input [[#CodeRange]] and with the second u64 cleared}, x2 = {ptr to output [[#CodeRange]] initialized with the input [[#CodeRange]] and with the second u64 cleared}, x3 = {ptr to struct on stack which is the same as the one used for the "nnjitpluginOnPrepared" symbol, except +0x30/+0x38 is set to data from state}, x4 = cmd input u64, x5 = InBuffer addr, x6 = InBuffer size, x7 = {ptr to input [[#CodeRange]]}, sp0 = {ptr to input [[#CodeRange]]}, sp8 = {ptr to input [[#Struct32]]}, sp16 = cmd input u32, sp24 = OutBuffer addr, sp32 = OutBuffer size. | The funcptr is called with the following params: x0 = s32* out, x1 = {ptr to output [[#CodeRange]] initialized with the input [[#CodeRange]] and with the second u64 cleared}, x2 = {ptr to output [[#CodeRange]] initialized with the input [[#CodeRange]] and with the second u64 cleared}, x3 = {ptr to struct on stack which is the same as the one used for the "nnjitpluginOnPrepared" symbol, except +0x30/+0x38 is set to data from state}, x4 = cmd input u64, x5 = InBuffer addr, x6 = InBuffer size, x7 = {ptr to input [[#CodeRange]]}, sp0 = {ptr to input [[#CodeRange]]}, sp8 = {ptr to input [[#Struct32]]}, sp16 = cmd input u32, sp24 = OutBuffer addr, sp32 = OutBuffer size. | ||
The input/output [[#CodeRange]] structs are validated as follows, where stateval is | The input/output [[#CodeRange]] structs are validated as follows, where stateval is the first/second CodeMemory [[#CreateJitEnvironment|size]] for the first/second [[#CodeRange]]: | ||
* CodeRange.offset must be 0x4-byte aligned. | * CodeRange.offset must be 0x4-byte aligned. | ||
* CodeRange.offset must be <= stateval-CodeRange.size. | * CodeRange.offset must be <= stateval-CodeRange.size. | ||
Line 94: | Line 96: | ||
== GetCodeAddress == | == GetCodeAddress == | ||
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]]. | |||
== CodeRange == | == CodeRange == |