copter DELETE_RNG_STATE
This commit is contained in:
parent
ddf7fd85f9
commit
47b1d2bcd7
@ -187,6 +187,9 @@ endif
|
||||
ifeq ($(PARTITION_INPUT), 1)
|
||||
CFLAGS += -D PARTITION_INPUT=1
|
||||
endif
|
||||
ifeq ($(DELETE_RNG_STATE), 1)
|
||||
CFLAGS += -D DELETE_RNG_STATE=1
|
||||
endif
|
||||
|
||||
DEFINES := -DQEMU_SOC_MPS2 -DHEAP3
|
||||
|
||||
|
@ -15,6 +15,12 @@ volatile unsigned char FUZZ_INPUT[MAX_INPUT_BYTES] = {};
|
||||
volatile int INPUT_POINTERS[NUM_TASKS] = {};
|
||||
volatile uint32_t FUZZ_LENGTH = MAX_INPUT_BYTES;// ignored
|
||||
|
||||
#ifdef DELETE_RNG_STATE
|
||||
#define RNG_RESET {RNG_STATES[task_id] = task_id;}
|
||||
#else
|
||||
#define RNG_RESET {}
|
||||
#endif
|
||||
|
||||
__attribute__((noinline)) static void trigger_Qemu_break( void )
|
||||
{
|
||||
puts("Trigger");
|
||||
@ -27,9 +33,6 @@ __attribute__((noinline)) static void trigger_job_done( void )
|
||||
}
|
||||
|
||||
static unsigned char fuzz_char_next(int tasknum) {
|
||||
#ifndef FUZZ_BYTES
|
||||
return 255;
|
||||
#endif
|
||||
#ifdef PARTITION_INPUT
|
||||
if (INPUT_POINTERS[tasknum] == 0) {
|
||||
INPUT_POINTERS[tasknum] = tasknum * (MAX_INPUT_BYTES / NUM_TASKS);
|
||||
@ -54,6 +57,9 @@ static unsigned char fuzz_char_next(int tasknum) {
|
||||
|
||||
volatile int RNG_STATES[NUM_TASKS] = {};
|
||||
static unsigned char next(int tasknum) {
|
||||
#ifndef FUZZ_BYTES
|
||||
return 255;
|
||||
#endif
|
||||
RNG_STATES[tasknum] = RNG_FROM(RNG_STATES[tasknum]);
|
||||
unsigned char t = fuzz_char_next(tasknum);
|
||||
return RNG_STATES[tasknum] ^ (((int)t << 8) + (int)t);
|
||||
@ -170,6 +176,7 @@ static void prv_SignalGatherInitiateTask(void *pvParameters) {
|
||||
TickType_t xLastWakeTime = initial_release_time;
|
||||
const TickType_t xFrequency = 3 / portTICK_PERIOD_MS;
|
||||
do {
|
||||
RNG_RESET
|
||||
// timing_start(0);
|
||||
xSemaphoreTake(xSemaphore_SPIBus, 1);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
@ -191,6 +198,7 @@ static void prv_SignalGatherFinishedTask(void *pvParameters) {
|
||||
const int task_id = 1;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
xTaskNotify(xTask_SignalProcessingAttitudeTask, 0, eNoAction);
|
||||
@ -205,6 +213,7 @@ static void prv_SignalGatherTimeoutTask(void *pvParameters) {
|
||||
const int task_id = 2;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
xSemaphoreTake(xSemaphore_SPIBus, 1);
|
||||
@ -222,6 +231,7 @@ static void prv_SignalProcessingActuateTask(void *pvParameters) {
|
||||
const int task_id = 3;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
trigger_job_done();
|
||||
@ -232,6 +242,7 @@ static void prv_SignalProcessingAttitudeTask(void *pvParameters) {
|
||||
const int task_id = 4;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
// timing_end(0);
|
||||
@ -244,6 +255,7 @@ static void prv_FlightControlTask(void *pvParameters) {
|
||||
TickType_t xLastWakeTime = initial_release_time;
|
||||
const TickType_t xFrequency = 9 / portTICK_PERIOD_MS;
|
||||
do {
|
||||
RNG_RESET
|
||||
// timing_start(1 | TIMING_POINT_IS_HIGHEST_PRIO);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
xTaskNotify(xTask_FlightControlAttitudeTask, 0, eNoAction);
|
||||
@ -259,6 +271,7 @@ static void prv_FlightControlAttitudeTask(void *pvParameters) {
|
||||
const int task_id = 6;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
trigger_job_done();
|
||||
@ -269,6 +282,7 @@ static void prv_FlightControlActuateTask(void *pvParameters) {
|
||||
const int task_id = 7;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
trigger_job_done();
|
||||
@ -279,6 +293,7 @@ static void prv_MavlinkSendTask(void *pvParameters) {
|
||||
const int task_id = 8;
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
WASTE_USEC(LONG_CALC);
|
||||
xSemaphoreTake(xSemaphore_SPIBus, 1);
|
||||
@ -299,6 +314,7 @@ static void prv_CopterControlTask(void *pvParameters) {
|
||||
#endif
|
||||
trigger_job_done();
|
||||
do {
|
||||
RNG_RESET
|
||||
#ifdef FUZZ_INT_ACTIVATION
|
||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
||||
#else
|
||||
@ -317,6 +333,7 @@ static void prv_CopterControlTask(void *pvParameters) {
|
||||
|
||||
void ISR_0_Handler(void) {
|
||||
const int task_id = 10;
|
||||
RNG_RESET
|
||||
// timing_start(2 | TIMING_POINT_START_INTERRUPT_FROM_IDLE);
|
||||
WASTE_USEC(SHORT_CALC);
|
||||
xTaskNotifyFromISR(xTask_CopterControlTask, 0, eNoAction, NULL);
|
||||
@ -328,6 +345,7 @@ static void prv_CopterControlWatchdogTask(void *pvParameters) {
|
||||
TickType_t xLastWakeTime = initial_release_time;
|
||||
const TickType_t xFrequency = 10 / portTICK_PERIOD_MS;
|
||||
do {
|
||||
RNG_RESET
|
||||
WASTE_USEC(LONG_CALC);
|
||||
trigger_job_done();
|
||||
xTaskDelayUntil( &xLastWakeTime, xFrequency );
|
||||
|
Loading…
x
Reference in New Issue
Block a user