improved generic payload entry point
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
#include "bootrom_func.h"
|
||||
|
||||
PAYLOAD_SECTION
|
||||
uint64_t entry_sync(uint64_t *args)
|
||||
void entry_sync(uint8_t *src, uint8_t *dst, uint8_t *key, int32_t rep)
|
||||
{
|
||||
int i, j;
|
||||
unsigned char src_data[16];
|
||||
|
||||
unsigned char *src = (unsigned char *) args[0];
|
||||
unsigned char *dst = (unsigned char *) args[1];
|
||||
unsigned char *key = (unsigned char *) args[2];
|
||||
int rep = (int) args[3];
|
||||
|
||||
for(j = 0; j < 16; j++)
|
||||
{
|
||||
src_data[j] = src[j];
|
||||
@@ -21,12 +16,7 @@ uint64_t entry_sync(uint64_t *args)
|
||||
if(i % 2 == 0) hardware_aes(16, src_data, dst, 16, 0, key, 0);
|
||||
else hardware_aes(16, dst, src_data, 16, 0, key, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PAYLOAD_SECTION
|
||||
uint64_t entry_async(uint64_t *base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void entry_async(uint64_t *base){}
|
||||
@@ -141,18 +141,12 @@ void aes128_encrypt_ecb(unsigned char *msg, unsigned int msg_len, unsigned char
|
||||
}
|
||||
|
||||
PAYLOAD_SECTION
|
||||
uint64_t entry_sync(uint64_t *args)
|
||||
uint64_t entry_sync(unsigned char *msg, unsigned int msg_len, unsigned char key[16],
|
||||
unsigned char sbox[16][16], unsigned char rc_lookup[11],
|
||||
unsigned char mul2[256], unsigned char mul3[256])
|
||||
{
|
||||
unsigned long long start = 0, end = 0;
|
||||
|
||||
unsigned char *msg = (unsigned char *) args[0];
|
||||
unsigned int msg_len = (unsigned int) args[1];
|
||||
unsigned char *key = (unsigned char *) args[2];
|
||||
unsigned char *sbox = (unsigned char *) args[3];
|
||||
unsigned char *rc_lookup = (unsigned char *) args[4];
|
||||
unsigned char *mul2 = (unsigned char *) args[5];
|
||||
unsigned char *mul3 = (unsigned char *) args[6];
|
||||
|
||||
__asm__ volatile ("mrs %0, cntpct_el0" : "=r" (start));
|
||||
aes128_encrypt_ecb(msg, msg_len, key, sbox, rc_lookup, mul2, mul3);
|
||||
__asm__ volatile ("mrs %0, cntpct_el0" : "=r" (end));
|
||||
@@ -167,7 +161,7 @@ uint64_t entry_sync(uint64_t *args)
|
||||
}
|
||||
|
||||
PAYLOAD_SECTION
|
||||
uint64_t entry_async(uint64_t *base)
|
||||
void entry_async(uint64_t *base)
|
||||
{
|
||||
unsigned long long start = 0, end = 0;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void fix_heap()
|
||||
check_all_chksums();
|
||||
}
|
||||
|
||||
extern uint64_t entry_sync(uint64_t *args)
|
||||
void entry_sync()
|
||||
{
|
||||
fix_heap();
|
||||
|
||||
@@ -47,10 +47,6 @@ extern uint64_t entry_sync(uint64_t *args)
|
||||
*(ADDR_DFU_STATUS) = 1;
|
||||
|
||||
event_notify(ADDR_DFU_EVENT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern uint64_t entry_async(uint64_t *base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void entry_async(uint64_t *base){}
|
||||
@@ -39,13 +39,13 @@ uint64_t floppysleep_iteration(float *init)
|
||||
}
|
||||
|
||||
PAYLOAD_SECTION
|
||||
uint64_t entry_sync(uint64_t *args)
|
||||
uint64_t entry_sync(float *init_ptr)
|
||||
{
|
||||
return floppysleep_iteration((float *) args[0]);
|
||||
return floppysleep_iteration(init_ptr);
|
||||
}
|
||||
|
||||
PAYLOAD_SECTION
|
||||
uint64_t entry_async(uint64_t *args)
|
||||
void entry_async(uint64_t *args)
|
||||
{
|
||||
float *init_ptr = (float *) args[0];
|
||||
args[0] = 0;
|
||||
@@ -54,7 +54,7 @@ uint64_t entry_async(uint64_t *args)
|
||||
{
|
||||
floppysleep_iteration(init_ptr);
|
||||
|
||||
if(args[0] % 1000000 == 0) task_resched();
|
||||
args[0]++;
|
||||
if(args[0] % 100000 == 0) task_resched();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
#include "dev_util.h"
|
||||
|
||||
PAYLOAD_SECTION
|
||||
extern uint64_t entry_sync(uint64_t *args)
|
||||
void entry_sync()
|
||||
{
|
||||
__asm__("dmb sy");
|
||||
__asm__("ic iallu");
|
||||
__asm__("dsb sy");
|
||||
__asm__("isb");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PAYLOAD_SECTION
|
||||
extern uint64_t entry_async(uint64_t *base)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void entry_async(){}
|
||||
Reference in New Issue
Block a user