JIT services: Difference between revisions

No edit summary
No edit summary
Line 51: Line 51:


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 separate for the first/second [[#CodeRange]]:
* CodeRange.offset must be 0x4-byte aligned.
* CodeRange.offset must be <= stateval-CodeRange.size.
* stateval must be >= CodeRange.size.
* CodeRange.size must be <= ~CodeRange.offset.
* CodeRange.size must be 0x4-byte aligned.
The output [[#CodeRange]] structs are validated the same way as the corresponding input [[#CodeRange]] structs, however in addition the output structs are validated against the input structs:
* out_CodeRange.offset must be >= in_CodeRange.offset.
* in_CodeRange.size must be >= out_CodeRange.size.
* (out_CodeRange.offset-in_CodeRange.offset) must be <= (in_CodeRange.size-out_CodeRange.size).


== Control ==
== Control ==
Line 83: Line 95:
== CodeRange ==
== CodeRange ==
This is "nn::jit::CodeRange". This is a 0x10-byte struct. This is 8-byte aligned.
This is "nn::jit::CodeRange". This is a 0x10-byte struct. This is 8-byte aligned.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x8 || Offset
|-
| 0x8 || 0x8 || Size
|}


== 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.