fw: Change ASLR name in MMIO

Use _RAM_ADDR_RAND instead of _RAM_ASLR since this is not OS-level
ASLR we're talking about. It's address randomization as seen from
outside of the CPU, not from the process running inside it. Ordinary
ASLR is visible from the CPU.
This commit is contained in:
Michael Cardell Widerkrantz 2024-03-18 15:57:55 +01:00
parent f40987b138
commit 4d4db70590
No known key found for this signature in database
GPG Key ID: D3DB3DDF57E704E5
2 changed files with 5 additions and 3 deletions

View File

@ -29,7 +29,7 @@ static volatile uint32_t *timer = (volatile uint32_t *)TK1_MMIO_TIMER_
static volatile uint32_t *timer_prescaler = (volatile uint32_t *)TK1_MMIO_TIMER_PRESCALER;
static volatile uint32_t *timer_status = (volatile uint32_t *)TK1_MMIO_TIMER_STATUS;
static volatile uint32_t *timer_ctrl = (volatile uint32_t *)TK1_MMIO_TIMER_CTRL;
static volatile uint32_t *ram_aslr = (volatile uint32_t *)TK1_MMIO_TK1_RAM_ASLR;
static volatile uint32_t *ram_rand = (volatile uint32_t *)TK1_MMIO_TK1_RAM_ADDR_RAND;
static volatile uint32_t *ram_scramble = (volatile uint32_t *)TK1_MMIO_TK1_RAM_SCRAMBLE;
// clang-format on
@ -369,7 +369,7 @@ static void scramble_ram(void)
uint32_t rnd_incr = rnd_word();
// Set RAM address and data scrambling values
*ram_aslr = rnd_word();
*ram_rand = rnd_word();
*ram_scramble = rnd_word();
// Fill RAM with random data (FW does not use RAM, has its stack in
@ -380,7 +380,7 @@ static void scramble_ram(void)
}
// Set new scrambling values, for all use of RAM by app
*ram_aslr = rnd_word();
*ram_rand = rnd_word();
*ram_scramble = rnd_word();
}

View File

@ -133,7 +133,9 @@
#define TK1_MMIO_TK1_UDI_FIRST 0xff0000c0
#define TK1_MMIO_TK1_UDI_LAST 0xff0000c4
// Deprecated - use _ADDR_RAND instead
#define TK1_MMIO_TK1_RAM_ASLR 0xff000100
#define TK1_MMIO_TK1_RAM_ADDR_RAND 0xff000100
#define TK1_MMIO_TK1_RAM_SCRAMBLE 0xff000104
#define TK1_MMIO_TK1_CPU_MON_CTRL 0xff000180