Fix output writing and memory init
This commit is contained in:
parent
563efb1bc9
commit
7bf5e50426
@ -136,12 +136,11 @@ int main(int argc, char **argv)
|
|||||||
// load input
|
// load input
|
||||||
// cpu_physical_memory_rw(target_addr, buffer, read_len, true);
|
// cpu_physical_memory_rw(target_addr, buffer, read_len, true);
|
||||||
|
|
||||||
int task_inputs[num_tasks];
|
u_int32_t task_inputs[num_tasks];
|
||||||
|
|
||||||
fclose(fopen(output_path, "w"));
|
fclose(fopen(output_path, "w"));
|
||||||
|
|
||||||
FILE *fptr = fopen(output_path, "a");
|
FILE *fptr = fopen(output_path, "a");
|
||||||
|
|
||||||
|
|
||||||
// input of all tasks combined
|
// input of all tasks combined
|
||||||
for (long i = 0; i < full_input_room; i++)
|
for (long i = 0; i < full_input_room; i++)
|
||||||
@ -151,7 +150,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// from the "global input" i, extract the input bits for the task j
|
// from the "global input" i, extract the input bits for the task j
|
||||||
task_inputs[j] = (i >> (j * (__builtin_popcount(input_size - 1)))) & (input_size - 1);
|
task_inputs[j] = (i >> (j * (__builtin_popcount(input_size - 1)))) & (input_size - 1);
|
||||||
printf("Task %d: %d\n", j, task_inputs[j]);
|
printf("Task %d: %d\n", j + 1, task_inputs[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the system in the halted state at the beginning of the task; Write input to register
|
// load the system in the halted state at the beginning of the task; Write input to register
|
||||||
@ -164,6 +163,9 @@ int main(int argc, char **argv)
|
|||||||
// printf("reg count: %d\n", libafl_qemu_num_regs(cpu));
|
// printf("reg count: %d\n", libafl_qemu_num_regs(cpu));
|
||||||
for (int j = 0; j < num_tasks; j++)
|
for (int j = 0; j < num_tasks; j++)
|
||||||
{
|
{
|
||||||
|
// Initialize register_in_32b array
|
||||||
|
memset(register_in_32b, 0, sizeof(register_in_32b));
|
||||||
|
|
||||||
// Write i to register format
|
// Write i to register format
|
||||||
register_in_32b[0] = task_inputs[j] & 0xFF; // Least significant byte
|
register_in_32b[0] = task_inputs[j] & 0xFF; // Least significant byte
|
||||||
register_in_32b[1] = (task_inputs[j] >> 8) & 0xFF;
|
register_in_32b[1] = (task_inputs[j] >> 8) & 0xFF;
|
||||||
@ -216,7 +218,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// // Write to serial port
|
// // Write to serial port
|
||||||
// qemu_chr_fe_write(serial_chr, data, length);
|
// qemu_chr_fe_write(serial_chr, data, length);
|
||||||
|
|
||||||
fclose(fptr);
|
fclose(fptr);
|
||||||
free(deltas);
|
free(deltas);
|
||||||
free(inputs);
|
free(inputs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user