WIP
This commit is contained in:
parent
e2c86a90f4
commit
71667ebd7c
@ -9,8 +9,6 @@ SECTIONS
|
||||
.magic_header : {
|
||||
LONG(0x88DAD0F2) /* Magic header containing */
|
||||
LONG(ADDR(.text)) /* Entry point */
|
||||
LONG(0x88DAD0F3) /* Magic header containing */
|
||||
LONG(ADDR(.magic_header)) /* Entry point */
|
||||
} > RAM
|
||||
|
||||
.text : {
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
__attribute__((section(".text"))) int cryptographic_test() {
|
||||
static const uint32_t vv = 0xDEADBEEF;
|
||||
// Run unit tests for cryptographic scheme
|
||||
//while(1); // Debug loop
|
||||
return 7;
|
||||
|
30
runner.c
30
runner.c
@ -11,37 +11,17 @@ typedef int (*func_t)();
|
||||
void execute_library_function() {
|
||||
printf("Scanning RAM...\n");
|
||||
uint32_t *ptr = (uint32_t *)RAM_START;
|
||||
uint32_t entry_point;
|
||||
|
||||
while ((uint32_t)ptr < RAM_END) {
|
||||
if (*ptr == LIB_MAGIC) {
|
||||
printf("Found libpqscheme_test 0x%X!\n", ptr);
|
||||
|
||||
printf("1>...%X 0x%X\n", ptr + 1, *(ptr + 1));
|
||||
printf("2>...%X 0x%X\n", ptr + 2, *(ptr + 2));
|
||||
printf("3>...%X 0x%X\n", ptr + 3, *(ptr + 3));
|
||||
|
||||
for (size_t i = 0; i < 20; i++) {
|
||||
printf("%X %2X \n", (((uint8_t *)ptr) + i),
|
||||
*(((uint8_t *)ptr) + i));
|
||||
}
|
||||
|
||||
/*
|
||||
uint32_t entry_point = *((uint32_t *)(ptr + 0x10));
|
||||
uint8_t *p = (uint8_t *)entry_point;
|
||||
printf("\n");
|
||||
|
||||
func_t test_func = (func_t)entry_point;
|
||||
entry_point = RAM_START + (*(ptr + 1));
|
||||
entry_point |= 1;
|
||||
func_t test_func = (func_t)(entry_point);
|
||||
if (test_func) {
|
||||
printf("Try exec...0x%X 0x%X\n", entry_point,
|
||||
0x20000034 + 0x10);
|
||||
printf(">> %d\n", test_func());
|
||||
printf("Result: %d\n", test_func());
|
||||
}
|
||||
*/
|
||||
uint32_t entry_point = (0x20000000 + 0x44) | 1;
|
||||
func_t test_func = (func_t)entry_point;
|
||||
printf("> Entry point\n", entry_point);
|
||||
int res = test_func();
|
||||
printf(">> %d\n", res);
|
||||
return;
|
||||
}
|
||||
ptr++;
|
||||
|
Loading…
Reference in New Issue
Block a user