Hi Dan, thanks for the review!
[…]
>
>> +static void
>> +issue_store_multiple(u8 *command_stream, uint64_t kernel_va, uint32_t
>> constant)
>> +{
>> + uint64_t opcode, reg_num, mov48, store_multiple, flush;
>> + uint64_t sr, src0, register_bitmap, offset;
>> +
>> + // MOV48: Load the source register ([r68; r69]) with the
>> kernel address
>> + opcode = 0x1;
>> + reg_num = 68;
>> + mov48 = (opcode << 56) | (reg_num << 48) | kernel_va;
>> + mov48 = htole64(mov48);
>> + memcpy(&command_stream[0], &mov48, sizeof(mov48));
>> +
>> + // MOV48: Load a known constant into r70
>> + opcode = 0x1;
>> + reg_num = 70;
>> + mov48 = (opcode << 56) | (reg_num << 48) | constant;
>> + mov48 = htole64(mov48);
>> + memcpy(&command_stream[8], &mov48, sizeof(mov48));
>> +
>> + // STORE_MULTIPLE: Store the first register to the address
>> pointed to by [r68; r69]
>> + opcode = 0x15; // STORE_MULTIPLE
>> + sr = 70; // Starting from register r70
>> + src0 = 68; // Address pointed to by [r68; r69]
>> + register_bitmap = 1; // Store the first register
>> + offset = 0; // Offset
>> + store_multiple = (opcode << 56) | (sr << 48) | (src0 << 40) |
>> +
>> (register_bitmap << 16) | offset;
>> + store_multiple = htole64(store_multiple);
>> + memcpy(&command_stream[16], &store_multiple,
>> sizeof(store_multiple));
>
> // MOV48 r68, 0 on the below?
Wdym? / Why?
I want to clarify what you mean here because it was a bit tricky to get this to
work, so I am trying to be really mindful about any changes so that it
doesn’t break.
>
>> + opcode = 0x1;
>> + reg_num = 68;
>> + mov48 = (opcode << 56) | (reg_num << 48) | 0;
>> + mov48 = htole64(mov48);
>> + memcpy(&command_stream[24], &mov48, sizeof(mov48));
>
> // FLUSH_PAGES?
You want this comment to be present here?
>
>> + opcode = 36;
>> + flush = opcode << 56 | 0ull << 48 | reg_num << 40 | 0ull <<
>> 16 | 0x233;
>> + flush = htole64(flush);
>> + memcpy(&command_stream[32], &flush, sizeof(flush));
>> +}
>