Changes

177 bytes added ,  00:10, 25 April 2019
Line 1,034: Line 1,034:  
argdata in the subcommand is initialized as follows: <code>((u8*)cmd_argdata)[pos] = u8_in[pos2] | u8_in[pos3]<<4;</code> Hence, 4bits from pairs of 2-bytes of the input struct are combined to write to the subcommand. Only the low 4bits of each used byte in the struct is used. This is written to stack initially, then copied to the actual cmd_argdata (the data immediately following the subcommandID byte). There's a total of 0x1B-bytes of cmd_argdata initialized from this.
 
argdata in the subcommand is initialized as follows: <code>((u8*)cmd_argdata)[pos] = u8_in[pos2] | u8_in[pos3]<<4;</code> Hence, 4bits from pairs of 2-bytes of the input struct are combined to write to the subcommand. Only the low 4bits of each used byte in the struct is used. This is written to stack initially, then copied to the actual cmd_argdata (the data immediately following the subcommandID byte). There's a total of 0x1B-bytes of cmd_argdata initialized from this.
   −
The 0xB-bytes at cmd_argdata+0x1B is cleared. The u64 at cmd_argdata+0x2B is set to an input value which is hard-coded 0. u16 +0x33 is set to 0. u8 +0x35 is set to 1.
+
The layout of cmd_argdata is as follows:
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x1B || See above.
 +
|-
 +
| 0x1B || 0xB || Cleared to zero.
 +
|-
 +
| 0x26 || 0x5 || Unused
 +
|-
 +
| 0x2B || 0x8 || Set to an input value, which is hard-coded 0.
 +
|-
 +
| 0x33 || 0x2 || Set to value 0.
 +
|-
 +
| 0x35 || 0x1 || Set to value 1.
 +
|}
    
= hid:tmp =
 
= hid:tmp =